sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
48869e27c87f015acf93ef4ca16285ce478d2d96cf2970de486812836fdc6c0d
Python
2,243
57
import pytest from qtpy import PYQT5, PYQT6, PYQT_VERSION, PYSIDE2, PYSIDE6, QtNetwork def test_qtnetwork(): """Test the qtpy.QtNetwork namespace""" assert QtNetwork.QAbstractNetworkCache is not None assert QtNetwork.QNetworkCacheMetaData is not None if not PYSIDE2: assert QtNetwork.QHttpMult...
567c100d23e9367b15a670f74b47380f950e387cbf7fa90e8d98b94f3aa8be5d
Python
2,243
75
#!/usr/bin/env /usr/bin/python import sys import numpy as np def main(): if (len(sys.argv) < 2): print('\n This script computes the average probability of the top 15L long+medium-range \n (i.e., |i-j|>=12) predicted distance from the npz file.\n') print(' Please note that higher probability usual...
5b43368ff50179983bcd6d0ac720b91c18a05247b3bdb7faa229b46dbe9622a9
Python
2,243
58
"""Tests for the shared focal loss function.""" import numpy as np import pytest import tensorflow as tf from artifact_identification.losses import focal_loss_with_class_weights class TestFocalLoss: """Unit tests for focal_loss_with_class_weights.""" def test_returns_callable(self): loss_fn = focal...
843a9fd4cd11fd453706aa933a966cb7e237a3751326fed2a4c4c23894e50d5c
Python
2,243
73
import pandas as pd import time import json import content_feature as cf import csv import spacy nlp = spacy.load('en_core_web_lg') def get_content_vector(tweets): links = cf.count_urls(tweets) mentions = cf.count_mentions(tweets) content_vector = { "links_ratio":links[0], "unique_links_rat...
03dcdea1ffb8dc742a6679162f0a0ec20ffaa3cbc5fbc55ecb5108844028fba2
Python
2,245
96
from rscvp.util.util_gspread import GSPREAD_SHEET_PAGE from rscvp.visual.util import SFTF_ARRANGEMENT __all__ = ['GENERIC_HEADERS', 'SPATIAL_HEADERS', 'PF_HEADERS', # 'VIS_HEADERS', 'VIS_DIR_HEADERS', 'VIS_SFTF_HEADERS', # 'var_pag...
107b478e80452aebfbcc26a372fd2b30ab89f84c68ff6cec04c009e987dc9609
Python
2,245
66
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script to convert gradient tables between FSL and MRtrix formats. """ import argparse import logging from scilpy.io.utils import (assert_gradients_filenames_valid, assert_inputs_exist, assert_outputs_exist, ad...
e60311ba2db2282b438ba142873b0fb3c53d1da1af314f4dd9b84327f78b48ef
Python
2,245
65
#!/usr/bin/env python import numpy as np import pandas as pd import click as ck from sklearn.metrics import classification_report from sklearn.metrics.pairwise import cosine_similarity import sys from collections import deque import time import logging from sklearn.metrics import roc_curve, auc, matthews_corrcoef from...
f00d8a57736e6bca15f4f67b75fa730b7a28324c420d5a233e27dd637f2a4ad2
Python
2,245
57
import matplotlib import numpy as np import matplotlib.pyplot as plt from scipy import stats from pathlib import Path cur_path = Path.cwd() / "data"/ "coupling_z_records_g123_fold36.txt" # cur_path = Path.cwd() / "data"/ "coupling_z_records_g123_fold39.txt" # # cur_path = Path.cwd() / "data"/ "coupling_z_records_g123...
19f40fd45659a155bdef86834cd59443fb72562c62093dc0fb5144402980020e
Python
2,246
56
import argparse import sys from ogo.cli.ref.SidewaysFallFe import main as sideways_fall_main # Adjust import based on file structure from ogo.cli.ref.SpineCompressionFe import main as spine_compression_main # Adjust import based on file structure def main(): """ Wrapper function to run the vertebra or femur F...
38a0b5d2b7f5c87e8c37b31c0eb1bad1db0f1b3a498af8821be8a9a48b8bd979
Python
2,246
59
#!/usr/bin/env python """ apply_thresholds.py ─────────────────── 读取 cross_validation 生成的 fold*_val_preds.npz,再应用: 1) Beta Calibration (若提供系数) 2) 逐标签阈值 输出跨折平均 SubsetAcc 与 MCC-macro。 """ from __future__ import annotations import argparse, glob, json, numpy as np from pathlib import Path from sklearn.metrics import...
b5d914b5799404dd0572ccdf55fa0065be6fcbe0ec8a7c48a510cdd2cc344e76
Python
2,246
66
#!/usr/bin/env python3 #imports import argparse from ase import Atoms import numpy as np from ase.visualize import view from ase.io import read, write from ase.optimize import * from ase import units from KerNNCalculator.KerNNCalculator import * from ase.md.langevin import Langevin from ase.io.trajectory import Trajec...
010d9015e89729b3e9e88f2c51e13c1fb6ebfb5ff29dd8af5eded9ebfc3adb32
Python
2,248
67
from typing import List import torch from torch_geometric.data import TemporalData class TemporalDataLoader(torch.utils.data.DataLoader): r"""A data loader which merges succesive events of a :class:`torch_geometric.data.TemporalData` to a mini-batch. Args: data (TemporalData): The :obj:`~torch_...
cd23b0850d8fd7b5bd155d3a853099c3985f9915c9f1fdd25b1fb9b2c8a1705d
Python
2,248
57
"""Run one chain, as a subprocess. ``track_dataset`` fans chains out across processes rather than threads, for two reasons that are both ROICaT's: * it re-extracts its 55 MB ROInet model into ``tempfile.gettempdir()`` on every run, so concurrent runs sharing a TMPDIR overwrite the ``.pth`` while their neighbours ...
ddf9f6de6344f8b4c01096b163c0fe2a7d213dd18375a2b616b0a399cf6f04b3
Python
2,248
63
#!/usr/bin/env python3 """Print a summary of any Thalamus capture (``.tha``) file. A handy first step when you receive a recording: see which nodes it contains, what kind of data each produced, the analog channel names, the recording duration, and the metadata stored at the start. Works on any ``.tha`` file, includin...
bc16bbdd72b54fccc492c66242daddd7bf05ff8b8867df8fbd126b5d6a7c1a0e
Python
2,249
63
import os import tempfile import numpy as np from ivim.constants import y from ivim.io.base import write_bval, read_cval from ivim.seq.lte import calc_b, calc_c, G_from_b, cval_from_bval # Paths to data temp_folder = tempfile.gettempdir() # Parameter values G = np.array([10e-3, 30e-3, 60e-3]) Delta = 20e-3 delta =...
91bf216026bdd6e21716f4fb199e142f34c8a393d10ee48d1a74565b61f7fe18
Python
2,250
80
# -*- coding: utf-8 -*- # # aodf := Asymmetric Orientation Distribution Function (aODF) # import numpy as np from dipy.reconst.shm import sph_harm_ind_list def compute_asymmetry_index(sh_coeffs, order, mask): """ Compute asymmetry index (ASI) (Cetin-Karayumak et al, 2018) from asymmetric ODF volume expr...
69042a4848bbdaa91a2a78bfa9b08de60633cc11a62107b5ccf1483822714512
Python
2,251
67
#!/usr/bin/env python3 #imports import argparse from ase import Atoms import numpy as np from ase.visualize import view from ase.io import read, write from ase.optimize import * from ase import units from KerNNCalculator.KerNNCalculator import * from ase.md.langevin import Langevin from ase.io.trajectory import Trajec...
8038a0d7ecb65e1699675bc91619acee19de48b05d71225f7f00e8466c7c8b35
Python
2,251
91
import os.path as op import nibabel as nib import numpy as np def rician_img_correct(dwiname, noisemapname, outpath=None): """Performs Rician correction on a dataset with a noisemap Parameters ---------- dwiname : str Filename of image to be corrected noisemapname : str Filename ...
01acc4135da01f543c096212966a67fd041a4073b72c399abef144953b4d4476
Python
2,252
60
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['processing.zip', 'commit_am...
0bdd7f9a6da4926ca7f483f44fd1917de2a67379c007dd67c93cadbba224c7da
Python
2,252
84
import numpy as np import hipsternet.input_data as input_data import hipsternet.neuralnet as nn from hipsternet.solver import * import sys n_iter = 1000 alpha = 1e-3 mb_size = 64 n_experiment = 1 reg = 1e-5 print_after = 100 p_dropout = 0.8 loss = 'cross_ent' nonlin = 'relu' solver = 'adam' def prepro(X_train, X_va...
44ac89e0d55b654647fadab7790e4e3dc618e0a819e734e666e48dd14f3ff5c4
Python
2,252
51
import os import subprocess import shutil import nibabel as nib import time import numpy as np import pandas as pd from nipype import Node, Workflow from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec, TraitedSpec, File, Directory, traits, CommandLineInputSpec, File, TraitedSpec, CommandLine, Direc...
9f28d056e4382c030f14ec46b875a9b2aa399809d6c36392b8b52ff94d97e635
Python
2,252
30
from testsetclass import TestsetClass class PArel(TestsetClass): def __init__(self): self.weak = 1.0 self.molecules = ['h2s2o71', 's4o42', 'c2h2f41', 'his3', 'sugar2', 'A2', 'his2', 'sugar3', 'sugar4', 'h4p2o71', 'aminocoohbz2', 'aminocoohbz3', 'arg2', 'c2cl43', 'T2', 'c2cl42', 'T3', 'h2s2o72', 's...
bd377b68d9504662f5e5ece3eb2e52fd3524375de48ceedede80dadded16cdac
Python
2,252
60
"""Contains constants used for the Therapeutics Data Commons Data.""" DATASET_TO_TYPE = { "Caco2_Wang": "regression", "PAMPA_NCATS": "classification", "HIA_Hou": "classification", "Pgp_Broccatelli": "classification", "Bioavailability_Ma": "classification", "Lipophilicity_AstraZeneca": "regressi...
67aff2333da21c39a5f1b56b979fc3e15f972515ed625921c6387b022a54d81e
Python
2,253
64
"""Merge echos into single 4D nifti. NOTE: This script might be unnecessary if you like having the echos as separate files. However, note that this script also exports an echo average image. Which is convenient. """ import os import nibabel as nb import numpy as np # Parameters NII_ECHOS = [ "/home/faruk/DATA...
d2d3ec220bef524e425063e62ad1d13b02607d954b97bf4f39e11dbbd2d688c8
Python
2,253
57
from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly from brainscore_vision import stimulus_set_registry, data_registry from brainscore_core.supported_data_standards.brainio.s3 import ( load_assembly_from_s3, load_stimulus_set_from_s3, ) BIBTEX = """@article {Maniquet2024....
ad0e8b0fc0931dee993b7d977f5e07601cae2e550e2b3ad355bdb586fe7289fa
Python
2,254
54
import os import pickle import json import numpy as np import sys from ogb.lsc import WikiKG90MDataset, WikiKG90MEvaluator import pdb from collections import defaultdict import torch.nn.functional as F import torch # python save_test_submission.py $SAVE_PATH $NUM_PROC if __name__ == '__main__': path = sys.argv[1] ...
b17411ec856e7bcf25499bc53ea02290d94a907bb60a4dc729561141eeb8cfdb
Python
2,254
58
from dataclasses import dataclass, field import torch @dataclass class System: """ A data structure representing a system with various tensors and embeddings, used in graph-based computations. Attributes: batch (torch.Tensor, optional): A tensor indicating the batch assignments o...
bd1758839162496a63f67aaf43fc9881db72cc384f098126da8c95f7bf22f275
Python
2,254
75
import sys from pathlib import Path p_dir = str(Path(__file__).absolute().parents[1]) if p_dir not in sys.path: sys.path.insert(0, p_dir) import numpy as np args_short_to_long = { "-l": ("loss", 0), "-bs": ("batch_size", 0), "-do": ("dropout", 0), "-wd": ("weight_decay", 0), "-dim": ("dim", 0), ...
e18157f38602afc03da6127f27d4ec38af383514fbd64745d633bafeee8efb29
Python
2,255
67
import os import pandas as pd __author__ = "ContraxSuite, LLC; LexPredict, LLC" __copyright__ = "Copyright 2015-2018, ContraxSuite, LLC" __license__ = "https://github.com/LexPredict/lexpredict-legan-dictionary/blob/master/LICENSE" __version__ = "1.0.7" __maintainer__ = "LexPredict, LLC" __email__ = "support@contraxsu...
7c504f89eee496d6a46e4e30d0dfee7df04c357300e0486bb8fcf1ca68c780ba
Python
2,256
63
import numpy as np from scilpy.denoise.asym_filtering import \ unified_filtering, cosine_filtering from scilpy.reconst.utils import get_sh_order_and_fullness from scilpy.tests.arrays import ( fodf_3x3_order8_descoteaux07, fodf_3x3_order8_descoteaux07_filtered_unified, fodf_3x3_order8_descoteaux07_f...
8e94bbe6f3b03944c9b9808cf233576a7dc0d9dfaa0f361aa81b627ac0377689
Python
2,256
67
#!/usr/bin/env python3 #imports import argparse from ase import Atoms import numpy as np from ase.visualize import view from ase.io import read, write from ase.optimize import * from ase import units from KerNNCalculator.KerNNCalculator import * from ase.md.langevin import Langevin from ase.io.trajectory import Trajec...
a087ca2b16bdc8bb225739d80a41a90d50bc449fa30d5bec3e0abb334fd4bb5d
Python
2,256
47
import seaborn as sns import numpy as np import matplotlib.pyplot as plt from scipy.io import loadmat from pathlib import Path data_path = Path('D:\Data\Lobster\Lobster_Recording-200319-161008\EventClassifierDataset\output_IL.mat') data = loadmat(str(data_path.absolute())) mat_confusion = data.get('mat_confusion') #...
e228ea557e7fd4b602bd547d908ccb0fb41e0484d9b344946caa13f97c4edb09
Python
2,256
80
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations from abc import ABC, abstractmethod from collections.abc import Collection, Iterator, Sequence from typing import TYPE_CHECKING from attrs import define, field, validators from cvat.apps.dataset_manager import da...
f94ce9dfa5e609ef7d9360420b6d33bd0759ae4bc60e78b7cdc999288acd6c69
Python
2,256
54
import pytest from qtpy import PYQT5, PYSIDE2 @pytest.mark.skipif( not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings", ) def test_qtlocation(): """Test the qtpy.QtLocation namespace""" from qtpy import QtLocation if PYSIDE2: assert QtLocation.QGeoServiceProviderFactory is no...
de75c0ced3350b46b0c223f646a2bff8421a794d6ab9159902980df15ff56d52
Python
2,257
58
""" Brain-Score vision plugin — Iteration 1 baseline. ConvNeXt-Large with LAION-2B CLIP pretraining (in12k+in1k fine-tune, 384px), exposed with FINE-GRAINED block-level candidate layers so the framework's per-region LayerSelection has good options (existing convnext entries only expose the 4 coarse stage outputs). reg...
e97d454871ccd7e2fab28e943612a63bd0a27b75c9a5b8a7c22bb9d44ea4b37c
Python
2,257
43
from torchmetrics import Metric from typing import Optional import torch class MeanPearsonCorrCoefPerChannel(Metric): is_differentiable: Optional[bool] = False higher_is_better: Optional[bool] = True def __init__(self, n_channels:int, dist_sync_on_step=False): """Calculates the mean pearson correl...
11f0f6adb045ed1650caa6ae75d387db0e4a4596628efba8960681440a7acdbe
Python
2,258
51
import os import shutil def collect_files_by_pattern(bids_deriv_root, subfolder_path, target_filename, have_id, output_dir): """ Traverse BIDS derivatives to collect specified files across all subjects and sessions. Parameters: - bids_deriv_root (str): Path to the BIDS derivatives root directory. ...
35797adc2fbdac0899e174f5dbd85e9af55972b8dc0a988441e406ed5e33797a
Python
2,258
64
import torch import torch.nn as nn from ..modeling import Sam from .amg import calculate_stability_score class SamCoreMLModel(nn.Module): """ This model should not be called directly, but is used in CoreML export. """ def __init__( self, model: Sam, use_stability_score: bool =...
3b155b33ecf84dc06769717c12930cb93764312350032943dc40eadc1fa4a067
Python
2,258
75
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Compute bundle volume per label in mm3. This script supports anisotropic voxels resolution. Volume is estimated by counting the number of voxel occupied by each label and multiplying it by the volume of a single voxel. The labels can be obtained by scil_bundle_label_m...
a4bdc4a9adac99ebfa73165872b5ec69e0ada013acd3b5a7f0e1f75319a2d76c
Python
2,258
67
from scipy.spatial import cKDTree from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split import scanpy as sc import numpy as np import pandas as pd def logreg_epoch_score(adata, epoch): """ Returns the median logreg test score averaged across species. Also...
474e10607646e28bc16812ee778c48baa0a15e5b68906c0939f2e83ca23f32d0
Python
2,259
76
from typing import Optional import torch import torch.nn.functional as F from torch import nn, Tensor __all__ = ["BalancedBCEWithLogitsLoss", "balanced_binary_cross_entropy_with_logits"] def balanced_binary_cross_entropy_with_logits( logits: Tensor, targets: Tensor, gamma: float = 1.0, ignore_index: Optional[in...
487ec3838cc31a1fe562cfd5dc1fea5812f9a5dc208373bef1b4e2e54a3d8698
Python
2,259
73
import pytest import numpy as np from nems.layers.base import Parameter, Phi def test_constructor(): # Name should be only required argument, shape defaults to () p = Parameter('test') assert p.shape == () p = Parameter('test', shape=(2,3)) assert p.shape == (2,3) assert p.prior.shape == (2,...
492e2e68436c04f7cd646b13678a1bd984e4e4526ebdf8f6cfb9989f6db2714b
Python
2,259
64
import numpy as np import pandas as pd from sklearn.model_selection import KFold from sklearn import tree from sklearn.metrics import roc_auc_score from sklearn.metrics import recall_score from sklearn.metrics import precision_score from sklearn.metrics import accuracy_score from sklearn.metrics import f1_score from sk...
d68fdd852d156992fa0951650fe6a39c36b3ac4dcc76a93fef9ea615c832e3b4
Python
2,260
69
# %% # imports # this notebook script expects monica's torchtrain environment import sys sys.path.append("/home/mthieu/Repos/emonet-py/python/myutils") from emonet_utils import Cowen2017Dataset import torch from torchvision.models import resnet50, ResNet50_Weights these_weights = ResNet50_Weights.IMAGENET1K_V2 import...
dd9d4c6cbe94df5e44e865a930807e3a7f32b681b88b7e2b8873e4f4fb05d8ba
Python
2,260
75
import unittest import pandas as pd from sklearn.linear_model import LogisticRegression from sklearn.datasets import make_classification from sklearn.utils import Bunch from sklearn.metrics import get_scorer from causallib.estimation import IPW from causallib.model_selection import GridSearchCV from causallib.contr...
aeaa1307714824d71416d0b4320afcdd25b597591f8cc19a147139a841d7f02e
Python
2,261
64
from monai.transforms import Compose, ToTensord, ScaleIntensityd import torch import numpy as np import cv2 from torch.utils.data import DataLoader from data_loader import BrainXLDataset datafolder = "/home/fi5666wi/Brain_CT_MR_data/DL" # Removed due to insufficient quality on MRI image # 1_BN52, 2_CK79, 3_CL44, 4_J...
7b00804b7f79746c05f2f1043d1daba030c4ec86f017f7755d7cdc24bf885235
Python
2,262
63
import torch import torch.nn as nn import torchvision.models as models class SqueezeExcitation(nn.Module): def __init__(self, in_channels, reduction=4): super(SqueezeExcitation, self).__init__() self.se = nn.Sequential( nn.AdaptiveAvgPool2d(1), nn.Conv2d(in_channels, in_cha...
9420c344ce631d4c66958f07064acbe2ffe34f137b3605f6fc4cb375b1277a23
Python
2,262
49
import numpy as np stimplotfns = { 'AudStim_10kHz': lambda timestamps,ax: [ax.axvspan(timestamp, timestamp + 0.2, **{'color': 'k', 'alpha': 1, 'lw': 0}) \ for timestamp in timestamps],\ 'passive_bluenoise': lambda timestamps,ax: \ [ax.axvspan(timestamp, tim...
180a0803f3765b3073e8559f050964224a4cd467b99b81b20368b5dea4154bc1
Python
2,266
72
#Type something like this from within python: ARGS="2015_04_07_02" #template: ARGS="filename" #then type: execfile('InductionAnal.py') #If not in python, type: python InductionAnal.py 031011_5Or import os #if running from windows, might need to execute the following command: #os.getcwd() #might need to use for...
125caf7c18e6f7165550c040863746136f35dae1f075d819cad5c64abeefa397
Python
2,267
56
class Test_AS_Config: def test_config(self, dropConfig,demo_dir): assert dropConfig.AS.getWorkdir() == f"{demo_dir}/Scripts/AberrantSplicing/pipeline" dict_ = { 'run': True, 'groups': ['fraser', 'fraser_external'], 'recount': True, 'longRead': False, ...
1fc75ae41d2455735b0c4449a8bfa487de79cbb50ea871c6ba836888712c6f85
Python
2,268
91
import networkx as nx import numpy as np import os from tqdm import tqdm edge_path=r'Twibot-22/edges.npy' edge_index=list(np.load(edge_path)) edges=[] dataset_name='Twibot-22' id_include=(np.load(dataset_name+'/id_include.npy',allow_pickle=True)) if not os.path.exists(dataset_name): os.mkdir(dataset_name) id_inclu...
941118792cb4249537ff3c2afd86b2e1525a5dfe7514bf3c3dadf1e957ed2a66
Python
2,268
69
"""Utility functions related to the ADMET-AI web server.""" import re from pathlib import Path from tempfile import TemporaryDirectory import pandas as pd from flask import request from werkzeug.utils import secure_filename SVG_WIDTH_PATTERN = re.compile(r"width=['\"]\d+(\.\d+)?[a-z]+['\"]") SVG_HEIGHT_PATTERN = re....
8a0ee5dfa29cd01c6c0125c028a48d5afa13547b891d9c54663e376e48149310
Python
2,269
76
# -*- coding: utf-8 -*- # python standard library inputs import os # external inputs import nibabel as nb from nipype.interfaces.freesurfer import ApplyVolTransform # local inputs from ..io.get_filename import get_filename def skullstrip_refined(file_mask1, file_mask2): """Skullstrip refined. The ...
e8103c047f441308da941730afcd1a9d1c62ff6f5e6a2898ff8425cdd703505e
Python
2,269
68
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from logging import Logger from pathlib import Path import django_rq from django.conf import settings from rq.exceptions import DeserializationError from rq.job import Job from cvat.apps.engine.log import get_migration_logger from cvat.apps.engine....
14033ca2c568e92aedf8f751050df445dd1d64566c1e7c9068b7fa57a8c11e56
Python
2,270
64
from brainscore_vision.model_helpers.check_submission import check_models import functools import os from urllib.request import urlretrieve import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_prepro...
53f2f9237b1c8b1505f5b59f656a682d81ed967b478d91b2b0509d1465f8a3b3
Python
2,270
68
# %% ### import modules from pathlib import Path import pandas as pd # %% read results table results_dir = Path(__file__).resolve().parents[1] / "results" # %% data for analysis in ["fg"]: df = pd.read_excel(results_dir / f"long_{analysis}_results.xlsx") # %% round values df["estimate"] = df["estimate"]...
6688f898666ef122b5027447da8138fa430af700a2658bb1ea2212268a086c51
Python
2,270
63
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: Daniel Abele # # Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Licen...
ef29bcb0fbd6aaf0fe91988bda7d9b9203af5cd65a2ea1a6619a87c966ec938b
Python
2,270
64
from brainscore_vision.model_helpers.check_submission import check_models import functools import os from urllib.request import urlretrieve import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_prepro...
ade0b2ea9f665194732eb72c1db77434992b1b235faa81fac2fed0e31e868081
Python
2,271
69
from __future__ import annotations import importlib import json import math import subprocess import sys from pathlib import Path import numpy as np import PIL.Image import pytest pytest.importorskip("pycocotools.mask") labelme2coco = importlib.import_module("examples.instance_segmentation.labelme2coco") def test_...
395ec5c82e65ff7f24c026d1309a7866979bf4b9063039011e378102b263414b
Python
2,272
72
#!/usr/bin/env python """ The standard HAL dialog box. All the dialog boxes in HAL are sub-classes of this dialog box. Hazen 2/17 """ from PyQt5 import QtWidgets import storm_control.hal4000.qtWidgets.qtAppIcon as qtAppIcon class HalDialog(QtWidgets.QDialog): # # In order to have the correct minimization ...
b7ac8d8f630e97b4c06869d309a4ddd64d9aa01b69c05d676c668da338053935
Python
2,272
62
import json from copy import deepcopy from pathlib import Path from eir.experiment_io.input_object_io import get_input_serialization_path from eir.experiment_io.input_object_io_modules.sequence_input_io import ( load_sequence_input_object, ) from eir.experiment_io.output_object_io_modules.output_io_utils import ( ...
2897a284a095a11f552567bb1a623733ad9ba8333b38425f99bdc3c6f26df078
Python
2,273
37
"""Prepare outcome-independent memberships; frozen configurations are immutable.""" import hashlib,json from src.acquisition.download import ROOT,sha256 PRIMARY=['HALLMARK_OXIDATIVE_PHOSPHORYLATION','HALLMARK_GLYCOLYSIS','HALLMARK_REACTIVE_OXYGEN_SPECIES_PATHWAY','HALLMARK_MTORC1_SIGNALING','HALLMARK_PI3K_AKT_MTOR_SIG...
2c34003816b954ddd37568a98f6cb5692f5da06b46237ef0e65fd452cf685cc2
Python
2,273
64
import os, sys # set path current_dir = os.getcwd() sys.path.append(current_dir) import argparse from src.dataset.cath_dataset import CathDataset from src.dataset.mutant_dataset import MutantDataset from src.utils.dataset_utils import NormalizeProtein def build_cath_dataset(args, split): dataset = CathDataset( ...
909f356843ae1807d90e8c21d9eaa915699f24acba5fe6e73c91f7ef510b252b
Python
2,273
64
import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import numpy as np import logomaker from matplotlib.backends.backend_pdf import PdfPages def plot_loss(history, out_fh, loss_fxn=None): ''' plot train and val loss curves per epoch history is original history object returned by ker...
66fbeef6c72843eaf596014e6cbdff787eb77878f7c0913fae089d64abe62722
Python
2,274
62
from tqdm import tqdm import numpy as np import torch # def train(model, optimizer, train_loader, num_epochs, seed=1, device="cpu"): # if device is None: # device = torch.device(device) # torch.manual_seed(seed) # for epoch in range(num_epochs): # model = model.train...
6becd1f10a891674c629d027775f5211cbe100b1db4ef7c2512f4325271e26e4
Python
2,274
72
import shutil from flair.data import Dictionary from flair.trainers.language_model_trainer import TextCorpus def test_train_resume_language_model_training( resources_path, results_base_path, tasks_base_path ): # get default dictionary dictionary: Dictionary = Dictionary.load("chars") # get the examp...
cbb3d810ea2d8bd46a45f522db604b43add432e2d1937f0489a56828c1df04e7
Python
2,274
73
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Validate and correct gradients from eddy outputs With full AP-PA eddy outputs a full bvec bval (2x nb of dirs and bval) that doesnt fit with the output dwi (1x nb of dir) """ import argparse import logging import numpy as np from scilpy.io.utils import (add_overwrit...
fb6cf0fe0b8235e8173a02f0b0cd3d0a312c1df9c4d4dce88814c7c2b5997a6d
Python
2,274
64
import os import shutil import unittest from auxiliary.turbopath import turbopath from brainles_preprocessing.brain_extraction import HDBetExtractor class TestHDBetExtractor(unittest.TestCase): def setUp(self): test_data_dir = turbopath(__file__).parent + "/test_data" input_dir = test_data_dir +...
4d8680feb6bdccb716eeca0da71cc71bee861095189616b9928bdf3c2b1d1297
Python
2,275
65
import argparse import subprocess import sys import os def list_tools(base_dir): """列出所有可用工具""" print("Available tools:") for folder in ["python", "bash", "matlab"]: folder_path = os.path.join(base_dir, folder) if os.path.exists(folder_path): for script in os.listdir(folder_path...
5cfde8efe5f29370fa07dac5fd99ccb7c54c1e70e000a34b90eea5bede5a17fc
Python
2,275
85
# -*- coding: utf-8 -*- # python standard library inputs import os import copy # external inputs import numpy as np import nibabel as nb def get_std(file_in, path_output, name_output, set_outlier=None): """Get std. This function computes the standard deviation of one or more time series. Parameter...
7ef2c4b7029cdd1cd27901264f7a9ecd43fcd29988ac0cac49518b3e1754ec21
Python
2,275
65
"""Tests for the molecular docking tool. Hermetic by default: candidate resolution uses a SMILES (no network), docking is exercised via ``mock_docking`` and by binding the tool to the single-agent graph. The real Vina path runs only when the optional ``docking`` extra (vina + meeko) is installed. """ from unittest.mo...
c8ab492244881d7f9315200dec6e758d68f7af696b742eb9e14bf9bec0225415
Python
2,275
76
# coding=utf-8 """ Tests for deepreg/model/loss/label.py in pytest style """ from test.unit.util import is_equal_tf from typing import List, Optional, Union import numpy as np import pytest import tensorflow as tf from deepreg.loss.label import DiceLoss, DiceScore from deepreg.loss.util import MultiScaleMixin, separ...
ca36e795a552c11e1f812a8c871e6f79f1d83d2a62e35c44468768505259f4f4
Python
2,275
56
########################################################################## # Simple ycm_extra_conf.py example # # Copyright (C) <2013> Onur Aslan <onur@onur.im> # # # # This file is loade...
cc42c5bc9311ad2008bbf0000c528e0429fd687c4086ff548d58ef7edc0414f3
Python
2,275
60
import os import numpy as np from scipy.io import wavfile from tqdm import tqdm from active_filter.LMSnoise_cancel import LMSNoiseCanceller import re def read_wav_files_from_folder(audio_dir, scale=None): folder_list = [os.path.join(audio_dir, f) for f in os.listdir(audio_dir) if os.path.isdir(os.path.join(audio_d...
57853bbc5cd19d3ad8a73e9452077df9843c270de9b75a87ff2dc4cfc1bb605f
Python
2,276
69
#!/usr/bin/env python3 """ diverse_picker.py ´ÓSMILESÎļþÖÐѡȡ¶àÑùÐÔ×Ó¼¯£¨Ä¬ÈÏButina¾ÛÀࣩ Ó÷¨£º python diverse_picker.py input.smi output.smi 100 --method butina --cutoff 0.65 """ import sys, argparse from rdkit import Chem, DataStructs from rdkit.Chem import rdMolDescriptors from rdkit.ML.Cluster impo...
d9855d7970bf2d75aab74901c9019188975cd5035fb6347aa4e19e3dc7f1c80a
Python
2,277
61
"""Data loading, winsorisation & scaling utilities (auto-rebuild scaler).""" from __future__ import annotations import math, os from pathlib import Path from typing import Tuple import joblib, numpy as np, pandas as pd from sklearn.preprocessing import StandardScaler from src.config import C def load_data( csv_pa...
0394e027c2b04d29838761f9bf412e90d79755170a4133d0224ebf903da6d490
Python
2,278
64
from brainscore_vision.model_helpers.check_submission import check_models import functools import os from urllib.request import urlretrieve import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_prepro...
37b876f5a294536afb787be2921f5f4745c6723b34cb3736868077a6a8f1392e
Python
2,278
64
from brainscore_vision.model_helpers.check_submission import check_models import functools import os from urllib.request import urlretrieve import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_prepro...
4618f312d00145a77f07fdb9cfe811d066b00d552b2e6c582c6bf6dcc95ebb2a
Python
2,278
64
from brainscore_vision.model_helpers.check_submission import check_models import functools import os from urllib.request import urlretrieve import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_prepro...
6cede6d59c7600c262a6b42d74113d9f8162161c2304def5e7f1c4bfb7ea1816
Python
2,278
55
"""Reduce bounding box to decrease filesize. NOTE: I have determined the ranges either in ITKSNAP or FSLEYES. The ranges should be close to the cortex and excapsulate the whole cortex. Avoid putting the boundaries too close (i.e. one voxel away) form the cortex. Give a bit of a margin (e.g. 10-20 voxels). """ import ...
7673a5a9e63f3138f44b8414215be0dda030abf87ab566289f70ebd48f9beecd
Python
2,278
64
from brainscore_vision.model_helpers.check_submission import check_models import functools import os from urllib.request import urlretrieve import torchvision.models from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_prepro...
07022d27a71ae6b1ae3f3932ca3326042dc715a8b41e0b9811bdb2b1fc8e03f3
Python
2,280
59
# Copyright (C) 2021-2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import os.path as osp import shutil from datumaro.components.dataset import StreamDataset from datumaro.plugins.data_formats.cityscapes import write_label_map from cvat.apps.dataset_manager.bindings impor...
1c51fd7fb26446e3e3a7b1377a5bd292729fd43ff27c19484f1681d3a75dc704
Python
2,280
53
from PySide6 import QtGui, QtWidgets, QtCore from PySide6.QtWidgets import QWidget, QMenuBar, QMainWindow, QVBoxLayout, QLabel, QHBoxLayout, QGridLayout, QPushButton, QCheckBox, QSlider, QTableWidget, QTableWidgetItem, QTabWidget, QGroupBox, QSpinBox, QFileDialog, QMessageBox from PySide6.QtGui import QAction, QIcon fr...
5156910f8dff11cdd11eb797fff7c8835cd7bf0bad5d874f1df15d14cc60370b
Python
2,280
70
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- # Python standard library from __future__ import print_function from subprocess import CalledProcessError import os, subprocess # Local imports from utils import fatal, err def set_options(strict): """ Changes behavior of default shell and get overrides options...
e16c7ecca2397eb90eef6c2cc2ff6d822db377a1ebc068f2ffe0c3cc1de9dcda
Python
2,280
63
# -*- coding: utf-8 -*- """ Apply nonlinear deformation to surface mesh The purpose of the following script is to apply two deformations in succession (orig -> ana -> epi) to a surface mesh using generated coordinate mappings. The script needs an installation of freesurfer. """ # python standard library inputs impor...
e5860aea6417e2cf0cb29bda61e90c164b1bdcd653ff0f6d0eab9ee1646bc75b
Python
2,280
69
# %% from pathlib import Path import seaborn as sns import pandas as pd import bap1b.figures as figures # %% ### set paths data_dir = Path(__file__).resolve().parents[1] / "data" results_dir = Path(__file__).resolve().parents[1] / "results" # %% ### load data df = pd.read_excel(data_dir / "cs_baseline.xlsx") df["dia...
1c9040e4f6b08a693ac63b6f8afeec225c75719d26bb87ebfefd692c9de03518
Python
2,281
91
# myelinfccoupling/binning.py from typing import Optional import numpy as np import pandas as pd from .config import Config from . import model def bin_by_myelin(edges: pd.DataFrame, cfg: Config) -> pd.DataFrame: """ Add a 'my_bin' column to edges based on quantiles of myelin. """ edges_b = edges.c...
bc2fc57758ef7385268ffab66001f48ac550a840bd48783c7618a232b4327cc1
Python
2,281
62
from torch import nn, relu, dropout, cat as tcat import torch.nn.init as init class Block(nn.Module): """ A neural network block used in DLIM for phenotype prediction. This block consists of a configurable number of hidden layers, each followed by an activation function and optional dropout and batch ...
77735772509ca77a0ac5b8082c8db3fb772689bf899049171a7926b357987af8
Python
2,282
61
from sklearn.model_selection import KFold, StratifiedKFold from sklearn.utils.metaestimators import _safe_split import pandas as pd from sklearn.base import clone def cross_fitting(estimator, X, y, n_splits=5, predict_proba=False, return_estimator=True): """ Args: estimator(object):...
0c02cca2267567c591176a724c585c925964f36ec2680c0a09256b22130970e4
Python
2,283
80
# Configuration file for the Sphinx documentation builder. import os # -- Project information ----------------------------------------------------- project = "MuscleX" copyright = "2025, BioCAT" author = "BioCAT" version = "2.1" release = "2.1.1" # -- General configuration -----------------------------------------...
586b6f5bc9a255532cb2321f18e18b3c6270128d5cf45bc56ebe1f4052361684
Python
2,283
71
# The ImpedanceFitter is a package to fit impedance spectra to # equivalent-circuit models using open-source software. # # Copyright (C) 2018, 2019 Leonard Thiele, leonard.thiele[AT]uni-rostock.de # Copyright (C) 2018, 2019, 2020 Julius Zimmermann, julius.zimmermann[AT]uni-rostock.de # # This program is ...
95556efb1b231e0d079576742161f90b8299fa5ed291b5706211595d22528e67
Python
2,283
64
from matplotlib import pyplot as plt import numpy as np purple = [.5, 0, .5, 0.9] purple_light = [.5,0,.5, 0.3] green = [0, 1, 0, 0.9] green_light = [0,1,0,.3] blue = [1,.3,0, .9] blue_light = [1,.3,0,.3] grey = [.5,.5,.5, .9] grey_light = [.5,.5,.5, .3] colors = [purple,green, blue] colors_light = [purple_light, green...
9e686270b0c10f30ab839c569da9b8bb26b08a0fa1e5ce45e1d7f627d6a9020e
Python
2,284
93
import numpy as np import numpy.typing as npt def generate_xyz(array: npt.NDArray, path: str): """Generate Vesta-like XYZ file from a numpy array Params ------ array: Numpy array containing XYZ information path: Path+Name to save the XYZ file """ f = open(path, "w") # Open the file ...
eaa3ffe47eada9c24c3daa305c06f573e574d89a10a9611b53adaeaf512c1372
Python
2,284
64
from typing import Any import torch from pytorch_lightning import LightningModule from torchmetrics.classification.accuracy import Accuracy from {{cookiecutter.project_slug}} import utils log = utils.get_logger(__name__) class ClassificationTaskModule(LightningModule): def __init__( self, net: t...
4cca61be2c65a51f2841e743f6793b886c4afde72b21139c1d978254ff4da095
Python
2,285
84
#!/usr/bin/env python3 import os, sys, re usage = "usage: {} longest_orfs.cds.scores longest_orfs.cds cds.gff.scored\n\n".format(sys.argv[0]) if len(sys.argv) < 4: sys.stderr.write(usage) sys.exit(1) def main(): cds_scores_file = sys.argv[1] cds_fasta = sys.argv[2] scored_orfs_file = sys.argv...
dbcb9d93e1b8db6f7c3dabc858cf3319093d939466af060a6cbcc64ed35fa3ec
Python
2,285
52
"""Tests for the pure-geometry helpers in generate_patches (no pycurv needed).""" import numpy as np from scipy.spatial.distance import pdist from surface_morphometrics import generate_patches as gp def test_nearest_triangle(): tri = np.array([[float(x), 0, 0] for x in range(11)]) part = np.array([[0.2, 0, 0...
bb072c57d5f1c6b9fedf20d33ef6c0b52a1c9756c4930bfb968e4c66ae889689
Python
2,286
52
from qtpy.QtCore import QAbstractTableModel, Qt, QModelIndex class PandasModel(QAbstractTableModel): def __init__(self, dataframe, parent=None): super().__init__(parent) self._dataframe = dataframe # Initialize check states for each row, False means unchecked self.check_states = {i...
02d19b116a042a69343f008a941b6cf05c25100ee8d0e020b800bcf849dccdb8
Python
2,287
51
""" Iter-4 candidate — DINOv2 ViT-L/14 WITH the official ImageNet linear classifier (dinov2_vitl14_lc). Why this exists: the headless DINOv2 (num_classes=0) cannot do Brain-Score's label-based behavior (Geirhos/Baker route through LabelBehavior, which asserts the model emits 1000 ImageNet logits) — so plain DINOv2 fai...
1791d2f4df1954fc4773ab6193fbb5ecd5f047470769a0adcfe3d5859094d156
Python
2,287
52
from PyQt5.QtCore import QAbstractTableModel, Qt, QModelIndex class PandasModel(QAbstractTableModel): def __init__(self, dataframe, parent=None): super().__init__(parent) self._dataframe = dataframe # Initialize check states for each row, False means unchecked self.check_states = {...
24cc0bb935678a7aea3dd290c47c944b83c550e64db5cfca1c306bcfe37b59b2
Python
2,287
65
import torch from lightning import LightningModule from torchmetrics.classification import MultilabelAUROC from custom.network import SETresnet50 class NPhaseClassifier(LightningModule): def __init__(self) -> None: super().__init__() self.model = SETresnet50(num_class=2, n_token=48) ...