sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
3003aade817a14a9e8a61887a6a18e3c65abf3055170baa8390e2619ab971f02
Python
620
21
import nibabel as nb import numpy as np dataFile = '/home/sebastian/Desktop/testRelativeResolution/patchFlatten/sub-06_ses-001_task-stim_run-001_T1w.nii' dataArr = nb.load(dataFile).get_fdata() dataArr.shape dataArrFlat = dataArr.flatten() dataArrFlat.size newArr = np.arange(dataArrFlat.size) dataArrFlat.size newArr...
7a90e7b02887f64c7e88fc6ae5678e290fb93ffe7c8be18ca12cb125c4e7dcb0
Python
620
24
from pathlib import Path from setuptools import setup, find_packages with open('README.md') as f: readme = f.read() with open('LICENSE') as f: license = f.read() setup( name='basenji', version='0.1', description='Sequential regulatory activity machine learning', long_description=readme, autho...
d5ff366f3ad7e350e0b97a4e4bb6da9a3933203f2254f0c358585a8102fa8765
Python
620
33
from .aqm import ( AQMgasDataset, AQMsolDataset, ) from .qm7x import QM7XDataset from .materialscloud import ( AgClusterDataset, AuMgODataset, CarbonChainDataset, NaClDataset, ) from .md22 import DHADataset from .water import MBPolDataset from .dimers import DimersDataset from .efa import ( ...
1b603621059a8cecd83ef38c986d7532da94c4885f28aaff28e298d43662ad39
Python
621
21
from rdkit import Chem def make_mol(s: str, keep_h: bool): """ Builds an RDKit molecule from a SMILES string. :param s: SMILES string. :param keep_h: Boolean whether to keep hydrogens in the input smiles. This does not add hydrogens, it only keeps them if they are specified. :return: RDKit molecu...
33447df3b8ac42da1f3a6b0f3b08b64223184310c92eae6bba2ac20f5e67858f
Python
621
27
import os import logging from threading import Thread __version__ = '1.3.1' try: os.environ['OUTDATED_IGNORE'] = '1' from outdated import check_outdated # noqa except ImportError: check_outdated = None def check(): try: is_outdated, latest = check_outdated('ogb', __version__) if is_...
923b3d353ea446ef135624c4297268e74d7daa139da2f7f0173e61245ca48e33
Python
621
21
import numpy as np def gen_sample(hist, bins, scale='linear'): random_sample = np.empty([0,1]) if scale == 'log2': bins = np.log2(bins) if scale == 'log10': bins = np.log10(bins) for b_ind, b in enumerate(bins[:-1]): random_sample = np.concatenate((random_sample, (np.random....
2bc8e44c5fb56968e121c642e3a3c09559a2c6cb3c5dc3801c2e2852bf9fd503
Python
622
17
import pytest from qtpy import PYSIDE2 from tests.utils import pytest_importorskip @pytest.mark.skipif(PYSIDE2, reason="Not available for PySide2") def test_qtnetworkauth(): """Test the qtpy.QtNetworkAuth namespace""" QtNetworkAuth = pytest_importorskip("qtpy.QtNetworkAuth") assert QtNetworkAuth.QAbstra...
1ee5d42c77e53b38c60f165509eef1b7735e355ee24386d034be518d975e044a
Python
623
20
# ----------------------------------------------------------------------------- # Copyright © 2020 Marcin Stano # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- ...
2ed75abe5ce04e937c5b8f7c417d270966aaa84e3e8fc4af645c188598b9cff9
Python
625
14
from brainscore_vision import metric_registry from .metric import BootstrapDistributionSimilarity, NeuronalPropertyCeiling metric_registry['ks_similarity'] = BootstrapDistributionSimilarity metric_registry['property_ceiling'] = NeuronalPropertyCeiling BIBTEX = """@article{marques2021multi, title={Multi-scale hierar...
4098276ad03021a4151cb690cd9d8e51e0f996f59bec1c95d424eda968ce9462
Python
625
19
# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtMultimediaWidgets...
42102fe125742e27200a0fdf4d2fa93bcf182473ff80f8621d7f91a599078926
Python
625
21
import torch import random import numpy as np def set_seed(seed, device_id='cuda:0'): # Set seed for Python's built-in random library random.seed(seed) # Set seed for numpy np.random.seed(seed) # Set seed for PyTorch CPU torch.manual_seed(seed) if torch.cuda.is_available(): # Set ...
aeefed587019317aa9df6272b24f3aee377aa16e047679c976d73ac16c800ab5
Python
625
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...
2f20699e89d1a1e4926dc83300de8a611beffef0766b706991c955e6a23acb3a
Python
626
23
# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtConcurrent classe...
401266e9cb1eec96b7e68a88fe31fa0e6028de2781928c3f4af1e6adb02fa0b1
Python
626
26
import json import numpy as np def save_to_json(obj, file): with open(file, "w") as f: jso = json.dumps(obj, cls=NpEncoder) f.write(jso) def read_json(file): with open(file, 'r') as load_f: load_dict = json.load(load_f) return load_dict class NpEncoder(json.JSONEncoder): de...
6346ee1d3392e906c610ec6c1bd9b53d1fa6c0027df112e3e5d4806717070ad2
Python
626
40
import numpy as np from impedancefitter.single_shell import single_shell_model omega = 2. * np.pi * np.logspace(0, 12, num=30) # for single_shell_model c0 = 1. em = 10. km = 1e-6 kcp = 0.5 ecp = 60 kmed = .1 emed = 80 p = 0.1 dm = 5e-9 Rc = 5e-6 # for double shell Rn = 1.0 ene = 1.0 kne = 0.0 knp = 0.0 enp = 0...
69db6708973ca3d44c9adb8da5d96303871806fe33b0614953695e3471747bc2
Python
626
18
from argclz.commands import parse_command_args from .main_active_place_cell import ActivePCOptions from .main_cls_summary import ClsCellTypeOptions from .main_motion_drift import MotionDriftOptions from .main_neuropil_error import NeuropilErrOptions from .main_trial_reliability import TrialReliabilityOptions parse_com...
904070c9880953040f86cc20fea5fa6b4825d6e42f9f95b155c3f164fa695281
Python
626
22
import torch import random import numpy as np def set_seed(seed, device_id='cuda:0'): # Set seed for Python's built-in random library random.seed(seed) # Set seed for numpy np.random.seed(seed) # Set seed for PyTorch CPU torch.manual_seed(seed) if torch.cuda.is_available(): # Set ...
e6bec8814a533679954c0f13000b975f845d630cb62fbd6baaf3a3923d911ed1
Python
626
20
import platform import sys def ensure_supported_platform( sys_platform: str | None = None, machine: str | None = None, ) -> None: """Reject Intel macOS with a clear message during plugin discovery.""" current_platform = sys.platform if sys_platform is None else sys_platform current_machine = platf...
a909304f9940eb3e67ae16a60df694282ea44f7ad9141a12dd8cde4bdf33a86e
Python
627
22
#%% from MixerUnetcopy import Rep_UNET_down, reparameterize_model import torch path = "/data1/home/ict08/skinseg/model_weights/segpc/repunet100/repunet100.ckpt" save_path = "/data1/home/ict08/skinseg/rep_weights/segpc/repunet.ckpt" a = torch.load(path) class TPModel(torch.nn.Module): def __init__(self): s...
09859635fe0cf8014bb6afb7f20481815c5e7b36ca9d3554ca5ced696d5224e3
Python
628
31
# -*- coding: utf-8 -*- """TODO""" import numpy as np from core.core_definitions import simulation_timestep from core.trace import Trace class EulerTrace(Trace): """TODO""" def __init__(self, size, tau): """TODO""" super().__init__(size) self.tau = tau self.calculate_scale...
41ed984bd880a213f5ae658ccccec3104e5f899b93b44164cde0f4a13ab523e1
Python
628
20
#!/usr/bin/env python3 # Copyright (C) 2018-2022 Intel Corporation # # SPDX-License-Identifier: MIT import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cvat.settings.development") try: from django.core.management import execute_from_command_line except...
9310ebc4d117a8c9439edc1286929d125c5e01f9bc6743a07a0872ec6107e988
Python
628
18
import math import copy import numpy as np import matplotlib import matplotlib.pyplot as plt def jackknife_est_error(model_list, samples): '''Returns plotted data from mean standard error of coefficients for each model with error bars''' c = np.concatenate([model.layers[0].coefficients for model in mo...
a42ac61c0c041d75cab746f039018923f502f21ded41aeb666faa435f53292d9
Python
629
17
TAGGED_ENTITY = ''' <mark class="entity" style="background: {color}; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 3; border-radius: 0.35em; box-decoration-break: clone; -webkit-box-decoration-break: clone"> {entity} <span style="font-size: 0.8em; font-weight: bold; line-height: 3; border-radius: 0.35em...
b2c5d9853c2efbe486ffc0c8c6b473c06fc2ed4eaf557f0c9c38bdb029b3b488
Python
629
25
# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtNfc classes and f...
b37b092346c0cef6bf32b789e0d71252486dce19fee06ea29d08328139b087fb
Python
629
19
#!/usr/bin/env python # coding: utf-8 # Collapse barcode count by sample and known barcode import sys import pandas as pd def count_barcodes(outdir, chunk_files): if len(chunk_files) == 1: df = pd.read_csv(chunk_files[0]) else: df = pd.concat((pd.read_csv(x) for x in chunk_files), ignore_...
b61948fb571b61e5ec84a5653129566fc4916b2d868fa66bd98839968645069f
Python
629
24
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from django.apps import AppConfig class WebhooksConfig(AppConfig): name = "cvat.apps.webhooks" def ready(self): from django.conf import settings from . import default_settings for key in dir(default_settings): ...
e98c6953c7c17658de83a8c917e9bd2a201c0ffe9da59074fbfa701e94826e85
Python
629
22
from .data import data_matrix, design_matrix, heatmap, triangle_overlay from .factor_embedding import factor_density, factor_embedding, factor_strip from .loadings_heatmap import loadings_heatmap from .loadings_scatter import loadings_scatter from .loadings_state import loading_rank_diff, loadings_state from .qc import...
02b02194e26aa13827be747ac1638616e85ebf0d18cd3df60eb2aa81152b237e
Python
630
21
import torch import numpy as np import pandas as pd from tqdm import tqdm import ijson import json f1=open("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/tweet_1.json",'rb') f2=open("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/tweet_1.json",'rb') out_file=open("/data2/whr/czl/TwiBot22-baselines/src/twi...
1eea191246eeb208eb6628568a2f3ca77d04c06c4e9d2c41022abe140ac55894
Python
630
21
import torch import numpy as np import pandas as pd from tqdm import tqdm import ijson import json f1=open("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/tweet_5.json",'rb') f2=open("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/tweet_5.json",'rb') out_file=open("/data2/whr/czl/TwiBot22-baselines/src/twi...
45e6fe7209dae4c0f2acff22cca83a083f0cbeab1d54c046b43e7349cd96d8b8
Python
630
21
import torch import numpy as np import pandas as pd from tqdm import tqdm import ijson import json f1=open("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/tweet_7.json",'rb') f2=open("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/tweet_7.json",'rb') out_file=open("/data2/whr/czl/TwiBot22-baselines/src/twi...
540f6872392868d138c5634e8e74654077d7d42c81650c7f1dce9c529ccd73ba
Python
630
21
import torch import numpy as np import pandas as pd from tqdm import tqdm import ijson import json f1=open("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/tweet_6.json",'rb') f2=open("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/tweet_6.json",'rb') out_file=open("/data2/whr/czl/TwiBot22-baselines/src/twi...
a2577c71a862a2dd858444577bb0904753a35be378b9fceccd01b83697362973
Python
630
23
# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtAxContainer class...
b075aa3805e44e5ddbb93f00e6c5fcfe6e8e36a74d197eb9c38f48d62e791079
Python
630
21
import torch import numpy as np import pandas as pd from tqdm import tqdm import ijson import json f1=open("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/tweet_0.json",'rb') f2=open("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/tweet_0.json",'rb') out_file=open("/data2/whr/czl/TwiBot22-baselines/src/twi...
b0a89d048673f3188eca7129064d74be19a8d0831b775045f532ff76f181240e
Python
630
21
import torch import numpy as np import pandas as pd from tqdm import tqdm import ijson import json f1=open("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/tweet_3.json",'rb') f2=open("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/tweet_3.json",'rb') out_file=open("/data2/whr/czl/TwiBot22-baselines/src/twi...
b9d80abdb94642e6603032ff40e434700913c380e07ccee453ad01693cf04b48
Python
630
21
import torch import numpy as np import pandas as pd from tqdm import tqdm import ijson import json f1=open("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/tweet_4.json",'rb') f2=open("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/tweet_4.json",'rb') out_file=open("/data2/whr/czl/TwiBot22-baselines/src/twi...
bbc9206b0a128652e826dc2300561b4b8904ea1d607312bf16cc716af4cf8cf6
Python
630
22
import numpy as np import json import pandas as pd import csv import sys sys.path.append('..') from utils.dataset import merge_and_split, simple_vectorize def preprocess_dataset(dataset, server_id="209"): train, valid, test = merge_and_split(dataset=dataset, server_id=server_id) train_data, train_label...
e525e7aed54ef4ed3da9269537cd78e8768735b90836f7f8f8a8bdff00eb98cf
Python
630
25
#!/usr/bin/env python """ Translate lists of space separated integers (magnitude less than 62) and print as strings of alphanumeric characters. This is useful mainly for some machine learning algorithms that only take string input. usage: %prog < int_seqs > strings """ import sys table = "012345678ABCDEFGHIJKLMNOPQ...
fe1a17fe6f26d507ef5a6cfff41647f0fdfcf6566990a3be1a0bea844131b5e1
Python
630
21
import torch import numpy as np import pandas as pd from tqdm import tqdm import ijson import json f1=open("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/tweet_2.json",'rb') f2=open("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/tweet_2.json",'rb') out_file=open("/data2/whr/czl/TwiBot22-baselines/src/twi...
ff9e315ad33270b70b3fccc7abc302880b8ae8d4b0f64e6d100563f9d97ef0e5
Python
630
21
import torch import numpy as np import pandas as pd from tqdm import tqdm import ijson import json f1=open("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/tweet_8.json",'rb') f2=open("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/tweet_8.json",'rb') out_file=open("/data2/whr/czl/TwiBot22-baselines/src/twi...
5e63f57ca615d189a95938fea738cff502c108c03ce212bd769460b926f38f3c
Python
633
24
from collections.abc import Sequence from eir.models.input.tabular.tabular import ( SimpleTabularModel, SimpleTabularModelConfig, ) def get_tabular_model( model_init_config: SimpleTabularModelConfig, cat_columns: Sequence[str], con_columns: Sequence[str], device: str, unique_label_values:...
732fd8788aaa13179a094805770f952210f104bd77eab0e9ee4b4d4787249709
Python
633
22
import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif(PYSIDE2 or PYQT5, reason="Not available in PySide2/PyQt5") def test_qtopenglwidgets(): """Test the qtpy.QtOpenGLWidgets namespace""" from qtpy import QtOpenGLWidgets assert QtOpenGLWidgets.QOpenGLWidget is not None @pytest.mark.skipif(P...
e1f86c7038dd7631f23572eb2f18b4bceffb508e79ed8f2d5c8d43768e6bcb15
Python
633
27
import unittest import arbor from . import fixtures _mpi_enabled = arbor.__config__ @fixtures.context() def skipIfNotDistributed(context): skipSingleNode = unittest.skipIf( context.ranks < 2, "Skipping distributed test on single node." ) skipNotEnabled = unittest.skipIf( not _mpi_enabled,...
21aa63e7552e910b603d0b263e25f6102eccc8488297ec7d8787f4fe603d0db9
Python
634
20
import datetime def time_to_str(timestamp: int) -> str: """ Convert seconds past Epoch to human readable string. """ datetimestamp = datetime.datetime.fromtimestamp(timestamp) return '{:04d}-{:02d}-{:02d}-{:02d}-{:02d}-{:02d}'.format( datetimestamp.year, datetimestamp.month, datetimest...
877ee02badb289f69948a94ff0e4d63fb3ab7f99935dacd798a80acf2364dd6c
Python
634
24
import torch.nn as nn from ..ops.normalization import pixel_norm __all__ = ['PixelNorm'] class PixelNorm(nn.Module): def __init__(self, dim=1, eps=1e-8): """Pixel normalization. References: - https://papers.nips.cc/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf ("Local Re...
909fda1d615bb235186e54771ae6e2a12f7dd94108a9a119e43913bff76729b8
Python
634
25
import pandas as pd label = pd.read_csv('/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-20/label.csv') user = pd.read_csv('./user_feature.csv') user_list = list(user['id']) del_list = [] bool_label = [] for i,r in label.iterrows(): if r[1] == 'human': bool_label.append(1) else: bool_label...
24cfb7995c189e28cc03e9f35aabd1f4292888b61558a481bb26b15c38a6bf91
Python
635
24
# Copyright (C) 2021-2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from django.contrib.auth.models import AbstractUser from django.db import models class UserCreationMethod(models.TextChoices): """How the account's credentials were first established.""" REGISTRA...
2f0cc9b03e3f62d43538bf0b4d96e3bd42126d582682518fc322606dce20bb2f
Python
635
25
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup, find_packages requirements = [ "torchvision", "torch" ] setup( packages=find_packages(exclude=['tests']), include_package_data=True, install_requires=requirements, license="MIT license", zip_safe=False, ...
465eb8c480836757ee22ed6ba5c8c39e198d12f9323dfe5b2054c120ad0ec864
Python
635
23
def _get_version(): """Get version from package metadata (generated from pyproject.toml during installation).""" try: from importlib.metadata import PackageNotFoundError, version return version('pyment') except PackageNotFoundError: import os import tomllib pyp...
bfead92b856912c055305be0b3ad9823fa7852d20b2d2f2af7ef473cc6dd5d18
Python
635
22
"""Test the deferred import error mechanism""" # See https://github.com/spyder-ide/qtpy/pull/387/ import pytest from qtpy import QtModuleNotInstalledError def test_missing_optional_deps(): """Test importing a module that uses the deferred import error mechanism""" from . import optional_deps assert ...
69cc2da2ece892f97ab2c6e458af4a6feb0589d083608c9f6059cebdc612e80e
Python
636
25
import pandas as pd label = pd.read_csv('/data2/whr/czl/TwiBot22-baselines/datasets/cresci-2017/label.csv') user = pd.read_csv('./user_feature.csv') user_list = list(user['id']) del_list = [] bool_label = [] for i,r in label.iterrows(): if r[1] == 'human': bool_label.append(1) else: bool_lab...
92a5d756af7750428847bb65ab75be5f6a354881d5175385786db8ccf20285d4
Python
636
25
import pandas as pd import numpy as np import seisbench.data as sbd def test_spectrum_dataset(data_dir): data = sbd.SpectrumDataset( data_dir / "esm_spectrum_example/", component_order=( "acc_mp_u", "acc_mp_v", "acc_mp_w", "dis_mp_u", "d...
d5ab0caf7c78d46ad279de570853577cca0585a42a1bf93d6ad2f71573beb8f1
Python
636
25
import pandas as pd label = pd.read_csv('/data2/whr/czl/TwiBot22-baselines/datasets/cresci-2015/label.csv') user = pd.read_csv('./user_feature.csv') user_list = list(user['id']) del_list = [] bool_label = [] for i,r in label.iterrows(): if r[1] == 'human': bool_label.append(1) else: bool_lab...
280f16d66afae72e1edf6c8d5e1f82e5c895b6253bfc7ae9defea7a5a3ed22d3
Python
637
27
from abc import ABCMeta class Loop(metaclass=ABCMeta): """Abstract base class that represents a loop. Could be spatial or temporal loop. """ def __init__(self, dimension, size) -> None: """Initialize this Loop object. Args: dimension (str): The dimension, e.g. "K" ...
ffe908b9aaa5590455f3ecd786d60aee7c26693bfff4e47c1fd7fe0a4ddfa59b
Python
637
31
# -*- coding: utf-8 -*- """TODO""" import numpy as np from core.core_definitions import simulation_timestep from core.trace_2d import Trace2D class EulerTrace2D(Trace2D): """TODO""" def __init__(self, size, tau): """TODO""" super().__init__(size) self.tau = tau self.calcul...
93fc98204849d2d54de533bdc93ccff4da1c69e3881a43fe2486241e07ba6bbe
Python
638
20
import os import random as rn import numpy as np import tensorflow as tf def enforce_reproducibility(seed=2023): # Check PYTHONHASHSEED current_seed = os.environ.get("PYTHONHASHSEED") if current_seed != "0": raise EnvironmentError( "PYTHONHASHSEED must be set to '0' for full reproducibi...
a153629cbcd56f586cb1ab57ba5e64643f90dc76d736239ee91f232c0bdd4cc8
Python
638
24
# Generated by Django 4.2.13 on 2024-07-12 19:01 import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("engine", "0079_alter_labeledimageattributeval_image_and_more"), ] operations = [ migrations.AlterField( ...
fb3d6bc943cf2b6225ff4e8d06abea3bfd8e7f53fb3d6f72a8444e5ed71fdc6b
Python
638
23
import sys import pytest from qtpy import PYQT6, PYSIDE6 from tests.utils import pytest_importorskip, using_conda @pytest.mark.skipif( PYQT6 or PYSIDE6, reason="Not available on Qt6-based bindings", ) @pytest.mark.skipif( sys.platform != "darwin" or using_conda(), reason="Only available in Qt5 bindi...
01557f70cf06509c8ce25772ac2cd611b718829dd427e43a51a94cb036ce8f81
Python
639
19
"""The only production construction site for the Codex client. Codex keeps its own loader (``load_codex_model``) with its subscription authentication. This builder is the sole call site: the endpoint packs the loader's arguments into ``client_kwargs`` and hands them here. """ from __future__ import annotations from ...
30751cf129d41fe774e7004413b770a8fe7386bf46a7e5acd9967da130a6f51c
Python
639
23
#!/usr/bin/env python # author: Jannes Spangenberg # e-mail: jannes.spangenberg@uni-jena.de # github: https://github.com/JannesSP # website: https://jannessp.github.io from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace from python.segmentation.FileIO import plotParameters def parse() -> Nam...
32582d29d7cf7ebd0106795e5837b48e8e1e3c929877f39cdba7ca11196f7574
Python
639
21
import numpy as np from brainways.pipeline.tps import TPSTransformParams from brainways.project.info_classes import BrainwaysParams from brainways.ui.controllers.cell_3d_viewer_controller import Cell3DViewerController def test_enabled_false_by_default(): params = BrainwaysParams() enabled = Cell3DViewerContr...
c14f6909dc7160166d73832f10d496b9fb346b399109c3959cdf42f594f45124
Python
640
33
#!/usr/bin/env python3 # coding: utf-8 import json import math import nrn_validation as V V.override_defaults_from_args() # dendrite geometry: 100 µm long, varying diameter. length = 100.0 npoints = 200 def radius(x): return math.exp(-x) * (math.sin(40 * x) * 0.05 + 0.1) + 0.1 xs = [float(i) / (npoints - 1)...
ecbce1f03fa275cb361c90454e2508cfc218e0aa037a674379730c5838380b1a
Python
640
17
import SimpleITK as sitk import numpy as np import dask_image.imread import skimage.io as skio def convert_16_to_8(image_path, save_path): im_arr_16 = dask_image.imread.imread(image_path) im_sitk= sitk.GetImageFromArray(im_arr_16) im_sitk_8 = sitk.Cast(sitk.RescaleIntensity(im_sitk), sitk.sitkUInt8) im...
c3875d82aa1cc0380f1077de4711a8f3cc34c87eabf7417b134d0f441b051e67
Python
641
18
import OptimalBattery.simulate as sim import os # Make a random task battery with 100 task D = sim.sim_connectivity(num_task_lib = 100, n_parcels = 5, n_voxels_y = 100, n_sim = 100, battery_sizes = [3,4,5,6,7,8,9,10,11,12,13,14,15,16]...
3ceaa6944e08b174317c49620c8e32b7ab61c2df9d557c76d3f50b943a90c19c
Python
642
20
import importlib def create_instance(class_path: str, *args, **kwargs): """ Dynamically creates an instance of a class given its full path. Args: class_path (str): The full path to the class, e.g., 'module.submodule.ClassName'. *args: Positional arguments to pass to the class constructor....
667bb04449f950aa396c9acbeef8fd0622cde9a8b9d3c1507cd8a00066c864aa
Python
642
23
import logging from importlib.metadata import PackageNotFoundError, version from osl_dynamics.config_api.pipeline import run_pipeline from osl_dynamics import meeg # Setup the version try: __version__ = version("osl-dynamics") except PackageNotFoundError: __version__ = "unknown" finally: del version, Pack...
8540f58c79d1abb6db189b9a27af3746f6cf6ed3d61ff5ade08c5efc679d5b1b
Python
642
13
# Copyright (c) 2026 Rohit Jena. All rights reserved. # # This file is part of FireANTs, distributed under the terms of # the FireANTs License version 1.0. A copy of the license can be found # in the LICENSE file at the root of this repository. # # IMPORTANT: This code is part of FireANTs and its use, reproduction, or...
e31288137be70d99ddafa5caf06beba4e4fe98e5fa6e4a3d294fc3b1fce7c439
Python
642
34
#!/usr/bin/env python """ Read a PAIRWISE maf from stdin and print the fraction of columns whose bases match for each alignment. TODO: generalize for more than two speceis. usage: %prog < maf > out """ import sys from bx.align import maf def __main__(): maf_reader = maf.Reader(sys.stdin) for m in maf_re...
fbbcaf7596e26ebc7dc09acbb04cb2df90fb638e9866997ac24dc4d8d90f12cd
Python
642
23
# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtQuickControls2 cl...
f086038cd01178d358fb81e16dde0afb3fec1d533ac5f4fc8a9f92ee335e788c
Python
643
26
import os from pathlib import Path base = Path("/data2/whr/czl/TwiBot22-baselines/src") datasets = os.listdir(base) def has_markdown_file(files): for file in files: if file.endswith(".md"): return True return False excluded = ["utils", "simple_GNN", "simple_NN", "simple_svm", "template_m...
c47d5fae325146511db41c49b1e6c8609d451ead61379ddb3252fffbe1da61f1
Python
644
21
""" This module is an example of a barebones sample data provider for napari. It implements the "sample data" specification. see: https://napari.org/stable/plugins/guides.html?#sample-data Replace code below according to your needs. """ from __future__ import annotations import numpy def make_sample_data(): ""...
d221e30959a982b7568890ddbadc470a149025f0e59f29a20ac21267d66dd9ca
Python
644
15
# Copyright (c) 2026 Rohit Jena. All rights reserved. # # This file is part of FireANTs, distributed under the terms of # the FireANTs License version 1.0. A copy of the license can be found # in the LICENSE file at the root of this repository. # # IMPORTANT: This code is part of FireANTs and its use, reproduction, or...
fa07a043d92c1f9735ef8cf45e0135316de3d1e0c2e3f0e44592cacd83170024
Python
644
22
import subprocess import sys import yaml script = 'SOM/clusterSOM/plot_psth_and_zeta.py' scripts = [script]# pathpath = 'PATHS/filepaths_carlen.yml' with open(pathpath, 'r') as myfile: pathdict = yaml.safe_load(myfile) sys.path.append(pathdict['code']['workspace']) from pfcmap.python import settings as S setkeys = ...
01753ad49d30ec6a1c0c1a94c31265d3e886a82c5ea485ee042e34b5e094d0db
Python
645
22
""" Cumulate quantities, keep counts, and retrun averages """ from collections import defaultdict class Cumulator: """ Cumulate quantities, keep counts, and retrun averages """ def __init__(self): self.total = defaultdict(float) self.count = defaultdict(int) def update(self, new_da...
1adf23879c0b237362a6ad158b5d864309fcd2113c142a1fb69de4e12d40dbd1
Python
645
33
""" Module to train a bioFAM model """ import scipy as s import pandas as pd import numpy as np from mofapy2.core.BayesNet import BayesNet def train_model(model): # Sanity check on the Bayesian Network assert isinstance(model, BayesNet), "'bayesnet' has to be a BayesNet class" #################### ...
3d4e4efe7c04bcb1dbb26cd6d21ef6280273bb6c0c409549b5275c8bdc8309ee
Python
645
20
from pathlib import Path import fire from brainscore_vision import score as _score_function def score(model_identifier: str, benchmark_identifier: str, conda_active: bool=False): result = _score_function(model_identifier, benchmark_identifier, conda_active) print(result) # print instead of return because f...
8b0852b4c9388a90dba203bf8a34cafe9dac35eb485ec9dccf05ecb93570128f
Python
645
19
"""The only production construction site for the Groq client. Groq keeps its own loader (``load_groq_model``) with its API-key handling and retry-on-auth logic. This builder is the sole call site: the endpoint packs the loader's arguments into ``client_kwargs`` and hands them here. """ from __future__ import annotati...
cb20192cfe000382af3b75dbc9f33e2738d5678bd8afb12c02d56e6a5c28c565
Python
645
27
import torch from torch import Tensor import torch.nn as nn from typing import List, Union, Tuple class LSDModel(nn.Module): def __init__(self, backbone: nn.Module): """ A model for predicting LSD's or Affinites for segmentation. Applies a sigmoid after the output of the backbone! ...
5e23384851c8fc69f823d875c7072317cf556635ecb1847d446c0fbe6aa73638
Python
646
18
# Copyright 2024 Image Analysis Lab, German Center for Neurodegenerative Diseases (DZNE), Bonn # # 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...
96fd0f0e765602276aeed01504cf71c6b471f08866efbb5c2734fc61cec3d4c9
Python
646
17
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from django.db.models.signals import post_save from django.dispatch import receiver from cvat.apps.consensus.models import ConsensusSettings from cvat.apps.engine.models import Task @receiver(post_save, sender=Task) def __save_task__initialize_con...
c184ab474c448396b3a8a7bcb5dbb53d06a244060b6d1a8c85ffb9bfe21ec751
Python
646
29
# Generated by Django 4.2.26 on 2026-05-05 18:39 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("engine", "0100_alter_task_mode"), ] operations = [ migrations.AlterModelOptions( name="labeledimage", options={}, )...
8dbce9a86e2f3c3e004ba07f01111dbe523c6774b2ba3eba096fed5e1160a654
Python
647
26
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup, find_packages requirements = [ "torchvision", "torch", "gdown" ] setup( packages=find_packages(exclude=['tests']), include_package_data=True, install_requires=requirements, license="MIT license", zip_s...
04413f172e1c749ca39977d61f934f9b98837a3613f5dd00e0da725b6c824248
Python
648
24
import pytest import warnings from ase import Atoms # Configure pytest-asyncio #pytest_plugins = ("pytest_asyncio",) @pytest.fixture(autouse=True) def setup_test_env(): """Setup any test environment variables or configurations needed""" # Filter numpy deprecation warnings warnings.filterwarnings( ...
26690865aefa1f31ba9cec309cb9897b48f74ed4374be347720938a359627891
Python
648
22
"""A sub-package containing IO-related modules for storing intermediate results of operations performed by instances of :py:class:`~corelay.processor.base.Processor`. This can be used in a :py:class:`~corelay.pipeline.base.Pipeline` to prevent the re-computation of intermediate results needed multiple times, or as a ca...
43ba4522fcc8ca8c2dd07fd4cd6f3116bc5c31a8338b214193cbf5cf3d588dba
Python
648
14
class Test_RVC_Config: def test_config(self, demo_dir,dropConfig): assert dropConfig.RVC.getWorkdir() == demo_dir + "/Scripts/rnaVariantCalling/pipeline" dict_ = { 'groups': ['batch_0','batch_1'], 'highQualityVCFs': [f'{demo_dir}/Data/high_confidence_snps.vcf.gz', f'{demo_dir...
562d7a5f738cbb980a79869e9d1931927a77299c51250d4a0d8b7d4db3ced15a
Python
648
20
import ast import pytest import numpy as np import impyute as impy SHAPE = (5, 5) @pytest.mark.filterwarnings('ignore::FutureWarning') def test_output_file_exists(test_data, results_path): data = test_data(SHAPE) labels = np.array([1, 0, 1, 1, 0]) imputed_mode = [] imputed_mode.append(["mode", (impy....
8517023812f934c9e5deb799db77316cd95488d559b68b6ddd35782b6dc6cee4
Python
648
33
# Source: https://github.com/neuraloperator/neuraloperator/blob/main/neuralop/data/transforms/base_transforms.py from abc import abstractmethod import torch class Transform(torch.nn.Module): """ Applies transforms or inverse transforms to model inputs or outputs, respectively """ def __init__(se...
e21589c347b7f0bb0a5e2e2ba68d7802e4a06f51446151f05e608a4f17f230fb
Python
648
15
import warnings from .atlas_centric_preprocessor import AtlasCentricPreprocessor from .native_space_preprocessor import NativeSpacePreprocessor # Deprecation warning for Preprocessor alias, added to ensure backward compatibility. class Preprocessor(AtlasCentricPreprocessor): def __init__(self, *args, **kwargs): ...
3fe789330cfd9380a7311b73dc3bdd76179436b33093f22051d53e237562c950
Python
649
25
# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtQuick3D classes a...
820b0656d7e4a6ea40ef17abad65d4e26dea15dadc2157d04af0138e61139d9f
Python
649
29
import numpy as np from scipy.special import j1 def airy_disk(diff_lim): """ Creates a PSF defined by the Airy disc Parameters: diff_lim: the full width half-max (FWHM) of the PSF Returns: psf: a numpy array of size [N,N] with the PSF """ L1 = diff_lim*(0.61/0.5) u = in...
ff885b11424f47b633d635ef2c25b3e5a2f6ba2240df71a378407fc30297c027
Python
649
25
from abc import ABC from pathlib import Path from typing import Optional, Tuple from brainways.utils.image import Box, ImageSizeHW class ImageReader(ABC): def __init__(self, path: Path, scene: int): self.path = path self.scene = scene self.scene_bb: Optional[Box] = None def read_imag...
7f1e5df6e5510934dc4e522328c9e3526fd805f3a8ef3f6e5730a66334f48e2b
Python
651
32
#!/usr/bin/env python """ Read a file containing a 0 or 1 on each line (`feature_file`), output all lines from stdin for which that value was 1 TODO: no need to read the feature_file into memory here, just iterate in parallel. usage: %prog feature_file < ... """ import sys def __main__(): feature_file =...
87ca4a5580e207d1c4bc49fd784a04c8ba96bf9a0c7717c50554185e7775f85b
Python
651
17
from chemgraph.state.graspa_state import PlannerResponse def test_graspa_planner_response_accepts_bare_task_list(): payload = [{"task_index": 1, "prompt": "Run worker batch 1."}] parsed = PlannerResponse.model_validate(payload) assert parsed.next_step == "executor_subgraph" assert parsed.tasks[0].task...
e652259e3c3f38a94480d25bdfd0b93a89b720b949ccfdc115a8976fa85271bf
Python
651
19
"""The only production construction site for the Ollama client. Ollama keeps its own loader (``load_ollama_model``) with its curated-catalog validation. This builder is the sole call site: the endpoint packs the loader's arguments into ``client_kwargs`` and hands them here. """ from __future__ import annotations fro...
175e02e09bcbdb8a9d962c78f6bf38b47819f49cea404157d21953dd16c5c1b2
Python
652
18
from .eqtransformer import EQTransformer from .phasenet import PhaseNet def PickBlue(base: str = "phasenet", **kwargs): """ Initialize a PickBlue model. All `kwargs` are passed to `from_pretrained`. :param base: Base model to use. Currently, supports either `eqtransformer` or `phasenet`. """ if b...
b1d7cf3716ae8805c50abf73750f353d4878a7bfcfb4a01443565188bdcb3149
Python
652
19
import chromatics import io import pandas as pd import subprocess def samtools(arguments): cmdline = 'samtools {}'.format(arguments) p = subprocess.Popen(cmdline, shell = True, stdout = subprocess.PIPE) stdout, _ = p.communicate() return chromatics.read_bed(io.StringIO(stdout.decode('utf-8'))).set_inde...
4b2ee276ba885cf368247b022008379b5611aa523cbaf8c923dd2984216cdefa
Python
653
20
from argclz.commands import parse_command_args from .cache_ctype_cord import CellTypeCordCacheBuilder from .main_cls import ClsTopoOptions from .main_cords import RoiCordOptions from .main_fov import FOVOptions from .main_spatial_topo import SpatialTopoPlotOptions from .main_visual_topo import VisTopoPlotOptions parse...
025446e5272e9e369522d70d63fb5f9f46758d725e0740a5319e624db57775c2
Python
655
37
# imagecodecs/__init__.py from __future__ import annotations from .imagecodecs import ( # jpeg_check,; jpeg_version,; JpegError,; JPEG, NONE, NUMPY, DelayedImportError, NoneError, NumpyError, __all__, __dir__, __doc__, __getattr__, __version__, _codecs, _extensions, ...
0f7e903caf713fcae3bc62d61cf5c7ac346d2bb442ae10ef80445a872498a36a
Python
655
27
#!/usr/bin/env python """ Read TFLOC output from stdin and write out a summary in which the nth line contains the number of sites found in the nth alignment of the input. TODO: This is very special case, should it be here? """ import sys from collections import defaultdict counts: dict[int, int] = defaultdict(int) ...
1a6059529c889badcc8bcf9d2c8516ec0dff943e1880d090d70f8b48f0fe7da3
Python
655
21
from matplotlib import pyplot as plt untreated = [21, 3, 30, 25, 31, 13] treated = [2, 10, 1, 10, 17, 23] labels = ["Sparse", "Swollen","Tubular", "Mixed", "Bent Lamellar", "Orthogonal Lamellar"] untreated = [i/sum(untreated) for i in untreated] treated = [i/sum...
7011b1d2970b4200e395b2f7bc9f6074e982893acadf581b44df090285b634f3
Python
655
23
from pathlib import Path from typing import Union from brainways.utils.image import ImageSizeHW from brainways.utils.io_utils.image_path import ImagePath from brainways.utils.io_utils.readers.qupath_reader import QupathReader def get_scenes(filename: Union[str, Path]): reader = QupathReader(filename) return ...