sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
5a681a5fa9d4f8389bd25b6b16e30fde84dc4e1c58a130870e4d4bd673c2d0d1
Python
442
20
from qtpy.QtCore import Signal from qtpy.QtWidgets import QLabel class QLabelMT(QLabel): mouseMoved = Signal() """ """ def __init__(self) -> None: super().__init__() self.setMouseTracking(True) def mouseMoveEvent(self,event): self.cursorPos = [event.pos().x()...
6644abed002b72c0f238e051610a4b7b873654e24a4406280d1535270609b1e1
Python
442
10
DEFAULT_CROP_PCT = 0.875 DEFAULT_CROP_MODE = 'center' IMAGENET_DEFAULT_MEAN = (0.485, 0.456, 0.406) IMAGENET_DEFAULT_STD = (0.229, 0.224, 0.225) IMAGENET_INCEPTION_MEAN = (0.5, 0.5, 0.5) IMAGENET_INCEPTION_STD = (0.5, 0.5, 0.5) IMAGENET_DPN_MEAN = (124 / 255, 117 / 255, 104 / 255) IMAGENET_DPN_STD = tuple([1 / (.0167 *...
a58068e0114a6ad2a5f0ef1a0c3ebc5761b7826361fc2b8d806509ebf93a72f3
Python
442
20
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import enum from cvat_sdk.models import LocationEnum as RawLocationEnum class Location(str, enum.Enum): LOCAL = "local" CLOUD_STORAGE = "cloud_storage" def __str__(self) -> str: return self.value assert all( [getattr(Loc...
2b401340c5a74cf97ea43e50190508c5cb6d142b5f54432ff3283074e3315755
Python
443
21
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import cvat_sdk.auto_annotation as cvataa import cvat_sdk.models as models import PIL.Image spec = cvataa.DetectionFunctionSpec( labels=[ cvataa.label_spec("car", 0), ], ) def detect( context: cvataa.DetectionFunctionContext, i...
2f3afa8e0c3c92d28cd477d038c8a564848bf9e59c14ed51965f75bfc4ac547d
Python
443
9
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['convnext_tiny_imagenet1k_GELU_crop'] = lambda: ModelCommitment( identifier='convnext_tiny_imagenet1k_GELU_crop', activatio...
5ac7fb7d350aec25ad5f20aa1e59a1820920910c9fe6b431d397341024e8e0b0
Python
443
19
from bannotator.mainwindow import MainWindow import sys, os from PySide6.QtWidgets import QApplication from PySide6.QtGui import QIcon def main(): app = QApplication(sys.argv) mainwindow = MainWindow() app.installEventFilter(mainwindow) app.setApplicationName("Bannotator") app.setWindowIcon(QIcon(...
66f5451dfedf43ef8a0accedd627bac867da4b67eb346059ee0e9a9a6b67c07e
Python
443
9
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....
924893b336417f9ccba249a6fdeff59ce6a173415fb5cd56ff4c71eaa8c8ae41
Python
443
9
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['convnext_tiny_imagenet1k_APGD_GELU'] = lambda: ModelCommitment( identifier='convnext_tiny_imagenet1k_APGD_GELU', activatio...
b59dc12a30e7c84c108448454a0fd10531dfd859202186a6c7375fab588be32e
Python
443
20
"""# Manual progress bar Example of a progress bar being updated manually. """ from magicgui import magicgui from magicgui.widgets import ProgressBar @magicgui(call_button="tick", pbar={"min": 0, "step": 2, "max": 20, "value": 0}) def manual(pbar: ProgressBar, increment: bool = True): """Example of manual prog...
bc0dee1aad9fbfa17ee4c3b16be620102a1a2798f7b009ca4e0c98a529790c19
Python
443
9
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['convnext_tiny_imagenet1k_HAND_crop'] = lambda: ModelCommitment( identifier='convnext_tiny_imagenet1k_HAND_crop', activatio...
d53120dfa4c3093e85246521874c20f47b76c2eadfc7e40c0b1946eba088ee54
Python
443
16
import subprocess import glob ROOT = '/Users/sebastiandresbach/data/s1Anfunco/Nifti/derivatives/designFiles/stimulationPatterns' subs = ['sub-15', 'sub-16', 'sub-17', 'sub-18'] for sub in subs: subFolder = f'{ROOT}/{sub}' files = sorted(glob.glob(f'{subFolder}/*ses-00*_D*.txt')) for file in files: ...
e38b9a9a9f53736ae0b4f369cfe5c1ce40ec5322d5e7c1da2e9db995b3b87508
Python
443
15
from torch.nn.modules.loss import _Loss from . import functional as F __all__ = ["WingLoss"] class WingLoss(_Loss): def __init__(self, width=5, curvature=0.5, reduction="mean"): super(WingLoss, self).__init__(reduction=reduction) self.width = width self.curvature = curvature def for...
10f0f42c82f59fa4b818ef5f2faa04166b8fb2ccabd80191290e9f6299028c62
Python
445
12
from ._version import __version__ from .project_settings import projects from .run import run from .preparation import create_cereb_surface, get_central_gm_with_mask, get_center_pos from .simulation import run_FEMs, analyse_simus from .reporting import placement_guide, internal_report from .run_line import run_line fr...
1415aab330e76f1e9f70f25897eda4cdde595282c028ce2b2d9a14405b4863c4
Python
445
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['Zejin_Lu_dvd_baseline_imagenet_resnet50'] = lambda: ModelCommitment(identifier='Zejin_Lu_dvd_baseline_imagenet_resnet50', activation...
6e3c8443db3dac6ba9d33dbfa9c13591687a2324e152a1c24cfa410a0bec9f8d
Python
445
11
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['dinov2_vitl14_reg_lc'] = lambda: ModelCommitment( identifier='dinov2_vitl14_reg_lc', activations_model=get_model('dinov2_vitl14_...
8f2a147a1a9cc06104750a9fc427da548803c1d44668cd8ccabae055a3101ae2
Python
445
11
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['dinov2_vitg14_reg_lc'] = lambda: ModelCommitment( identifier='dinov2_vitg14_reg_lc', activations_model=get_model('dinov2_vitg14_...
303ebaac66fae8971dbfb8605e206789342fc583d99beded51378a7c1fecac12
Python
446
17
'''Test the ogoBmdAnalysis command line interface exists''' import unittest import subprocess class TestBMDAnalysisExists(unittest.TestCase): '''Test the ogoBmdAnalysis command line interface exists''' def test_can_call_ogo_help(self): '''Can call `BmdAnalysis --help`''' command = ['ogoBmdAn...
7d0ad9ccfcfbd98d0e4dabf1735278ff10a66a837c60acbf098fc3e96e8d9ede
Python
446
17
'''Test the ogoBmdTabulate command line interface exists''' import unittest import subprocess class TestBMDAnalysisExists(unittest.TestCase): '''Test the ogoBmdTabulate command line interface exists''' def test_can_call_ogo_help(self): '''Can call `BmdAnalysis --help`''' command = ['ogoBmdTa...
843acdfda4505035a599d3d100b21c126f65b19d77a840dc571d0b6360559c35
Python
447
19
from PyQt5.QtWidgets import QLabel from PyQt5 import QtCore class QLabelMT(QLabel): mouseMoved = QtCore.pyqtSignal() """ """ def __init__(self) -> None: super().__init__() self.setMouseTracking(True) def mouseMoveEvent(self,event): self.cursorPos = [event.pos(...
9a5ebbf594bd9aa5bb5e0691ad1b5f378a62a042af5af837b3b28543c6eb1a55
Python
447
9
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['convnext_tiny_imagenet1k_TA_HANDsum'] = lambda: ModelCommitment( identifier='convnext_tiny_imagenet1k_TA_HANDsum', activat...
042a6d63a2e9857c2727484d67126add9595a4d7b01504f8791948eba0b9c439
Python
448
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['convnext_base_fb_in1k_gram_aligned_dinov3'] = lambda: ModelCommitment(identifier='convnext_base_fb_in1k_gram_aligned_dinov3', activation...
fea49857574bb02cd690f8d39c339fe808d953795cec793f36be6681ce3a56b9
Python
448
16
# 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, build_sam_vit_t...
26769e24202a6550fc494a9ffa5dd949f3fdea859d92bd03ec46939a8386bc84
Python
449
17
__all__ = ["is_file", "write_output"] def is_file(f): """ Check if f is a file-like object. Compatible with Python 3 :param f: :return: True if `f` is file-like; False otherwise. """ return hasattr(f, 'read') def write_output(results, output, append=False): results.to_csv(output, sep="\...
77f8703ef6177da7a622ff5bd730b92f26a9b61021b4154e54b91b7c680f8fb9
Python
449
13
from setuptools import setup if __name__ == "__main__": try: setup(use_scm_version={"version_scheme": "no-guess-dev"}) except: # noqa print( "\n\nAn error occurred while building the project, " "please ensure you have the most updated version of setuptools, " ...
a759a6a2b310b5f781d554a86b0cdb9e2373e89ccf414b7ef4a187cda9af1e7e
Python
449
19
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from abc import ABCMeta, abstractmethod from cvat_sdk.api_client import models from PIL import Image from shared.tasks.enums import SourceDataType class ITaskSpec(models.ITaskWriteRequest, models.IDataRequest, metaclass=ABCMeta): size: int ...
dd7e4f5863ae1a533fac8f7acd21ecc93a4b40bb3e88033b6ca8f5a8b035cd3f
Python
449
26
# -*- coding: utf-8 -*- """TODO""" class Device: """TODO""" unique_id_count = 0 def __init__(self): """TODO""" self.active = True self.unique_id = Device.unique_id_count Device.unique_id_count += 1 self.name = "Device" + str(self.unique_id) def evolve(self): ...
9cddcf8edcf6f6962786f4d9accc546cdd1e988abe4282f2715b4a466ecd1aef
Python
450
12
import torch import torch.nn as nn class twoLayerMLP(nn.Module): def __init__(self, input_dim, output_dim, hidden_dim=256, activation="relu"): super().__init__() self.mlp1 = nn.Linear(input_dim, hidden_dim) self.mlp2 = nn.Linear(hidden_dim, output_dim) self.activation = nn.ReLU() if...
fbe28640002937a53badf8bdbaf3c0bcb5ce6cc41d25aa89a0f7f5e9994e5dec
Python
450
16
import numpy as np from .utils import multi_input def predict_with_model(eval_model, input_data: np.ndarray, batch_size: int = 32) -> np.ndarray: input_data = np.expand_dims(input_data, axis=-1) input_data_list = multi_input(input_data) pred_test_list = eval_model.predict(input_data_list, batch_size)...
02f7c76c73c823474fcb55149a18343a36bb1ff106deb568753406ede916c0fd
Python
451
20
# Generated by Django 2.1.3 on 2019-01-23 10:05 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("dataset_repo", "0001_initial"), ] replaces = [("git", "0002_auto_20190123_1305")] operations = [ migrations.AlterField( mod...
1c22ab77db285b05b7e0a60cd417459182613ea5c746dffec6993a5f86cdbcf1
Python
451
16
# -*- coding: utf-8 -*- # 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_vi...
4e9409af160f5c86662320ead6a0f9c2d0012b131a1336e6de3731ea2c69e5fd
Python
452
10
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['convnext_xxlarge_clip'] = lambda: ModelCommitment( identifier='convnext_xxlarge_clip', activations_model=get_model('convnext_xxl...
58be105d739d90c8e5f3e4e87ff83aac6f4ffc3852bc875a227beadff6aec3aa
Python
452
21
def get_repetition_time(in_file): """ Get time-to-repetition of the scan. CAUTION: Name in the old PUMI is get_scan_info Parameters ---------- in_file (str): Path to (functional!) nifti-image Returns ------- TR (float): Time-to-repetition of file """ import nibabel as ni...
9b97b8b326e447dc438eef17fc60971bdcfab2c1732d679779bd7ce22d00b452
Python
452
20
# Generated by Django 3.2.12 on 2022-05-20 09:21 from django.db import migrations import cvat.apps.engine.models class Migration(migrations.Migration): dependencies = [ ("engine", "0052_alter_cloudstorage_specific_attributes"), ] operations = [ migrations.AddField( model_na...
0c20fa5651787c9f6cba1f516ab05b9adf3df19b557a989c8276edf828cd2e0d
Python
453
20
from PyQt5.QtWidgets import QLabel from PyQt5 import QtCore class QLabelMT(QLabel): mouseMoved = QtCore.pyqtSignal() """ """ def __init__(self) -> None: super().__init__() self.setMouseTracking(True) def mouseMoveEvent(self,event): self.cursorPos = [even...
e289280ba36985240796dc8c818eee45b3d2014582e7982873da064f9bbe27ef
Python
453
17
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import os from django.core.exceptions import ImproperlyConfigured MAX_QUALITY_REQUIREMENTS_PER_SETTINGS = int( os.getenv("CVAT_MAX_QUALITY_REQUIREMENTS_PER_SETTINGS", 100) ) if MAX_QUALITY_REQUIREMENTS_PER_SETTINGS < 1: raise ImproperlyCon...
e63edaf236bd70966af150f1bf9c0db42ff6591cbfbeb313720449222d20c8a3
Python
453
20
import pandas as pd split = pd.read_csv('/data2/whr/czl/TwiBot22-baselines/datasets/gilani-2017/split.csv') user = pd.read_csv('./user_feature.csv') user_list = list(user['id']) del_list = [] for i,r in split.iterrows(): if r[0] not in user_list: del_list.append(i) print(len(del_list)) split.drop(inde...
27ba8b91c358f5ae3117d3e21ce07e52e7b63827f4f4bc6700b9d0b2f0368d57
Python
455
15
import numpy as np import pytest import brainscore_vision @pytest.mark.private_access @pytest.mark.parametrize('identifier,shape,nans', [ ('BashivanKar2019.naturalistic', (24320, 233, 1), 309760), ('BashivanKar2019.synthetic', (21360, 233, 1), 4319940), ]) def test_assembly_shape(identifier, shape, nans): ...
4e86b386564bf560766df21126612adfe06a17b0f3c3938cbf9699c50493cefc
Python
455
23
# -*- coding: utf-8 -*- """ Created on Tue Dec 12 21:27:14 2023 @author: Artur Klepaczko """ import pandas as pd from skfeature.function.similarity_based import fisher_score df = pd.read_csv('t2_kidney_texture_features.csv', sep=',') data = df.to_numpy() X = data[:, 1:-1] y = data[:, -1] score = fisher_score.fish...
6f132a5cb912ad976e57501c1d59f60fbd66e1da52805146f7f1e25a6731b52d
Python
455
18
import logging from .detection import * from .evaluation import * from .fetchers import * from .heart import * from .hypno import * from .others import * from .plotting import * from .sleepstats import * from .spectral import * from .staging import * # Define YASA logger logging.basicConfig(format="%(asctime)s | %(le...
e4f74828c6c495ab0fa0685757ffbea3b5efc4144ff1a03f22d665999f536aca
Python
455
11
# __init__.py - Model registration for hk_model_2 (SwAV) from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers # hk_model_2: Self-supervised ResNet-50 (SwAV) registration model_registry['hk_model_2'] = lamb...
e555f4df7938ebd8de03daf1026cbf8ce0bcb1b7dee0c7bd4188ea0b01ab70bb
Python
455
13
#!/usr/bin/env python # This script adds access to the Django env and settings in the default rqscheduler # implementation. This is required for correct work with CVAT queue settings and # their access options such as login and password. from rq_scheduler.scripts import rqscheduler # Required to initialize Django se...
8315721824062c1847b654a097737002027fb13e2a8d2df0bf23a86034bd9278
Python
457
9
"""isort:skip_file""" from .layer_norm import LayerNorm from .softmax_dropout import softmax_dropout from .multihead_attention import SelfMultiheadAttention, CrossMultiheadAttention from .transformer_encoder_layer import TransformerEncoderLayer from .transformer_encoder import TransformerEncoder, init_bert_params, rel...
a0be2d873cf6b3d36ff018c18c18cbecc2a0dda1bc3e790f133b4bff45ef7500
Python
457
11
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['dinov2_vitl14_lc_res336'] = lambda: ModelCommitment( identifier='dinov2_vitl14_lc_res336', activations_model=get_model('dinov2_v...
d2872324a13deac6b351b70389676e80bcfb0844f331d8917e2669a6dba2a3a8
Python
457
14
import matplotlib.pyplot as plt color_scheme = { 'concrete-baseline': plt.cm.Reds(0.3), 'concrete-subsective': plt.cm.Reds(0.5), 'concrete-privative': plt.cm.Reds(0.7), 'abstract-baseline': plt.cm.Blues(0.3), 'abstract-subsective': plt.cm.Blues(0.5), 'abstract-privative': plt.cm.Blues(0.7), ...
0ace1756c56e095cf70297b4c77a890f1c229fe10190357e7c6286162a38ed30
Python
458
12
from transformers import AutoTokenizer, AutoModel, AutoConfig model_name = "microsoft/BiomedNLP-PubMedBERT-base-uncased-abstract-fulltext" cache_dir = "./pretrained_models" # 下载并缓存模型文件 config = AutoConfig.from_pretrained(model_name, cache_dir=cache_dir) tokenizer = AutoTokenizer.from_pretrained(model_name, cache_dir...
22a0affd1909038e4558a5c511e3cf4709be43f0d49b69f7e6aa6971296e1028
Python
458
18
import click from _cli import LazyGroup @click.group( cls=LazyGroup, lazy_subcommands={ "collect": "i2m.collect_mesh_data.collect", "concentrations2mesh": "i2m.concentrations_to_mesh.concentrations2mesh", "dti2mesh": "i2m.dti_data_to_mesh.dti2mesh", "subdomains": "i2m.mesh_seg...
3d792a7f9b223d005ee216729d5b826d2db23d69ab06e2dcada0c48546ee6556
Python
458
18
# -*- 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...
4b58ecd3cf02f2f038b60bb35195667abf9544ccff5fae6b833dc9405b37c60c
Python
458
10
import jax.numpy as jnp import matplotlib.pyplot as plt def sort_rows_by_first_threshold(matrix, threshold): first_above_thresh = jnp.argmax(matrix > threshold[:, None], axis=1) all_below_thresh = ~jnp.any(matrix > threshold[:, None], axis=1) first_above_thresh = first_above_thresh.at[all_below_thresh].s...
7c91f7ce43e2c915bbdccb6a17a6966ecf37d27a05f7462aeff85eef7b53e1b0
Python
458
7
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['densenet-201'] = lambda: ModelCommitment(identifier='densenet-201', activ...
ab394f785ebd24a5914b7824650b67df45c2a7daf21f60ec80a3274ae3e2ef4e
Python
458
9
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['cvt_cvt-13-224-in1k_4_LucyV4'] = \ lambda: ModelCommitment(identifier='cvt_cvt-13-224-in1k_4_LucyV4', a...
f09f5cd7ce9b904b340ca3a728b22f53b6c0c455e5b34272c7d1e87dcd52f0c8
Python
458
9
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['cvt_cvt-21-224-in1k_4_LucyV4'] = \ lambda: ModelCommitment(identifier='cvt_cvt-21-224-in1k_4_LucyV4', a...
fa19bb0ca0fc7094ed68425aa141ec84bae7b17fced303f96dba044dab687d37
Python
458
7
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['inception_v3'] = lambda: ModelCommitment(identifier='inception_v3', activ...
fc7be20ae53e29250e38106069d2d1002c8dc5e677c3c29c9384a26202d26276
Python
458
7
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['inception_v4'] = lambda: ModelCommitment(identifier='inception_v4', activ...
fdd6693e4ba7502d3f68008370c72e10f12191d15785969aef0aeb59b02e22b4
Python
458
9
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['cvt_cvt-13-384-in1k_4_LucyV4'] = \ lambda: ModelCommitment(identifier='cvt_cvt-13-384-in1k_4_LucyV4', a...
252d0e7a6b24e8e454a142fbb08a47d7a5f32f1a0e05d2df4bec944ff82d6a80
Python
459
22
# This file is part of connectome-manipulator. # # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2024 Blue Brain Project/EPFL """init""" from connectome_manipulator.connectome_manipulation.manipulation.base import ( Manipulation, MorphologyCachingManipulation, ) from . import ( conn_wiring, con...
35854982b610b04e4cdb7821c107b6bcf29a47d3a94e3b1e5f55cc264ecbb2c1
Python
459
20
import pandas as pd split = pd.read_csv('/data2/whr/czl/TwiBot22-baselines/datasets/cresci-stock-2018/split.csv') user = pd.read_csv('./user_feature.csv') user_list = list(user['id']) del_list = [] for i,r in split.iterrows(): if r[0] not in user_list: del_list.append(i) print(len(del_list)) split.dro...
664eaa763adaba0ff7e59f4ab178a9d8d938271b30590b4adaa50900bb03680d
Python
459
16
import sys class Logger(object): def __init__(self, logfile): self.terminal = sys.stdout self.log = open(logfile, "a") def write(self, message): self.terminal.write(message) self.log.write(message) def flush(self): #this flush method is needed for python 3 compatib...
72cf321fb53e4cf9eb4d662a09013dddabf351f91fad496c96c44f806f428ae8
Python
459
9
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['convnext_tiny_imagenet1K_torchvisionV1'] = lambda: ModelCommitment( identifier='convnext_tiny_imagenet1K_torchvisionV1', a...
8161d037fe43cca58096562505efff6a3584920efe427686caa4fa876428a5a4
Python
459
18
import unittest from deepgo.metrics import compute_roc, compute_metrics import numpy as np class TestMetrics(unittest.TestCase): @classmethod def setUpClass(self): pass def test_compute_roc(self): labels = np.array([1, 1, 1, 1, 1, 0, 0, 0, 0, 0]) preds = np.array([0.1, 0.6, 0.7, ...
a7f45203465d65b2f38d97971b5efcf9108cc43e78e97548105f67e8994236d6
Python
459
9
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['convnext_tiny_imagenet1k_APGD_HANDmean'] = lambda: ModelCommitment( identifier='convnext_tiny_imagenet1k_APGD_HANDmean', a...
cc55318971e7d90c86c3961dc8fa1c946f67436663c7fee6f8ada77f717e787d
Python
459
9
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['cvt_cvt-21-384-in1k_4_LucyV4'] = \ lambda: ModelCommitment(identifier='cvt_cvt-21-384-in1k_4_LucyV4', a...
e844c58a3209ba8bb1c373f5ef30642256befd1a6db20abf5a70a39376cafbc7
Python
459
15
# Created by David Coggan on 2024 06 25 from brainscore_vision import benchmark_registry from .benchmark import ( Coggan2024_V1, Coggan2024_V2, Coggan2024_V4, Coggan2024_IT, ) benchmark_registry['tong.Coggan2024_fMRI.V1-rdm'] = Coggan2024_V1 benchmark_registry['tong.Coggan2024_fMRI.V2-rdm'] = Coggan20...
fe947f10efbde0b5759c3704fac12979ad8bf007cefdbecdeb6ce02567e3e6a4
Python
459
12
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['evresnet_50_1'] = lambda: ModelCommitment( identifier='evresnet_50_1', activations_model=get_model('evresnet_50_1'), layers=...
66795d35eab7a523ed1126fce8807c0a98971fc974679d62a93526de044071f6
Python
460
18
import unittest from toolkit.metrics import compute_roc, compute_metrics import numpy as np class TestMetrics(unittest.TestCase): @classmethod def setUpClass(self): pass def test_compute_roc(self): labels = np.array([1, 1, 1, 1, 1, 0, 0, 0, 0, 0]) preds = np.array([0.1, 0.6, 0.7,...
75b09bf213f58bae4a854f06bed6a0b3b89ad71436cffaa410ab9dde46f89d9b
Python
460
18
#!/usr/bin/env python """ Test get objective. """ from storm_control.test.hal.standardHalTest import halTest def test_hal_go_1(): halTest(config_xml = "none_tcp_config.xml", class_name = "GetObjective1", test_module = "storm_control.test.hal.tcp_tests") def test_hal_go_2(): halTest(...
d1c08ee9927ab6f9187a7ca892f32d2a9e0e1f62f34dc07dfe3cad907050d8a5
Python
460
24
import numpy as np def exp_running_avg(running, new, gamma=.9): return gamma * running + (1. - gamma) * new def accuracy(y_true, y_pred): return np.mean(y_pred == y_true) def onehot(labels): y = np.zeros([labels.size, np.max(labels) + 1]) y[range(labels.size), labels] = 1. return y def softm...
eed868dee0e27aa0d35678bb9afb3afc94cf3f941fb86d03e3f4c475fa03ddbc
Python
460
15
import numpy as np import pytest from impyute.dataset import mnist from impyute.ops import matrix pytest.skip("takes ~30 sec each test", allow_module_level=True) data = mnist()["X"] def test_return_type(): """ Check return type, should return an np.ndarray""" assert isinstance(data, np.ndarray) def test_miss...
17661a7764240fb8598769b330db87ac9c223d3fbe26063a41709833b46824ae
Python
461
19
# Copyright (c) DP Technology. # 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 functools import lru_cache from . import BaseWrapperDataset class FromNumpyDataset(BaseWrapperDataset): def __init__(self, dataset): ...
4238b1e9fa941de508bbb93d0cc5f6079f63d94dcbf67c8561776ed9cf4d968f
Python
461
18
# ----------------------------------------------------------------------------- # Copyright © 2009- The QtPy Contributors # # Released under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Dev CLI entry point for QtPy, a co...
7ab40a6909a80d4ec53426490d9c1a2f343a7100d3676e7c72cd872c2e1b006b
Python
461
15
from unittest import TestCase import kb_python.dry.count as count from tests.mixins import TestMixin class TestCount(TestMixin, TestCase): def test_stream_batch(self): with self.assertRaises(Exception): count.stream_batch(self.smartseq3_remote_batch_path, self.temp_dir) self.assertEq...
af7be0ce161f0852a83577cf46bea7bb4d36c2efba0a9a65f5b2ed75de5704cc
Python
461
25
""" Various utilities for working with `bx.align.Alignment` objects. """ from .chop import chop_list from .fuse import ( fuse, fuse_list, FusingAlignmentWriter, ) from .thread import get_components_for_species from .tile import ( intervals_from_mask, tile_interval, ) __all__ = [ "FusingAlignme...
bc4fe7f62128abb14775598d6d002d2ca4e64765388a0c1805e244921d0c6544
Python
461
28
''' usage example (find top 100 words in abc.txt): cat abc.txt | python jiebacmd.py | sort | uniq -c | sort -nr -k1 | head -100 ''' from __future__ import unicode_literals import sys sys.path.append("../") import jieba default_encoding='utf-8' if len(sys.argv)>1: default_encoding = sys.argv[1] while True: ...
c199272e018309d3a95de25147d77d4f5bef27208a4797058b0b99a11169735b
Python
461
23
"""test_averagings.py""" import impyute as impy from impyute.ops.testing import return_na_check SHAPE = (5, 5) def test_mean(test_data): data = test_data(SHAPE) imputed = impy.mean(data) return_na_check(imputed) def test_mode(test_data): data = test_data(SHAPE) imputed = impy.mode(data) ret...
bcceda10c3ac65d2a2249620b8abca08dad41dd1f538e66d5a1977c58a1c59ac
Python
462
13
# 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 .sam import Sam from .image_encoder import ImageEncoderViT from .mask_decoder_hq import MaskDecoderHQ from .mask_deco...
23885c2a2f55b7b77d27be3536077238df02a74c1ec1474a56f43b2036e30151
Python
463
16
"""Helpers for runtime environment configuration.""" import os def require_env(name: str) -> str: """Return a required environment variable or raise a clear runtime error.""" value = os.getenv(name) if value: return value raise RuntimeError( f"Environment variable '{name}' is not set...
d90b9cd262667b5ccec07bd865a689552eb9c7eae125584a7506949baebd76bb
Python
463
7
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['mobilevit_small'] = lambda: ModelCommitment(identifier='mobilevit_small', ac...
ebd841d5e2dfd767de5c82504ee26c8a329eb68c9bd73c23d802cb2718834b4b
Python
463
12
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['evresnet_50_5'] = lambda: ModelCommitment( identifier='evresnet_50_5', activations_model=get_model('evresnet_50_5'), layers=...
0967bc8340051def1baca3dbecaef0aef015d65861662a951f2147c2d7b354f8
Python
464
18
subjects = ["aster", "delta"] rois = ["centromedial", "basolateral", "hippocampus"] region_names = dict(centromedial="CMA", basolateral="BLA", hippocampus="HIPP") stimuli = ["hierarchy", "object", "blank"] stimulus_names = dict( hierarchy="monkey videos", object="object videos", blank="blank screen" ) color_dict...
50efd962cf7139e129c17b17cc8b6ab3ed924ec6e5be9ceae081a1156626e952
Python
464
18
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import json import os SEND_WEBHOOK_TASK_RETRIES: list[int] = json.loads( os.getenv( "CVAT_SEND_WEBHOOK_TASK_RETRIES", "[5, 300, 1800, 10800, 86400, 86400, 86400, 86400]", ) ) """ Per-attempt delay (seconds) between broker-lev...
57817b3a8a139110e56eb8d8ffe5f5f7410709703feabbd17dfeb6d2d2fa729d
Python
464
19
import torch from enformer_pytorch import from_pretrained enformer = from_pretrained('EleutherAI/enformer-official-rough', use_tf_gamma = False).cuda() enformer.eval() data = torch.load('./data/test-sample.pt') seq, target = data['sequence'].cuda(), data['target'].cuda() with torch.no_grad(): corr_coef = enforme...
68e6a1c914626686bc927300bea2f07fc78a6986f4f3ebe25d4791dceb1fbcfa
Python
464
21
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import cvat_sdk.auto_annotation as cvataa import cvat_sdk.models as models import PIL.Image spec = cvataa.DetectionFunctionSpec( labels=[ cvataa.label_spec("car", 0), ], ) def detect( context: cvataa.DetectionFunctionContext, i...
1a420edfc43f0867b20f7e4d151fe8f61ae6730e1c08903d85985cf0b57dd773
Python
465
9
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_cutmix_augmix_sam_e1_5avg_424x377'] = lambda: ModelCommitment( identifier='effnetb1_cutmix_augmix_sam_e1_5avg_424x377', ...
5ff99609fcabaedc2102bdd6e47c9d6671eec7a5a10b9e28809b7f40251ae406
Python
465
23
#!/usr/bin/env python3 # coding: utf-8 import json import nrn_validation as V V.override_defaults_from_args() # dendrite geometry: 200 µm long, 1 µm diameter. geom = [(0, 1), (200, 1)] model = V.VModel() model.add_soma(12.6157) model.add_dendrite("dend", geom) model.add_exp_syn("dend") model.add_spike(10, 0.04) mo...
a9442b0d44a65df0750f09152bf90773e3de06f5b179f234eb66c138dd3c66db
Python
465
19
""" Config file to set default dirs """ # import configparser # from pathlib import Path # # CONFIG_FILENAME = "napari_dmc_brainmap.conf" # CONFIG_PATH = Path(resource_filename("napari_dmc_brainmap", CONFIG_FILENAME)) # # # 2 level dictionary for sections and values: # DEFAULT_PATH = Path.home() / ".napari_dmc_brainm...
d65744bd4fe205ed448641928221fb939692e48b3e05d3ea7e8e91d974790001
Python
465
14
import os data_dir = "Y:/data/" if not os.path.exists(data_dir): data_dir = "/cifs/diedrichsen/data/" if not os.path.exists(data_dir): data_dir = "/Volumes/diedrichsen_data$/data" save_dir = 'C:/Users/barafat/Diedrichsenlab Dropbox/Lab Manager/Papers/MultiTaskBattery_paper/Figures' if not os.path.exists(save_...
e5a01447db79523624dc25294e52ceee7ad748d6f0dbea75b14a506182a20a29
Python
465
7
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['alexnet_random'] = lambda: ModelCommitment(identifier='alexnet_random', ac...
03dce58d18a3d542a2e707d2f6c02f6d20c07695cb1ffb750749f32d04d69cdb
Python
466
21
# -*- coding: utf-8 -*- """ Created on Mon Dec 3 15:32:19 2018 @author: kblackw1 """ import numpy as np from matplotlib import pyplot as plt plt.ion() f = plt.figure() ax = f.gca() mouse='Mouse2' middles=np.loadtxt(mouse+'_bins.txt') f.suptitle(mouse) for condition in ['saline','ethanol']: fname=...
2062bcbc8f31195259a8936bb65b7b9ae7f69a5eacaf716ab82a4598fa73eb25
Python
466
18
#!/usr/bin/env python """ Mosaic tests. """ from storm_control.test.hal.standardHalTest import halTest def test_hal_gms_1(): halTest(config_xml = "none_tcp_config.xml", class_name = "GetMosaicSettings1", test_module = "storm_control.test.hal.tcp_tests") def test_hal_gms_2(): halTest...
537f2794ac8300984b5a8d9a79575091bbc1284ff7e196a4292215013b797f6c
Python
466
16
from bread.data import Segmentation import numpy as np import itertools __all__ = ['assignment_from_segmentation'] def assignment_from_segmentation(seg: Segmentation, idt1: int, idt2: int): cellids1 = seg.cell_ids(idt1) cellids2 = seg.cell_ids(idt2) ass = np.empty((len(cellids1), len(cellids2)), dtype=int) fo...
5e6542dd7cbff8a50bb3dc3a49e566cd3511c5c32b1f6c30194d321ff97346ed
Python
466
17
"""Define different loss classes for image, label and regularization.""" # flake8: noqa from deepreg.loss.deform import BendingEnergy, GradientNorm from deepreg.loss.image import ( GlobalMutualInformation, GlobalMutualInformationLoss, LocalNormalizedCrossCorrelation, LocalNormalizedCrossCorrelationLoss,...
d5dc6ef7bfeb8e88887752053a9a7accb71550601dd73c62340bb975d2a21908
Python
466
10
import setuptools setuptools.setup( name="Spa3D", version="Spa3D-1.0", author="Chen Tang", author_email="Chen.Tang@UTSouthwestern.edu", description="Spa3D is an algorithm that utilizes spatial pattern enhancement and graph convolutional neural network model to reconstruct 3D-based spatial structur...
9eb21aa9fefbe13dd59f031e4da80ccf62d22e4640dd22f9bd55d5cc494cbf1b
Python
467
23
#!/usr/bin/env python3 # coding: utf-8 import json import nrn_validation as V V.override_defaults_from_args() # dendrite geometry: 200 µm long, 1 µm diameter. geom = [(0, 1), (200, 1)] model = V.VModel() model.add_soma(12.6157) model.add_dendrite("dend", geom) model.add_exp2_syn("dend") model.add_spike(10, 0.04) m...
a1d64ca50e9f54215cd87e7a47ab94373fd8b7eec396bd00ac8a736d950f4184
Python
467
17
from setuptools import setup, find_packages REQUIRED = [ 'scanpy[leiden]>=1.9.1, <=1.9.3', 'numpy>=1.22.4, <=1.24.4', 'pandas>=1.5.3, <=1.5.3', 'numba>=0.56.4, <=0.56.4', 'harmonypy>=0.0.9, <=0.0.9', ] setup(name='CAMEX', author='Zhen-Hao Guo', author_email='guozhenhao@tongji.edu.cn', ...
7a9feb5de58022130dce7593005c43d5b3268b355d3ec9fe119355e48cde72cd
Python
469
7
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['briaai_rmbg_1_4'] = lambda: ModelCommitment(identifier='briaai_rmbg_1_4', ...
8b42e6835490929eb5ae640105013a7131dba7f4a4ad8c28f1894b62028c87a3
Python
469
14
"""Base structures for representing data transformation steps of Models. Layer : Top-level component. Implements an `evaluate` method, which carries out the transformation. Phi : Stores and manages fittable parameters for the transformation. Parameter : Low-level representation of individual para...
4a2e0f0902d1cc7eb3501742637aeac36be6e8341ebce1ce803e27895251993f
Python
470
12
import fasttext import fasttext.util as ft_util data_path = 'D:\Projects\Context Dependent Learning\datafile' # ft_util.download_model('en', if_exists='ignore', datapath=datapath) def word2vec(name_list, dimension, datapath=data_path): ft = fasttext.load_model(datapath +'\cc.en.300.bin') ft_util.reduce_...
57af7325b30d2403af884a220a1074ffda6376d2e3a9c4cfd1b158cbe349a05f
Python
470
17
"""Get example data. """ import os def get_data(name, output_dir): if os.path.exists(output_dir): print(f"{output_dir} already downloaded. Skipping..") return os.system(f"osf -p by2tc fetch data/{name}.zip") os.system(f"unzip -o {name}.zip -d {output_dir}") os.remove(f"{name}.zip") ...
c5b650158a552ee10dc5eac17e9992068c8773bf70cfd0a34c210acdb02c1d60
Python
470
16
""" Primary symbols include classes and functions for visualization, configuration, timing and generally useful utilities. """ from . import models from . import ops from . import util from . import visualization as vis from . import data from . import mpi from . import callbacks from . import optim from .data import t...
7e08a96f416d0aef451ae9af11546b793d99fb24b20a2fce5e7e24b1e582086e
Python
471
14
def register_external(name, func): """ Enables EIANN to look up external custom user functions by str name. :param name: str :param func: callable """ if not isinstance(name, str) and callable(func): raise Exception('register_external: requires str name of function and imported callable;...
4ac34d028612675016ffb4aa70747fb715ae31c927b72a193a02452c46af56dc
Python
473
15
"""Test QtMultimediaWidgets.""" from qtpy import PYQT5, PYSIDE2 def test_qtmultimediawidgets(): """Test the qtpy.QtMultimediaWidgets namespace""" from qtpy import QtMultimediaWidgets if PYQT5 or PYSIDE2: assert QtMultimediaWidgets.QCameraViewfinder is not None # assert QtMultimediaWidge...