sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
76a477c71af007c515b9ab2ecbac8a5c4889cc9276d01779fa7fde08995a341b
Python
1,697
51
from torch.utils.data import Dataset import torch from functools import lru_cache DEVICE = "cuda" IMG_SIZE = 1024 PATCH_SIZE = 64 @lru_cache def getShiftSteps(stepNum, patchSize): steps = [round(patchSize*(x/stepNum)) for x in range(stepNum)] steps = [((x + patchSize//2) % patchSize)-patchSize//2 for x in s...
91af4ae6b0ba7558fb42b351085d54008a769c4b580d7b94b2fbc1dfcb647a87
Python
1,697
71
from __future__ import annotations from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Optional import numpy as np from qtpy.QtWidgets import QWidget from brainways.pipeline.brainways_params import BrainwaysParams from brainways.pipeline.brainways_pipeline import BrainwaysPipeline if TYPE_CHECKING...
16126d3ff64662d2c58f3be26a1f29c074b5240fbce5ac22b51d2d9885bb68f3
Python
1,698
54
""" test_umitag.py ------------------------------- Tests for the `umitag.py` module """ import unittest import os import sys import shutil import utils # Include the parent directory in the PYTHONPATH for relative imports sys.path.append('..') import umitag TEST_OUTPUT_PATH = 'output' TEST_DATA_FILES = {'read1': '...
2bfab01dc545873d98398ce2ac7b313529f411d592ed87d43f8c992626a3e5ca
Python
1,698
53
from __future__ import annotations from typing import TYPE_CHECKING, Any from ._widget import Widget if TYPE_CHECKING: from magicgui.widgets import protocols class StatusBarWidget(Widget): """Status bar widget, wraps StatusBarProtocol. Parameters ---------- **base_widget_kwargs : Any A...
b85ab5835cd82891215c771d1e602922d5fc0bf862ed85bea039a6b06ccc5f07
Python
1,698
70
# -*- coding: utf-8 -*- # python standard library inputs import os # external inputs import numpy as np import nibabel as nb def get_laminar_profile(file_in, path_output, hemi, name_output, mode): """Get laminar profile. This function computes the laminar profile (mean, median, max, min) of data s...
bbe990d6741795e5a053ba6c738c3470d005c85e379ef85cf0fe19bef95c63e4
Python
1,698
57
import numpy as np import pandas as pd from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, matthews_corrcoef, auc, roc_curve from sklearn.metrics import classification_report from sklearn.metrics import confusion_matrix from sklearn.mo...
ca72c2db1b84fc78d0d07976dc5ebd9a75e75c6fbb4b4b1a40f303e9446a9abb
Python
1,698
41
from pathlib import Path import numpy as np import xarray as xr import pandas as pd from brainscore_core.supported_data_standards.brainio.fetch import get_stimulus_set from brainscore_core.supported_data_standards.brainio.assemblies import NeuronRecordingAssembly from brainscore_core.supported_data_standards.brainio....
d89de45cd2d9fef01d2fe62d381f3e0ede51f36ff77146d158b327e49e93b982
Python
1,698
54
from typing import Literal, Final from argclz import as_argument, argument from neuralib.plot import plot_figure, violin_boxplot from neuralib.util.verbose import publish_annotation from rscvp.statistic.core import StatPipeline from rscvp.util.cli.cli_statistic import StatisticOptions from rscvp.util.util_plot import ...
32aaa68ba0f4169e6b9901184f00432fe42a9789ff133dba27e51da5b090d6ce
Python
1,699
57
import numpy as np import pandas as pd from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, matthews_corrcoef, auc, roc_curve from sklearn.metrics import classification_report from sklearn.metrics import confusion_matrix from sklearn.mo...
f58dc02f5c8405c5e9ebc76db092672a0d9e14996a171eee5d66bed6bd1ccd25
Python
1,699
42
# This file is part of Mooney computational modeling project. # # Mooney computational modeling project is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) an...
33af998585afa8bf57e88ffdca2fe4cac3e8cfd48e1bee5f2cda7fe5c74a5a1c
Python
1,700
43
import pyvisa as visa import pyvisascope import multitimer import time import yaml import logging from time import sleep visa.log_to_screen('INFO') logger = logging.getLogger('pyvisa') log2file = logging.FileHandler('experiment.log') logger.addHandler(log2file) def main(): # enter here the ID of your device....
d7cf97f6c0a3b19c68a212efe8e49a7963555b4762b09a8fdac748928a3cc9ab
Python
1,700
50
from copy import deepcopy from pathlib import Path from eir.experiment_io.input_object_io_modules.input_io_utils import ( load_input_config_from_yaml, ) from eir.experiment_io.io_utils import load_dataclass from eir.setup.input_setup_modules.setup_omics import ( ComputedOmicsInputInfo, DataDimensions, ...
eded5852a742d29174a21ec67dc85e772fc5193984b0605e29f46c18da966fb7
Python
1,700
60
''' ''' # # Adapted from MATLAB code written by S. Nishimoto (see Nishimoto, et al., 2011). # Anwar O. Nunez-Elizalde (Jan, 2016) # # Updates: # Anwar O. Nunez-Elizalde (Apr, 2020) ############################## # internal imports ############################## from . import (pyramids, utils, ...
e9dfbfbc956c4cca41c32300aa6ce85202b7308b6fbc6beadf81f5c07e1ae536
Python
1,701
39
from PUMI.engine import BidsPipeline, BidsApp from PUMI.pipelines.anat.segmentation import bet_fsl @BidsPipeline(output_query={ 'T1w': dict( datatype='anat', extension=['nii', 'nii.gz'] ) }) def bet_wf(wf, fmri=True, **kwargs): brain_extraction = bet_fsl('brain_extraction', fmri=fmri) w...
36a6525c87b36a16926cfd0a17a60b9add493cbe6b4f36d6dd2a391cae46e6fa
Python
1,702
58
# -*- coding: utf-8 -*- # python standard library inputs import os # external inputs import numpy as np import nibabel as nb from scipy.signal import fftconvolve def get_acorr(arr, write_output=False, path_output="", name_output=""): """Get acorr. This function computes a normalized autocorrelation of a 2D...
6b62d6be9a59286f15a0433eeb72b1a578ae158ca156639f6966f2f6147940eb
Python
1,702
58
import os import sys sys.path.append('.') import click as ck import numpy as np import pandas as pd import os from collections import Counter, deque from deepgo.utils import ( Ontology, FUNC_DICT, NAMESPACES, MOLECULAR_FUNCTION, BIOLOGICAL_PROCESS, CELLULAR_COMPONENT, HAS_FUNCTION) logging.basicConfig(level=...
f1c9e6d5e19fbc6b36ceea224fb08762b4e79903658f6f480311be22e9133fd9
Python
1,702
50
#@String(value="This script converts all .traces files in a directory into SWC. Conversion log is shown in Console.", visibility="MESSAGE") msg #@File(label="Directory of .traces files:", style="directory") input_dir #@Boolean(label="Open Console", value=false) open_console #@LogService log #@StatusService status #@UIS...
895013d28e5182644986bf0d0bd0bb56f09e72623a85b3a27008d0cf5361157a
Python
1,703
45
import pytest from chemgraph.agent.llm_agent import ChemGraph @pytest.mark.llm @pytest.mark.asyncio async def test_single_agent_graph(): """ Test that the agent can take a molecule name, convert it to SMILES, and update the state. """ cg = ChemGraph(model_name="gpt-4o-mini", workflow_type="single_...
0c7aeaa0999a2b4d36f56b550c14d9fd01663f6d0e386fb70215cdf9468e764f
Python
1,704
61
#!/usr/bin/env python3 # StrabismusClassification/scripts/generate_decision_curve_data.py import numpy as np import pandas as pd from pathlib import Path from sklearn.metrics import confusion_matrix def net_benefit(tp, fp, n, p): """ 计算净获益: NB = TP/n − (FP/n) × (p/(1−p)) """ return tp/n - (fp/n)...
182385b5dbeca521bd71cc13c3e32f46aa28ef629f035e78cb7ee1004e0f4e27
Python
1,704
47
# -*- coding: utf-8 -*- from datetime import datetime from parser import Model from parser.cmds.cmd import CMD from parser.utils.corpus import Corpus from parser.utils.data import TextDataset, batchify class Predict(CMD): def add_subparser(self, name, parser): subparser = parser.add_parser( ...
7abc8142b876bdb782b45e6bc5cae59b5fe1b2f25c769678b5a849425f728970
Python
1,704
57
from __future__ import annotations from collections.abc import Callable from typing import TYPE_CHECKING, Any from ._widget import Widget if TYPE_CHECKING: from magicgui.widgets import protocols class ToolBarWidget(Widget): """Widget with a value, Wraps ValueWidgetProtocol. Parameters ---------- ...
886dc6bc2acdf619c960cb7f865a4feb50c18f8d007b2718d48d7b3299fe00e1
Python
1,704
61
import torch import torch.nn from models.convlstm.convlstm import ConvLSTMCell import torch.nn.functional as F class LSTMSequentialEncoder(torch.nn.Module): def __init__(self, height, width, input_dim=13, hidden_dim=64, nclasses=8, kernel_size=(3,3), bias=False): super(LSTMSequentialEncoder, self).__init__...
368e6db1990dcd447ea43b5d85a943c8d30de3cfa1d1b8a5887ca6d63fa342f7
Python
1,706
52
"""Plots a scatter plot of two properties of molecules compared to the DrugBank reference set.""" from pathlib import Path import pandas as pd from admet_ai.drugbank import get_drugbank from admet_ai.plot import plot_drugbank_reference as _plot_drugbank_reference def plot_drugbank_reference( data_path: Path, ...
0a4d4c49d5dd2fc52cfcc37260879612b165fbb44341273485b0bff446596564
Python
1,707
50
from argclz import AbstractParser, argument from neuralib.plot import plot_figure from neuralib.suite2p import Suite2PResult from rscvp.selection.utils import moving_average from rscvp.util.cli import DataOutput, StimpyOptions, Suite2pOptions __all__ = ['MotionDriftOptions'] class MotionDriftOptions(AbstractParser, ...
20cde8851aaf6e2afa84385f7a85299efe11a4c2c73af1c627eac60ef85d3d6f
Python
1,707
44
import pandas as pd import numpy as np import joblib import shap import matplotlib.pyplot as plt feature_Filepath = r'' label_Filepath = r'' model_path = r'l' data_path = r'' feature_data = pd.read_csv(feature_Filepath) label_data = pd.read_csv(label_Filepath) feature_names = feature_data.columns.value...
5a4bb08f8bfce31738d6b6c08a9ebfc47530d42571ec34fa076303753def4bbc
Python
1,707
56
from setuptools import find_packages, setup def meta_data(): meta = { "version": "0.1.0", "maintainer": "Guillaume Bellec and Christos Sourmpis", "email": "christos.sourmpis@epfl.ch; guallaume.bellec@epfl.ch", "url": "https://www.epfl.ch/labs/lcn/", "license": "Apache 2.0",...
63b10befebde835c9323425029c17138d008c1b00802ed5393cc48b0c7dcb9c1
Python
1,707
67
# -*- coding: utf-8 -*- class Metric(object): def __init__(self, eps=1e-5): super(Metric, self).__init__() self.eps = eps self.n = 0.0 self.n_ucm = 0.0 self.n_lcm = 0.0 self.total = 0.0 self.correct_arcs = 0.0 self.correct_rels = 0.0 def __re...
821189aebed49a07a52787fafaf543a2a46b02c8039a4044efedd9e7bfb7e87a
Python
1,707
52
from __future__ import annotations import subprocess import tempfile from pathlib import Path from loguru import logger from labelme._config import load_config def main() -> None: repo = Path(__file__).resolve().parents[1] tags = subprocess.check_output( ["git", "tag", "--list", "v*", "--sort=versi...
c8acb14c1373e6b166dd1bc290497844cec12a049379defc4cd6e79eca73708e
Python
1,707
52
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations import unittest import datumaro as dm from cvat.apps.dataset_manager.bindings import CommonData from cvat.apps.engine.models import ShapeType from cvat.apps.quality_control.datumaro_data_provider import _Memoizin...
cfb3f9cf34b04200692a531c18b780df96917e8156ab519134158c1b07623c11
Python
1,707
51
from seisbench.data.base import WaveformBenchmarkDataset class AQ2009Counts(WaveformBenchmarkDataset): """ AQ2009 aftershocks digital units dataset from Bagagli et al. (2023) """ def __init__(self, **kwargs): citation = ( "Bagagli, M., Valoroso, L., Michelini, A., Cianetti, S., "...
62790c1ce067057c6975d5b7632aa0a965e5f87e260283285d46541871072d83
Python
1,708
42
from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score, precision_score, f1_score, recall_score, roc_auc_score import numpy as np from tqdm import tqdm train_features = np.loadtxt('train_features.txt') train_labels = np.loadtxt('train_labels.txt') valid_features = np.loadtxt('val...
720f50a06098893ec355a19bc3d2eef14dbe717b22ec39ed35b98290260c0104
Python
1,708
48
import os import sys import time from typing import List # Add project root to path sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from src.llm_orchestrator.self_correcting_agent import SelfCorrectingAgent def run_prompt_perturbation(): print("="*70) print("PROMPT PERTURBATION T...
8c8a80c9497ed915a91006b3e6e876660e0b787d18a8ba28cc1bf83aacb3cd8e
Python
1,709
62
import numpy as np from impedancefitter.cole_cole import cole_cole_model, cole_cole_R_model, raicu from impedancefitter.utils import return_diel_properties omega = 2.0 * np.pi * np.logspace(1, 8, num=20) # for cole_cole_model c0 = 1.0 el = 81.0 eh = 1.8 tau = 9.4e-3 a = 1.0 - 0.009 kdc = 1e-5 # for cole_cole_R_mode...
a3add1fdef9de786457c44d1ae973676a10ccdba5471591eca2f9b67c6bfda8c
Python
1,710
57
"""Fresh step-1-only Python run to check the ExampleTraces uV-scaling fix. Runs current spike-detection + step-1 plotting on the bundled Axion example data with potential_difference_unit='V' (the correct unit for this data, which is stored in volts). Outputs to parityRun/OutputData_FreshCheck. python parityRun/ru...
83fa836fa45dd3ea82630908364b48e943a7c98ad066aa53cdd4e8ffceee9674
Python
1,712
40
import numpy as np import pandas as pd def load_fMRI_data(root_path, sub_name, rois, contrast_name, reduce_labels_to_number=True): beta_estimates = list() loaded_rois = list() for roi in rois: try: beta_estimates.append(np.load(f'{root_path}/{sub_name}/fMRI_responses/{sub_name}_{contra...
d61317807261bbffee4afbd1e32fc352aaab970a5898de87b88f2fff2f948a95
Python
1,712
55
import torch from PIL import Image from torchvision import transforms from models.text_encoder import BertTextEncoder from models.hdc_mlp import HDCMLPEncoder from inference.lhdm_infer import make_prompt, pearson_corr, LESION_VOCAB, PATHOLOGY_LABELS DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu"...
7279d93877f9a261aea54cc32ae02d9feef941a893871614c19fcbe069882104
Python
1,713
71
import re import os import spacy import zipfile def count_urls(tweets): total = len(tweets) unique =[] for text in tweets: text = str(text) urls = re.findall(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', text) unique += urls count = len(uniq...
d896327ac72758d4bfacfbb70beba15480f523872168a8f8d1142aa2b7868cb5
Python
1,713
42
from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score, precision_score, f1_score, recall_score, roc_auc_score import numpy as np from tqdm import tqdm train_features = np.loadtxt('train_features.txt') train_labels = np.loadtxt('train_labels.txt') valid_features = np.loadtxt('val...
a55049ddc089b5bec2f92270d5ec2084c0d9dcae3ab424c75b484a3175f96a9c
Python
1,714
58
# Source: https://github.com/neuraloperator/neuraloperator/blob/main/neuralop/data/transforms/data_processors.py from abc import ABCMeta, abstractmethod import torch class DataProcessor(torch.nn.Module, metaclass=ABCMeta): def __init__(self): """DataProcessor exposes functionality for pre- and po...
134f4608fff68e884a003ca2bfafefde146d8c2e590c4e661f9f3178b8360f5f
Python
1,715
58
import functools from efficientnet_pytorch import EfficientNet from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images from brainscore_vision.model_helpers.check_submission import check_models def get_model(n...
6992473ada6aaebb0dc0d433ff2b55e394685616879a78a048a9b5febf8a51d0
Python
1,715
48
import torch import torch.nn.functional as F class AttentionLayers: """Attention layer implementations for graph neural networks.""" @staticmethod def graph_attention_layer(A: torch.Tensor, H: torch.Tensor, v: list) -> torch.Tensor: """Cell-to-cell attention layer.""" h1 = torch.mm(H,...
976e996ac8e2232031dab268735bd4e179f9a34065f2b477beeec3aa410de72e
Python
1,715
54
import pandas as pd import joblib feature_Filepath = r'' model_path = r'' data_path = r'' total_table_path = r'' label = '' save_dir = r'' total_table = pd.read_csv(total_table_path) feature_data = pd.read_csv(feature_Filepath) feature_names = feature_data.columns.values.tolist() model = joblib.load(...
e0817120b612b0371528ca66745de74f83adfe0cbd57dfb29ad783f2aa0c366f
Python
1,716
33
import os from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec, TraitedSpec, File, Directory, traits, CommandLineInputSpec, File, TraitedSpec, CommandLine, Directory import csv import numpy as np from cvdproc.config.paths import get_package_path class RemoveTractRegionInputSpec(CommandLineInputSpe...
193d9fae1c912bfbcfe43ce3e344fdab9ffc0a37d0be8d5a5aebd0f23809f59b
Python
1,717
45
from brainscore_core.supported_data_standards.brainio.assemblies import NeuronRecordingAssembly from brainscore_vision import data_registry, stimulus_set_registry, load_stimulus_set from brainscore_core.supported_data_standards.brainio.s3 import load_stimulus_set_from_s3, load_assembly_from_s3 BIBTEX = """@article{ru...
799b67cf90466f12ba28dc04191516e4e7a3486eb5717ab2f449c946aa4ca987
Python
1,717
51
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: # # Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may...
788d04763b84a3ec3f38345098c7edadc346307a7117a5839bc124024ae7e822
Python
1,718
61
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
a96a3be330afa71763e3f7c81827ae598ababcff75e0b89c90c83b1b8b56e774
Python
1,718
49
import csv from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet from brainscore_core.supported_data_standards.brainio.packaging import package_stimulus_set CONDITIONS = ['texture_1', 'texture_2', 'dotted_1', 'dotted_2'] def collect_BMD_2024_stimulus_set(condition, stimuli_directory, meta...
aef8be8c882f7479fcb1bde90ffd312d26aa82c4bcd7f07e803fdbea11bd4efc
Python
1,718
47
import pytest from qtpy import PYQT5, PYQT_VERSION, PYSIDE2, PYSIDE6, QtQml def test_qtqml(): """Test the qtpy.QtQml namespace""" assert QtQml.QJSEngine is not None assert QtQml.QJSValue is not None assert QtQml.QJSValueIterator is not None assert QtQml.QQmlAbstractUrlInterceptor is not None ...
a56f567ed865e18d4405799b2bd645d0a2e630e8ed2f2fe8ea08ba5b7eae5b9b
Python
1,721
37
""" PyInstaller hook for silx — full collect. Why "collect everything": silx is a large GUI/scientific library that loads a wide variety of resources at runtime (icons in .png/.svg/.mng, OpenCL kernels in .cl, precomputed lookup tables in .npy, etc.) through indirection layers like ``importlib.resourc...
d45389b9a51cc267bc3d1904898a0d924285062f3dcb84b89bc7e3681d787871
Python
1,721
48
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
5f27dbf50a05b914efe42763f246a4a9c8e82a67f529c52928ba9d2b42079281
Python
1,722
61
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations from datetime import datetime, timezone from json import JSONDecodeError from pathlib import Path import jsonc from cvat_sdk import Client def popattr(obj, name): value = getattr(obj, name) delattr(obj, ...
26d9862cb43d94ebcc044f8a5300ccd4a0ff6b7da4548d4f4f6405bfaf18f279
Python
1,723
24
from brainscore_vision import benchmark_registry from brainscore_vision.benchmarks.ferguson2024.benchmark import Ferguson2024ValueDelta DATASETS = ['circle_line', 'color', 'convergence', 'eighth', 'gray_easy', 'gray_hard', 'half', 'juncture', 'lle', 'llh', 'quarter', 'round_f', 'rou...
1675418b53340e244fb88a73bb8fbdf62a90203b544824a0500395e3d6ae4e36
Python
1,724
50
""" setup.py """ import os from setuptools import setup, find_packages def get_description(): """ Makes README file into a string""" with open("README.rst") as file: long_description = file.read() return long_description def parse_requirements(filename): """ load requirements from a pip requir...
121d1a8aa1036f8934242b01e687a0bad302080bdf5aff507bc5cf1c042eade4
Python
1,725
39
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'settings.ui' # # Created by: PyQt5 UI code generator 5.7 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_GroupBox(object): def setupUi(self, GroupBox): GroupBox.setOb...
84c2d75cf1901d73f13d663d4c4530f9e3e5fb6132461892ed95c4adb7630693
Python
1,725
54
"""Helper functions for TensorFlow operations.""" import logging import os from typing import List, Union _logger = logging.getLogger("osl-dynamics") def gpu_growth() -> None: """Only allocate the amount of memory required on the GPU.""" import tensorflow as tf # moved here to avoid slow imports gpus ...
26c13519ffbe41c875c3f2f5d3f41c5e3ccb22307bcddfc8dd7cac1ec092745b
Python
1,726
58
# metrics import tensorflow as tf import numpy as np from skimage.metrics import peak_signal_noise_ratio, structural_similarity def metrics(IMG1, IMG2): # input: IMG1, IMG2 - numpy arrays with shape [batch_size, height, width, channels] # return average psnr, ssim, rmse across all images batch_siz...
2c9a065ebd421760d7c10c2797808f064171e0c017917ff39d760f9f2a81bb9a
Python
1,726
44
#!/usr/bin/env python3 """Run the EEG preprocessing pipeline.""" import argparse import logging import multiprocessing as mp from artifact_identification.preprocessing import EEGPreprocessingPipeline logger = logging.getLogger(__name__) def main(): parser = argparse.ArgumentParser(description='EEG preprocessin...
8cd1b8119e9518b6e8af185d1f026810835a4f8659e04583d96444a68f8b52ce
Python
1,726
53
#!/usr/bin/env python3 import arbor as A from arbor import units as U import pandas as pd # You may have to pip install these. import seaborn as sns # You may have to pip install these. # (1) Create a morphology with a single (cylindrical) segment of length=diameter=6 μm tree = A.segment_tree() tree.append(A.mnpos,...
e754930c1c4ea0800c06da9e276cd74b7b9dd2157f0c3dc0b72c3b8fbca35314
Python
1,726
38
#!/usr/bin/env python3 # Author: Francois Aguet import argparse import os import subprocess from datetime import datetime parser = argparse.ArgumentParser(description='Run GATK ASEReadCounter') parser.add_argument('gatk_jar', help='GATK4 .jar file') parser.add_argument('genome_fasta', help='FASTA reference genome') p...
f10e769e8a30da6b244efc743251d29a73e01f9f7c56b3acb8a3e9aa9d02a9bf
Python
1,726
59
import numpy as np from neuralib.locomotion import CircularPosition from neuralib.util.verbose import fprint __all__ = ['get_binned_velocity'] def get_binned_velocity(lap_time: np.ndarray, pos: CircularPosition, track_length: int = 150, bins: i...
139e48e8d1f189dbb4e8c5d6c4fe7f4c975339e04e0bed8fece95d132a892ffd
Python
1,727
54
import torch import torch.nn as nn import torch.nn.functional as F from torchvision import models from .flash_encoder import FLASHEncoder class HDCMLPEncoder(nn.Module): """ CNN backbone + FLASH HDC encoder + MLP head. Outputs L2-normalized visual embeddings aligned with text embeddings. """ def __...
fa57cb5a432d178702176969d84692921cbfaf629c893759f1deeb368aaab732
Python
1,727
59
# pylint: disable=line-too-long import argparse from datetime import datetime from deepreg.predict import predict name = "paired_mrus_brain" # parser is used to simplify testing, by default it is not used # please run the script with --full flag to ensure non-testing mode # for instance: # python script.py --full pa...
58d93340b7b1aab8a1ac56b01942661cc9ca9fd19cbba973654342e117372e26
Python
1,729
53
# -*- coding: utf-8 -*- # @Author : LG import os import platform from PyQt5.QtCore import QThread, pyqtSignal osplatform = platform.system() class GPUResource_Thread(QThread): """ The thread for monitoring GPU0 resources. Arguments: gpu_id (int): The id of the GPU device to monitor. default 0...
5c655246875627147b30750b0726c0d4ed1ff47fc69be68d769eacd5ca77f439
Python
1,729
38
""" Embellishes the lasagna status bar in a pointless way """ from lasagna.plugins.lasagna_plugin import LasagnaPlugin # Must be a class called "plugin" and must inherit LasagnaPlugin first class plugin(LasagnaPlugin): def __init__(self, lasagna_serving): # The following calls the LasagnaPlugin constructo...
66a2b7a3b988b2ea7792207e53a045b39b6c72599bdcce3ec09435c55a17119b
Python
1,729
49
from pathlib import Path import click import numpy as np import simple_mri as sm @click.command() @click.option("--input", type=Path, required=True) @click.option("--reference", type=Path, required=True) @click.option("--mask", type=Path, required=True) @click.option("--output", type=Path, required=True) def T1w_sig...
b195b9ababdc01c5b668c317786dce39f9fe58af82beb0c8a873aeef8b0b0c6b
Python
1,729
64
""" Load Au + Au TPC data """ from pathlib import Path import numpy as np import torch from torch.utils.data import Dataset AXIS_MAP = {'azimuth': 0, 'beam': 1, 'layer': 2} DEFAULT_ORDER = ('azimuth', 'beam', 'layer') class DatasetTPC(Dataset): """ Load TPC data as multi-channel 2d dataset """ def _...
bcc95349a0e17a7a3f706f34d863b8cd5434d4cc76f8611caae3443868f356ec
Python
1,729
74
import re import datetime import calendar def get_user_id(user): return user['id'] def get_longevity(user): create = user['created_at'].split(' ') if len(create)<6: return 1 month = list(calendar.month_abbr).index(create[1]) day = int(create[2]) year = int(create[5]) create_time =...
e0a22c9db2b2dd393c7e1d5de166b753407fc0623ee8755f349a7596596a75ee
Python
1,729
61
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Return the number of streamlines in a tractogram. Only support trk and tck in order to support the lazy loading from nibabel. """ import argparse import json import logging import os from scilpy.io.utils import (add_json_args, add_verbose...
129ab56901817cd74d64883551b442c3ed0ef0e355c44179f1b51db03bfcd2a6
Python
1,730
39
import logging import os from pathlib import Path import click from parallel import submit_jobs from project.utils.dips_plus_utils import impute_postprocessed_missing_feature_values # -------------------------------------------------------------------------------------------------------------------------------------...
26a4191c85cab4025b1b83cb6e7394de36e284070a305952b4747e88d180052e
Python
1,730
62
# -*- coding: utf-8 -*- """ Some statistics tests not in standard python packages """ #:copyright: Copyright 2015 by Christoph Kirst, The Rockefeller University, New York City #:license: GNU, see LICENSE.txt for details. import sys import numpy as np from scipy.stats import rankdata from scipy.stats import distribut...
8f80c7ac77b95969a47527bfe0dffa954d78addd60ca23a902e0014a1ad23ce7
Python
1,730
60
# Copyright (C) 2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from enum import StrEnum from django.conf import settings from cvat.apps.iam.permissions import OpenPolicyAgentPermission, get_iam_context class LogViewerPermission(OpenPolicyAgentPermission): has_analyt...
9ea186ea83958b489e9745613af28797ffa05433944f58ed3268f7faba03c937
Python
1,730
57
# -*- coding: utf-8 -*- import functools import ssl from timm.models import create_model from brainscore_vision.model_helpers.activations.pytorch import ( PytorchWrapper, load_images, preprocess_images, ) from brainscore_vision.model_helpers.check_submission import check_models ssl._create_default_https_c...
08544498d8c4a80b6b1a35bc93052fbc96ff94cdce1ee6cee93632e786d584f7
Python
1,731
17
"""Supplement hierarchy snapshot with two descriptive reaction annotations.""" import datetime,hashlib,json,subprocess from pathlib import Path ROOT=Path(__file__).resolve().parents[2];out=ROOT/'data/raw/context/reactome_dna' p=ROOT/'metadata/reactome_dna_reactions.json' if p.exists(): d=json.loads(p.read_text()) for...
3efab4de3e7210aa695dca08f925a68dcefdce25a8597726c6d24b55ad1c94c2
Python
1,731
54
#!/usr/bin/env python2.4 """ Returns all positions of a maf with any pwm score > threshold The positions are projected onto human coordinates """ import sys from bx.align import maf as align_maf from bx.pwm.pwm_score_maf import MafMotifScorer def main(): if len(sys.argv) < 4: print(f"{sys.argv[0]} motif...
cc7fcc1de209d64af592479cbe28e18881dce7b32d4eb0edc2a5efd365148da6
Python
1,731
42
import torch import torch.nn as nn import s3prl.hub as hub from transformers import Wav2Vec2Model, HubertModel class PretrainedSpeechModels_hf(nn.Module): # using pretrained speech models from huggingface def __init__(self, pretrained_model, pretrained_name, final_feat_dim): super().__init__() ...
ce70bf52c824678bdf38282aa7047c08f8be30c1a3825d976ae09a21336308fe
Python
1,731
36
from collections import defaultdict option_list = defaultdict(list) def get_option_list(dataset): if dataset == 'MBC': # Input parameters option_list['data_dir'] = '/home/featurize/work/DANST_model/DANST/data/Mouse_Brain_Coronal/' option_list['ref_dataset_name'] = 'scRNA.h5ad' #scRNA_data...
718aa097eec8c7ec6c94bf3737c01eea4cc020a96975ddaa90c61c89104ee0f0
Python
1,732
45
import os from typing import Optional from .reader_image_folder import ReaderImageFolder from .reader_image_in_tar import ReaderImageInTar def create_reader( name: str, root: Optional[str] = None, split: str = 'train', **kwargs, ): kwargs = {k: v for k, v in kwargs.items() if v is...
ffe9748e1d8fed3b3284236a5fae9024604c157f160f87984e96403bc5123fd0
Python
1,732
65
import os import numpy as np import tensorflow as tf from tensorflow.keras.callbacks import EarlyStopping, ModelCheckpoint def set_seed(seed=42): """ 재현성을 위한 시드 고정 """ import random os.environ["PYTHONHASHSEED"] = str(seed) random.seed(seed) np.random.seed(seed) tf.random.set_seed(seed)...
2c77f24a07df0947dde3774ec71ac9b55b1aacaa2300eac5ee68717ed210bca0
Python
1,733
47
from tomocupy_stream import GPURecRAM import numpy as np import tifffile import dxchange theta = np.linspace(0,180,256).astype('float32') obj = np.random.random([256,256,256]).astype('float32')*1e-5#[:,64:-64,64:-64] dark = np.zeros([1,obj.shape[0],obj.shape[-1]],dtype='float32') flat = np.ones([1,obj.shape[0],obj.sh...
355746225d256c42e388fd1e6c27d5f376508e8f56998c97db6d0abc09fdecad
Python
1,733
53
# -*- coding: utf-8 -*- """ Created on Mon Aug 21 11:01:06 2023 @author: Guido Meijer """ import json from datetime import date from pathlib import Path # Get data folder path project_root = Path(__file__).parent.parent settings_file = project_root / 'config' / 'settings.json' with open(settings_file, 'r') as openfi...
71de5ec9150e1bdd0899278b66c222ce3a1a4e49c802a4c2acc12d0655e4f9f4
Python
1,733
56
import pytest from typing import Tuple from flair.data import Dictionary, Corpus from flair.data_fetcher import NLPTaskDataFetcher, NLPTask from flair.embeddings import WordEmbeddings, DocumentRNNEmbeddings from flair.models.text_regression_model import TextRegressor # from flair.trainers.trainer_regression import Re...
034b34da290a9a3488eb3bf4c37f0105aede49c8e8f3982671470afc2a989c4c
Python
1,734
69
AZURE_CONFIG = { "api_version": "2024-12-01-preview", "azure_endpoint": "YOUR_AZURE_ENDPOINT_HERE", "api_key": "YOUR_API_KEY_HERE", "deployment_name": "YOUR_DEPLOYMENT_NAME", "model": "gpt-4", "temperature": 0.3, "max_tokens": 2000, } EMBEDDING_CONFIG = { "azure_endpoint": "YOUR_EM...
a115c52068190fad430bd7ead746c9bfb9b0cf21d236fa3f91b4ce970f2f542b
Python
1,735
52
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from django.conf import settings from django.db.models import QuerySet from django.db.models.functions import Coalesce from django.utils import timezone from cvat.apps.access_tokens import models from cvat.apps.dataset_manager.util import current_fu...
5bdeb2e4256d167350656f1b595044fa47688ae175d61af6ba868879c2f94139
Python
1,736
71
#!/usr/bin/env python """ Read a maf and print the text as a fasta file, concatenating blocks. A specific subset of species can be chosen. usage %prog [options] species1,species2,... < maf_file > fasta_file --fill="expression": Insert this between blocks --wrap=columns: Wrap FASTA to this many columns """ im...
61a361bca0ff0d93a465a1991e8c467ddc3710cfaeaedb33b1bb566a1f695229
Python
1,736
46
# This file is part of Mooney computational modeling project. # # Mooney computational modeling project is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) an...
6e485582ec06f982e297a86eaf1531b84e42005887d665bf64ef34a2141dbaf5
Python
1,736
47
import pytest from brainscore_vision import load_dataset @pytest.mark.private_access @pytest.mark.parametrize('assembly_identifier', [ 'Rust2012.single', 'Rust2012.array']) def test_existence(assembly_identifier): assert load_dataset(assembly_identifier) is not None class TestRustSingle: @pytest.mar...
b0f260cb48298741be19a4e0eaa887b9e41135b90e7bf58b8b546f8f65a87c6e
Python
1,737
48
from syri.scripts.func import revcomp, readfasta def test_ins_coord(): ''' Test that the matching bases for INS (before the inserted sequence) are same :return: ''' refseq = readfasta("col.TAIR.fasta.filtered") qryseq = readfasta("Ler.chr.all.v1.0.fasta.filtered") with open("sv.txt", 'r') a...
1538ba84f8d8ca31f2cf2249bf2c00245e84ef20a2a2fac8ea7f68349ffcfd0f
Python
1,738
54
# Generated by Django 4.2.13 on 2024-07-09 11:08 import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("engine", "0078_alter_cloudstorage_credentials"), ] operations = [ migrations.AlterField( model...
a58af889b16e434ef85041121e827b864d36427a3d776b92dad6a19d8417bec0
Python
1,738
52
import torch from torch import Tensor import torch.nn as nn from typing import List, Union, Tuple class Generic(nn.Module): def __init__(self, backbone: nn.Module, activations: List[nn.Module], channel_indicies: List[List[int]] = []): """ A generic wrapper to a segmentation model. Often, it is des...
37bd234835c23c22ca6b63a94462a4e020fd3a270706ca49b560d464dca8563d
Python
1,739
52
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved from typing import Callable, Iterable, Optional from torch.utils.data import DataLoader, Dataset, DistributedSampler, IterableDataset class TorchDataset: def __init__( self, dataset: Dataset, batch_size: int, ...
9d2b518865a79473abf8af73715042ad35825b8faa0d21c3afef028989329436
Python
1,739
63
# tifffile/tests/conftest.py """Pytest configuration.""" from __future__ import annotations import os import sys from typing import Any if os.environ.get('VSCODE_CWD'): # work around pytest not using PYTHONPATH in VSCode sys.path.insert( 0, os.path.abspath(os.path.join(os.path.dirname(__file__), '.....
eeed3157fb1944487ab7623b4fb0b69d80082c9b9ae68d698fc5479e36fd02b9
Python
1,739
42
from argclz import AbstractParser from neuralib.plot import plot_figure from rscvp.spatial.main_cache_align_peak import ApplyAlignPeakCache from rscvp.spatial.main_cache_occ import ApplyPosBinCache from rscvp.spatial.util_plot import plot_alignment_map from rscvp.util.cli.cli_output import DataOutput __all__ = ['Align...
9fba3fc4f6483403ca257a2129b3cbcd41b91bde5259119a630863d526f13a51
Python
1,740
44
import torch from itertools import combinations_with_replacement __all__ = ['texture_filter'] def symmetric_image(images: list): nd = images[0].ndim - 2 # Array[..., nd, nd] required e.g. for eigvalsh sym = torch.zeros(images[0].shape + (nd,) * 2, dtype=images[0].dtype, device=images[0].device) for i...
f3b3db65cd26eab1d1df0141b7a7c47427c9f621ea5365220a1d8711ea62a003
Python
1,740
46
# 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]un...
548f668d20d508783efc364703d502e0cb963f8ac03b84e3a135a653d6e31f33
Python
1,743
66
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the PyMVPA package for the # copyright and license terms. # ### ### ### ### ###...
a3eab09f52799c3b2df6f381697eed403a55277b8a228668eefeb0ad260f7dd7
Python
1,743
64
# -*- coding: UTF-8 -*- from __future__ import unicode_literals import sys,os sys.path.append("../") from whoosh.index import create_in,open_dir from whoosh.fields import * from whoosh.qparser import QueryParser from jieba.analyse.analyzer import ChineseAnalyzer analyzer = ChineseAnalyzer() schema = Schema(title=TEX...
174bee7d799f72a8fe47781a0d6c0a26ca8a01fd885a1390498dbea450d3a74c
Python
1,744
57
# SPDX-FileCopyrightText: Copyright © Timo Koch # SPDX-License-Identifier: GPL-3.0-or-later from zenodo_download import download_single_file, get_file_list, Settings from pathlib import Path import argparse import shutil def main(): parser = argparse.ArgumentParser(description="Download files.") parser.add_a...
438bcc541c2dcaf03dcf68ae379fb2762adc7fe1f743c25b2bd53d494f71da7f
Python
1,744
54
import dipy.core.gradients as dpg import nibabel as nib import numpy as np def prepare_data(data_files, bval_files, bvec_files, mask=None, b0_threshold=50): """ Parameters ---------- data_files : str or list Files containing DWI data. If this is a str, that's the full path to a single ...
67e44786e1514730e7515dade748a1f8c8ef4af3dfc3cdaf5d4a7a76c1062588
Python
1,745
57
from django.db import migrations, models import cvat.apps.engine.models def check_list_chunks(apps, schema_editor): Data = apps.get_model("engine", "Data") CHUNK_TYPE = "list" related_rows = ( Data.objects.filter( models.Q(compressed_chunk_type=CHUNK_TYPE) | models.Q(original_chunk_...
fc78e78c14c75eca763762b6fa01cd09acd60e855675ba70a15dfce70918531c
Python
1,745
42
import dtiplayground.dmri.preprocessing as prep from dtiplayground.dmri.common.dwi import DWI import yaml from pathlib import Path import os import markdown class UTIL_Merge(prep.modules.DTIPrepModule): def __init__(self,config_dir,*args,**kwargs): super().__init__(config_dir,*args,**kwargs) glo...