sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
eab95304e230d3bb1d8da1ea41b73ef13e2bc043e92d50b4c63f1003561787f9 | Python | 2,182 | 76 | """Tests for bcblib.imaging.io."""
import numpy as np
import nibabel as nib
import pytest
from bcblib.imaging.io import is_nifti, load_nifti, resave_nifti, resave_nifti_list
def _make_nii(shape=(3, 3, 3), val=1.0):
data = np.full(shape, val, dtype=np.float64)
return nib.Nifti1Image(data, np.eye(4))
class ... |
ab1dfc5c8b14ce1eab2d5de78a1a04924f19ee8247942108b68d82ebe696ff4e | Python | 2,183 | 61 | #!/usr/bin/env python
"""
This script is for merging two RBH files into one new file.
Input: two RBH files
- The path to two RBH files
- The output path where the the new RBH file will be saved
"""
import argparse
import os
import sys
# import rbh_tools
scriptpath = os.path.dirname(os.path.realpath(__file__))
sou... |
ed4512d822f0ce6982805e1b82bde14511f588e7e13d5c2aa81b02cee4c13378 | Python | 2,183 | 62 | import pytest
from flair.data import Sentence
from flair.datasets import ColumnCorpus
from flair.embeddings import TransformerWordEmbeddings
from flair.models import RelationExtractor
from tests.model_test_utils import BaseModelTest
class TestRelationExtractor(BaseModelTest):
model_cls = RelationExtractor
tr... |
f7c0450ab2ea157f50be5d1076bc7bfd124c803d1ec507a122df7d5b0b88e97d | Python | 2,184 | 74 | # coding = utf-8
import random
import numpy as np
from sklearn.utils import shuffle
Random_Seed = 88
random.seed(Random_Seed)
def get_one_hot_label(y):
n_values = np.max(y) + 1
one_hot_label = np.eye(n_values)[y]
return one_hot_label
def data_transform(data_path, window_size, segments_length, test_mo... |
223db1a305d5899726c644c8bdf6711e0e370db6387f6cad40ec958084a4d5c4 | Python | 2,187 | 58 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
9e7cabd4e58fea3277a86b7d811c5f0de912c84bf70a591918b86710842f1296 | Python | 2,191 | 69 | # SAFE TEAM
#
#
# distributed under license: CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) #
#
import numpy as np
from binary_similarity.s2v_trainer import S2VTrainer
from binary_similarity.parameters import Flags
import pickle
def run_test():
flags = Flags()
flags.logger.i... |
e4a1a4ccf5eb8ff29ff0a5892596574ef8f4edafee826f96ff985d0c3f22d045 | Python | 2,191 | 81 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import sys
from typing import TYPE_CHECKING
from onnx.backend.test.case.test_case import TestCase
from onnx.backend.test.case.utils import import_recursive
if TYPE_CHECKING:
from collections.abc im... |
82f87cf212f0c699487c656a889ad542bab5a7b2ff18513b7bcf6a365854ceb7 | Python | 2,192 | 68 | import numpy as np
from tensorflow import keras
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten
from tensorflow.keras.layers import Convolution2D, MaxPooling2D
from tensorflow.keras import layers
from tensorflow.keras.preproc... |
963529167fc0772425c8db33e7c63968b4660cef6b45527326c6c192eafbe7e0 | Python | 2,192 | 65 | import unittest
import os
import numpy as np
import shutil
from ddt import ddt, data
from SPHARM.classes.image_stack import ImageStack
@ddt
class TestImageStackClass(unittest.TestCase):
@data(
('Doc17_19-42-58_PMT - PMT [PMT2_ 525-50] _C1_Time Time0.tif', 0, 1),
('data/Doc17_19-42-58_PMT - PMT ... |
9ffceaa10f30505c9d97f502d36f0c42fb2b42e3e403921e694ed3c84de02fc6 | Python | 2,192 | 75 | from jetnet.datasets import QuarkGluon, normalisations
import numpy as np
import pytest
from pytest import approx
from torch.utils.data import DataLoader
# TODO: use checksum for downloaded files
test_file_list_withbc = [
"QG_jets_withbc_0.npz",
"QG_jets_withbc_1.npz",
]
test_file_list_withoutbc = [
... |
ed71c00b67df57063e2efe58cdbfdaadd6b36ad7b35167a6d941c928688fe26e | Python | 2,193 | 54 | import importlib
class WriterTensorboardX():
def __init__(self, writer_dir, logger, enable):
self.writer = None
if enable:
log_path = writer_dir
try:
self.writer = importlib.import_module(
'tensorboardX').SummaryWriter(log_path)
... |
3f78fd58458d1a7d20605cc60516c6916d63a8943563a24d3be2637dd1e27d0a | Python | 2,194 | 69 | # SAFE TEAM
#
#
# distributed under license: CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) #
#
from compiler_provenance.s2v_trainer import S2VTrainerLSTM
from compiler_provenance.parameters import Flags
import numpy as np
def run_test():
flags = Flags()
flags.logger.info("... |
89bb44616ffebe1575e256ff0ca81ed09e82fd108cf2d42ba62ee255c213da7a | Python | 2,194 | 72 | import numpy as np
from neuron import h
from .psd import PSD
class Exp2PSD(PSD):
"""
Simple double-exponential PSD from Neuron (fast).
"""
def __init__(self, section, terminal, weight=0.01, loc=0.5, tau1=0.1, tau2=0.3, erev=0):
"""
Parameters
----------
section : Secti... |
433ab4acf0037c67cb158c00d72e2b1d791e78f3e32889f4339e82dad9d85ac8 | Python | 2,197 | 86 | # coding=utf-8
# Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved.
#
# 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
#
# ... |
ef38530335207392d3fdb3b16490cc62724f37c20b8b852ceafee91fa4d567f6 | Python | 2,197 | 59 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
2e705ecfb969c1d519e9934b531886d681071b16fba5d0a7e28b03c7ac8fee0e | Python | 2,198 | 39 | import os
import unittest
from elftools.elf.elffile import ELFFile
from elftools.elf.sections import NoteSection
class TestNotes(unittest.TestCase):
def test_note_after_gnu_property_type_note(self):
with ELFFile.load_from_path(os.path.join('test', 'testfiles_for_unittests', 'note_after_gnu_property', 'ma... |
39b60c631a4d84a78958ad507157b107dad40dd8dae0ede95b34582c07b2bd89 | Python | 2,199 | 62 | import collections as col
import logging
import os
import re
import sys
import click
import numpy as np
import atom3d.datasets.datasets as da
import atom3d.splits.splits as spl
import atom3d.util.file as fi
import atom3d.util.formats as fo
logger = logging.getLogger(__name__)
label_names = ['A','B','C','mu','alph... |
1a37609279602bbfa97f0d6384cd50efe90d3dde69a24117a9c653d1d842d547 | Python | 2,200 | 47 | # Copyright 2019-2026 The AmpliGraph Authors. All Rights Reserved.
#
# This file is Licensed under the Apache License, Version 2.0.
# A copy of the Licence is available in LICENCE, or at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
from ampligraph.latent_features.layers.scoring import HolE
import pytest
impo... |
3583b58227763796f2347748b91ba8ff3879b40d3636d1236f57bb920a41269e | Python | 2,200 | 68 | # Copyright 2022 Diagnostic Image Analysis Group, Radboudumc, Nijmegen, The Netherlands
#
# 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... |
9d95513f9e47c14ff19d5a57b7163370ca004b9b2fcb4ac6f794c210ffe94fb3 | Python | 2,200 | 55 | """
The first in a series of tutorials about how to effectively use the SNS Toolbox. In this tutorial, we design a simple
network with a single neuron and an applied current source.
William Nourse
November 29 2021
"""
"""
1. Import necessary packages and modules/classes
"""
from sns_toolbox.neurons import NonSpikingNe... |
a2f7e1b03b7026900e942fb35ad79c3cac65a862bb4eda287ee44b7b65efb2bf | Python | 2,200 | 70 | #!/usr/bin/python
##
# Initial graphical causal discovery using causallearn package
# @author Neil Munjal
from causallearn.search.ConstraintBased.PC import pc
from causallearn.search.ConstraintBased.FCI import fci
from causallearn.search.FCMBased import lingam
from causallearn.utils.cit import fisherz, chisq, gsq, mv... |
551b2c43d78651eb056139c04d9ca211d79b8efea46cb5741b2286a5b18af6a6 | Python | 2,201 | 69 |
# To build and upload a new version, follow the steps below.
# Notes:
# - this is a "Universal Wheels" package that is pure Python and supports both Python2 and Python3
# - Twine is a secure PyPi upload package
# - Make sure you have bumped the version! at ts/version.py
# $ pip install twine
# $ pip install wheel
# $... |
cae51b0944100adeed1db8243ad9ebd2fa5ecb33952869b47f4f4fcffd883b74 | Python | 2,201 | 50 | import pandas as pd
import numpy as np
import os
import matplotlib.pyplot as plt
# outFolder_time = "time_samplegroup_KO"
# outFolder_time_celltype = "time_samplegroup_celltype_KO"
outFolder_cell = "samplegroup_celltype_KO"
df_demo = pd.read_csv("time_samplegroup_KO/d50_engineered_Cre_vs_Flp.txt", sep = "\t", head... |
cd9ce27d6baa98c160d095d7a3ae03c6d1cea5e2724c037303edeb9a06ab3c87 | Python | 2,201 | 74 | # -*- coding: utf-8 -*-
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.... |
3d37615b907028135eadc497f1ece7cad7a8a994c96480291521ab9fbb91b47e | Python | 2,202 | 68 | """bottleneck.py"""
"""
Author: Yimin Yang
Last revision date: Jan 18, 2022
Function: Bottleneck of AA_TransUNet
"""
import torch.nn as nn
def conv3x3(in_planes: int, out_planes: int, stride: int = 1, groups: int = 1, dilation: int = 1) -> nn.Conv2d:
"""3x3 convolution with padding"""
return nn.Conv2d(in_pl... |
ad584c16564c24dc66f26a685e7e72b890f9e2d92c8c0001bd11a279250dcf2f | Python | 2,202 | 66 | import os
import re
import numpy as np
import pandas as pd
from sortedcontainers import SortedList
def writeToFile(authors, features, author2id, paper_ids, content):
""" Writes all data into files
The following files are written
- dataset/features.csv
- dataset/authors.txt
- dataset/paper_ids.csv
... |
387695b6c704fea13e5d0706cca80bc12a39e85c98d9ad5fb80fdceae42994e7 | Python | 2,203 | 81 | import tensorflow as tf
from keras.layers import ZeroPadding3D
from keras.engine import Layer
import sys
sys.path.append('..')
from utils import dipole_kernel
#
Padding method of edge pixels
#
# Copyright @ Yanqiu Feng
# Laboratory for Medical Imaging and Diagnostic Technology
# Southern Medical University
# email: f... |
668302f79d0b7b53f067b8b36bf0abe39062f130c7eaa1575b3aa56be467517a | Python | 2,207 | 54 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
1745088ef9845a0e712982696a64a0fc9eb238f1f4c24a719fb5fa3a87c42f05 | Python | 2,208 | 49 | """
A declarative, object-oriented interface for creating statistical graphics.
The seaborn.objects namespace contains a number of classes that can be composed
together to build a customized visualization.
The main object is :class:`Plot`, which is the starting point for all figures.
Pass :class:`Plot` a dataset and ... |
bcda1f898c3fe08905ee902467a352f0cd04722abe7a9921cf5e033ec88f54d5 | Python | 2,208 | 67 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
6d1433c4cba22c27be68bdea2948562734034b19c6b0b22f4d16e5143e4f2472 | Python | 2,209 | 67 | #!/usr/bin/env python
# Copyright (c) 2017-2018 The gumpy developers:
#
# 2017-2018 Zied Tayeb <zied.tayeb@tum.de>
# 2017-2018 Nicolai Waniek <rochus+gumpy@rochus.net>
# 2017-2018 Juri Fedjaev
# 2017-2018 Leonard Rychly
#
"""EEG signal processing and classification toolbox.
This toolbox p... |
beb40e0559f0ed1b52da7f9af3ead1e0fbf40be84fbac997010d018b06b7bb4b | Python | 2,210 | 69 | import re
import numpy as np
"""
This dataset is special, because it contains wrong data!
The authors originally used it to identify this data,
so we'll have to filter it first. How? Well, luckily
this is specified in their original publication.
https://aclanthology.org/J14-2003.pdf
https://users.monash.edu/~ingrid... |
ff8dbce583c47d6f72e06e0eefcf8d1aa8ba603654bb6f411c0440af0b94e9e8 | Python | 2,211 | 59 | # Copyright 2018-2025
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# 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/LICE... |
82fba122c69356149d80a84929e8f35a4a3d72386602ceab51eef2459b25491a | Python | 2,212 | 61 | """ Conversion of pickle files to comma-separated-values (csv) file.
You can supply either a directory containing .pkl files via the '-d/--data_dir' flag, or
a single .pkl file using the '--file' flag.
Alexander Neergaard Zahid, 2021.
"""
import argparse
import time
from pathlib import Path
from tqdm import tqdm
im... |
ae9be00a381a68b0f52cb1e57df47797084fd60f3296a1b484870423f6f259d2 | Python | 2,212 | 73 | import pandas as pd
import os
import Levenshtein
PRETRAIN_GRNAS_PATH = '../data/main_dataframes/pretrain_grnas.csv'
LEENAY_PATH = '../data/main_dataframes/leenay_full_data.csv'
U6T7_PATH = '../data/main_dataframes/13059_2016_1012_MOESM14_ESM.tsv'
def get_pretrain_grnas(no_GG = False):
pretrain_grnas = pd.read_cs... |
b8220941752581e25c5491a31aedc308d29cb0f5b6d066ed24f2dc16d5d9c575 | Python | 2,213 | 67 | import pytest
import flair
from flair.data import Sentence
from flair.datasets import SENTEVAL_CR, SENTEVAL_SST_GRANULAR
from flair.embeddings import TransformerDocumentEmbeddings
from flair.models import MultitaskModel, TextClassifier
from flair.nn.multitask import make_multitask_model_and_corpus
from flair.trainers ... |
08f733ea096e5c9614cd2b26b51200f285e77e408b36529a69ed7abb1546b0ff | Python | 2,218 | 56 | """ Onmt NMT Model base class definition """
import torch.nn as nn
class NMTModel(nn.Module):
"""
Core trainable object in OpenNMT. Implements a trainable interface
for a simple, generic encoder + decoder model.
Args:
encoder (onmt.encoders.EncoderBase): an encoder object
decoder (onmt.de... |
37483351d4bfb44d3af84173b8161badea6167b3c98fd04140e373a9fba8d351 | Python | 2,221 | 77 | import os
import tempfile
import pytest
import numpy as np
import seas.colormaps
# create a temporary folder for saving files
TEMP_FOLDER_HANDLE = tempfile.TemporaryDirectory()
TEMP_FOLDER = TEMP_FOLDER_HANDLE.name
TEST_SCALE = {'min': 0, 'max': 1}
def test_colormap_conversion():
cv2_cmap = seas.colormaps.get_... |
81ac5a68dbbc720fc6166d095c012070411b914927769d0db2dfa8c2165b79ef | Python | 2,222 | 60 | # Copyright 2007 Zachary Pincus
# This file is part of CellTool.
#
# CellTool is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
"""Run commands from the celltool suite.
"""
import optparse
import... |
9de9879f3645683ebb66d4b437c03f7a075d87bda0b5eab47ad5b1e763c87a52 | Python | 2,222 | 96 | """
Logging Configuration Module for pciSeq
This module provides a standardized logging setup for the pciSeq package,
with colored output and consistent formatting across all modules.
Key Functions:
------------
setup_logger:
Main configuration function that:
- Sets up colored console output
- Configures ... |
6f53a7c778e0d7d3bf73c1966c4bd63a211d6b2142deb6cba10f8dabad54decf | Python | 2,223 | 59 | # Copyright 2019 DeepMind Technologies Ltd. All rights reserved.
#
# 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 appl... |
bebbe10f6899273ee4242b0a08b51a161f0ef808f5a138280b3ac62d3f8df2ed | Python | 2,223 | 61 | import pandas as pd
import os
from scripts_tl import preprocess_tl
def get_coordinates(x):
if x[0].split('_')[1] == 'PATCH':
_, _, start, end, _ = x[0].split('_')
else:
_, start, end, _ = x[0].split('_')
return int(start), int(end)
full_df = pd.read_csv('../data/main_dataframes/... |
094e1a627b532a08672e0b9ce7c859aa6f2ae7889b610fa3cd55f953f964ebbb | Python | 2,224 | 53 | import pyspiel
import numpy as np
from typing import Optional
from open_spiel.python.algorithms import get_all_states
def policy_to_dict_but_we_can_actually_use_it(player_policy,
game,
all_states=None,
... |
d7d65c69094ece9a48a614ce250fec321273898e0e20d47e12e078892ae66a94 | Python | 2,226 | 53 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
1d6f4a10e52c1d5e4fe64247610ffc6c98512bd5fb3ce72625bf867d2e6952eb | Python | 2,228 | 58 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import GCNConv, global_mean_pool
class GNN_LEP(torch.nn.Module):
def __init__(self, num_features, hidden_dim):
super(GNN_LEP, self).__init__()
self.conv1 = GCNConv(num_features, hidden_dim)
self.bn1 =... |
a775fd6f24e4c481f71b602d393f0babaf494fde545a2fd9acadc055bc277b0f | Python | 2,229 | 67 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
0b91c3668ac609db542b26fbf1a386a54a6ac6f4c8ffa54c1eabae91e39ddb68 | Python | 2,232 | 96 | # coding=utf-8
# Copyright (C) 2022. Huawei Technologies Co., Ltd. All rights reserved.
#
# 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
#
# ... |
8b458cf4c1153fadfde77e945af0d7f0bb499342ab73b284d2d0bf309096b79b | Python | 2,234 | 86 | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 13 09:03:32 2014
@author: Eli Billauer
"""
from numpy import NaN, Inf, arange, isscalar, asarray, array
import sys
def peakdet(v, delta=None, x=None):
"""
Converted from MATLAB script at http://billauer.co.il/peakdet.html
Returns two arrays
function [... |
9047ce16bcf533a0f6e0f8d28073b26ebd60e3026b55f99e369ab492c9c422a5 | Python | 2,235 | 59 | import pandas as pd
import numpy as np
import netplotbrain
import templateflow.api as tf
import itertools
import pytest
atlas = {'template': 'MNI152NLin2009cAsym',
'atlas': 'Schaefer2018',
'desc': '100Parcels7Networks'}
atlasinfo = tf.get(extension='.tsv', **atlas)
atlasinfo = pd.read_csv(atlasinfo, s... |
c68960b15d3618f511b07e89b0725d243bec541c8e6ba915181945b102492253 | Python | 2,235 | 57 | # Copyright 2019-2026 The AmpliGraph Authors. All Rights Reserved.
#
# This file is Licensed under the Apache License, Version 2.0.
# A copy of the Licence is available in LICENCE, or at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
from ampligraph.latent_features.layers.scoring import RotatE
import pytest
im... |
8128abee54070e1700e6fcbd0b7e0efa44e32c6c510065cab4bf7edad26db38e | Python | 2,236 | 65 | # Copyright 2019 DeepMind Technologies Ltd. All rights reserved.
#
# 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 appl... |
8cd7a997eaa968d3e9a3e61e3c069e2259d32825cda8c6eeee7c52b34bc4b708 | Python | 2,238 | 68 | import shutil
import time
import pytest
from sktime.datasets._dataset_downloader import HuggingFaceDownloader, URLDownloader
HF_REPO_NAME = "sktime/tsc-datasets"
FOLDER_NAME = "Beef"
URL = ["https://timeseriesclassification.com/aeon-toolkit/Beef.zip"]
EXPECTED_FILES = ["Beef_TRAIN.ts", "Beef_TEST.ts"]
@pytest.mark... |
371f7835971bb782acafd7c82d2ec5ca3505ceaeeec9c939e55b97b8887aed11 | Python | 2,240 | 69 | # Copyright 2024 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... |
74a805666042b6117a7fbf407b6bbcfd550b464b898679e6689879ff0bbfeea4 | Python | 2,240 | 52 | import pytest
import os
from dnnbrain.brain import io as brain_io
def test_load_brainimg(dnnbrain_path):
"""
Test output of function: load_brainimg
"""
parpath = os.path.join(dnnbrain_path, 'data', 'test_data', 'mri_images')
# Test nifti activation loading
nifti_act, _ = brain_io.load_brainimg(... |
0057c7a25a5c9e75795c8aef6e7978f984553f7e991d0cd3e68beaad9ec3bf9f | Python | 2,241 | 71 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
eecf5883f935a4663076cdc2ae31423604bd165667885346c854b8489b8c4e6c | Python | 2,242 | 61 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
e9fd1d4e4a0d4990daaa3c5c22a58afd603859330329fb3ae9c4e3d7c54e85ed | Python | 2,243 | 59 | from networkunit.tests.correlation_test import correlation_test
from networkunit.capabilities.ProducesSpikeTrains import ProducesSpikeTrains
from networkunit.utils import use_cache, parallelize
import numpy as np
class avg_std_correlation_test(correlation_test):
"""
Abstract test class to compare correlation m... |
0c7ae2dba7d9c9755189c9ae5cb73cfe911e7f6461bbafebee53e2c4e479190b | Python | 2,244 | 54 | #!/usr/bin/env python
#
# Copyright 2019, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
5252ecfa894ee32a28163bdacb771ac81586edeb8de44502584bc438901272af | Python | 2,244 | 59 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
feb8673cbd35f7e21b599561e1f3f068780f3ccaa9a9935b825266a8573e10ef | Python | 2,244 | 60 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Add(Base):
@staticmethod
def export() -> None:
node = ... |
54f9e1ee7ee1b9d78726f9fa7bc592f49cdc252bc7570150d30484f28765f764 | Python | 2,245 | 52 | import pandas as pd
def _networkx_nodes_to_nodesdf(nxgraph, nodecols):
"""
Takes networkx graph input and returns with the node information in dataframe format for netplotbrian.
Checks if all node_columnnames (i.e. x, y, z coordinates) are in the final dataframe.
Note: if some nodes do not have coordin... |
a88f361648786048278d29ccc6c5abad41cdb921562611d8b74bcbed2474e714 | Python | 2,248 | 60 | import pandas as pd
import numpy as np
import netplotbrain
import templateflow.api as tf
import itertools
import pytest
atlas = {'template': 'MNI152NLin2009cAsym',
'atlas': 'Schaefer2018',
'desc': '100Parcels7Networks'}
atlasinfo = tf.get(extension='.tsv', **atlas)
atlasinfo = pd.read_csv(atlasinfo, s... |
677c6b2bc683d47050af319cd3c46e0b6ababa53f374ce395ee994bcc2cb4edb | Python | 2,249 | 57 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
ff7c5ea46eacbe4b6c6398335845988abf86366f7f6518af72fa63acb9156343 | Python | 2,251 | 70 | # Copyright 2023 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
3a013431fb21a2cf3603cf12532853ee2c6e7f15600952a90b83451596038501 | Python | 2,252 | 47 | # for visualisation using brat
#select admissions brat documents from the generated full brat files and cohort_doc.csv
#input an ORDO_ID + cohort_doc.csv + brat file prediction folder (e.g. docs_nlp+icd_all or doc_rd_pred)
#output a subfolder under the brat file prediction folder with the selected brat docs and anno... |
9e5fcb2cb34abb42cd6975f63f48abac878ef8b9b45e70003e2f71672439b3ea | Python | 2,252 | 68 | """Isolated numba imports for _edr."""
__author__ = ["chrisholder", "TonyBagnall"]
import warnings
import numpy as np
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.utils.numba.njit import njit
if _check_soft_dependencies("numba", severity="none"):
from numba.core.errors import Numb... |
1653149bdb93cad5350dd40a547f99beb374fe6be9c30e75e201991511bfb31f | Python | 2,253 | 77 | """Demo data for hierarchical forecasting."""
import numpy as np
__author__ = ["marrov"]
def load_hierarchical_sales_toydata():
"""Return hierarchical sales toy data to demonstrate hierarchical forecasting.
Return data covers 5 years of monthly sales data for 2 product lines,
and 4 product groups.
... |
b54c5c87b095412f0322c35e346fa016a6755bcc1006e053c5fc1ed7a2f5452a | Python | 2,255 | 70 | import click
import freesasa
import pandas as pd
import neighbors as nb
import atom3d.shard.shard as sh
import atom3d.util.formats as dt
freesasa.setVerbosity(freesasa.nowarnings)
@click.command(help='Find buried surface area (bsa) for entry in sharded.')
@click.argument('sharded_path', type=click.Path())
@click.ar... |
7b01b053add02db61779195372d3503aa6a2ef3ed0ddf4e1d047e22b90e48ec0 | Python | 2,257 | 76 | from __future__ import annotations
from collections import defaultdict
from dataclasses import dataclass
import numpy as np
import matplotlib as mpl
from matplotlib.transforms import ScaledTranslation
from seaborn._marks.base import (
Mark,
Mappable,
MappableFloat,
MappableString,
MappableColor,
... |
e4f1808a9ddbf2ab06adeb14e2a0c6b7e4de7988a413aa623345cba19085622d | Python | 2,260 | 62 | import torch
from base.proposer_base import Proposer
from models.transformer_model.transformer_processor import smi_tokenizer
from onmt.translate.translation_server import ServerModel as ONMTServerModel
from typing import Dict, List
class TransformerProposer(Proposer):
"""Transformer proposer, wrapping around gln... |
4b7b49d74aad22a318e75c056978153ddd505549e5413b500661bbc59cf0de23 | Python | 2,261 | 68 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
9c3a31c8345c7b7b8f4373d1bc70fa71482d0d8337c255b6af69d18bdec03fcd | Python | 2,262 | 60 | #------------------------------------------------------------------------------
# elftools tests
#
# Lukas Dresel (lukas.dresel@cs.ucsb.edu)
# This code is in the public domain
#------------------------------------------------------------------------------
import os
import unittest
from elftools.elf.elffile import ELF... |
0e43ed6ee116e709627ba3d83a6640fc5ad05597a8faf0d1445b5a26cd27db5f | Python | 2,263 | 71 | # coding=utf-8
# Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved.
#
# 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
#
# ... |
ceaacb8439ed1c8bead272cc15f622a98d9caafbab847fd05190e252f03bf701 | Python | 2,263 | 72 | from numpy import arange, array, concatenate, floor, zeros
def block_generator(data, sample_rate, block_len, overlap,
num_blocks_zeropad=None):
"""Returns a generator that slices an input array into overlapping blocks.
Parameters
----------
data : ndarray
Input data is a sc... |
d9f0cb736a048e76367906c559bb04421ce1ef100edacd4133256e6468f54171 | Python | 2,264 | 72 | # SPDX-License-Identifier: LGPL-3.0-or-later
import deepmd.jax.descriptor as _jax_descriptor # noqa: F401
import deepmd.jax.fitting.fitting as _jax_fitting # noqa: F401
import deepmd.jax.utils.exclude_mask as _jax_exclude_mask # noqa: F401
from deepmd.dpmodel.atomic_model.dp_atomic_model import DPAtomicModel as DPAt... |
4b065ef0390993b95fa6216998b49aab6220f9a43389c4534bd12292d5385a2b | Python | 2,265 | 62 | # coding=utf-8
# Copyright (C) 2022. Huawei Technologies Co., Ltd. All rights reserved.
#
# 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
#
# ... |
8811a713594a7f65a77f44a9476d24bd14af015c1b161229f6686a0e77d5d387 | Python | 2,265 | 74 | # Copyright 2026 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
2f37251883a95e7c5a4249154ad121234d0d08a7e2a6554402ab585d897a07da | Python | 2,267 | 47 | # Copyright 2019-2026 The AmpliGraph Authors. All Rights Reserved.
#
# This file is Licensed under the Apache License, Version 2.0.
# A copy of the Licence is available in LICENCE, or at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
from ampligraph.latent_features.layers.scoring import ComplEx
import pytest
i... |
3690ab4b3c713fc71cabcd4a813b28da4d7e3b074ded9e8a564e40aabaa8763e | Python | 2,269 | 68 | import unittest
import numpy as np
import pyfilterbank.octbank as fb
def zeros(num_samples=1024, num_chan=1):
return np.zeros((num_samples, num_chan))
def ones(num_samples=1024, num_chan=1):
return np.ones((num_samples, num_chan))
class TestFractionalOctaveFilterBank(unittest.TestCase):
def setUp(self)... |
9f151ec9f4d2e4e0924642973f7bb9360f88f3051650fde1688c5e896fbd0c6b | Python | 2,271 | 54 | #
# # Specifying node colormaps
#
# [Open interactive notebook in Binder](https://mybinder.org/v2/gh/wiheto/netplotbrain/main?filepath=docs/gallery/node_cmap.ipynb)
#
# See [example about colors for different way the color columns in the dataframe can be specified](https://www.netplotbrain.org/gallery/specifying_node... |
a7a02c44f7ee6b76f9be182430b4503e5a8e6027e10d54ce8e7f7fa724d687d6 | Python | 2,273 | 80 | """Utilities to handle checks and conversions between output formats of detectors."""
import numpy as np
import pandas as pd
def _convert_points_to_segments(points_df, len_X=None, include_labels=False):
"""Convert points-like output to segments-like output.
Parameters
----------
points_df : pd.DataF... |
9511974383ca8ab16412df8c862b4a6b81db948b184d0e07ae460bd6c6229608 | Python | 2,275 | 80 | import numpy as np
from .dataset import Dataset
class DataProvider(object):
"""DataProvider.
Args:
spec (dict):
dsets (list of Dataset): Datasets.
augs (Augment): Augment.
p (list of float): sampling weights.
"""
def __init__(self, spec):
self.spec = dict(spec... |
789869896a721b041f27ae647b054e7864f194bc8bf47ebedaf5d44ab5e86c91 | Python | 2,276 | 68 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
5782d1925a43cd5aa2f59d0c87c635df11c07a6759a2196c2af97ba3661f930b | Python | 2,277 | 66 | # Copyright 2023 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
7d0180287bf2ed31fd2c7165b725722130e72062e31ee713140091cc6770b010 | Python | 2,277 | 44 | import numpy as np
import pytest
import torch
from short2long.competitive_model import CompetitiveAllocationNet
from short2long.competitive_structure import annotation_terminals, representation_collisions
def test_endpoint_variants_share_chain_but_not_terminal_descriptors(tmp_path):
path = tmp_path / "example.gt... |
0f78affc03145afa3260a061ec2fc64ec08e1e5e2ab5296c2395de8d37ae3dd2 | Python | 2,278 | 73 |
# pylint: disable=redefined-builtin
# pylint: disable=missing-docstring
import json
from enum import Enum
class RuntimeType(Enum):
PYTHON = "python"
PYTHON2 = "python2"
PYTHON3 = "python3"
class Manifest(object):
"""
The main manifest object which gets written into the model archive as MANIFE... |
1bb4d230ad4a7e19bfcf79e191ac3caace94ec8cdc7eebc8abbce65b41145fdc | Python | 2,279 | 68 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
a776c3c9d23756202907281ef8cd5e0e6c54325acc2a83faac6c157ea2a85cdb | Python | 2,279 | 58 | # 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... |
f2664a2743b456db17da0f23b2023c90d603106b15c565d7b7048290739b20c5 | Python | 2,279 | 69 | # Copyright 2019 DeepMind Technologies Ltd. All rights reserved.
#
# 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 appl... |
2d915df2fa0621647483e393bc9760d0818db687a5745964f3e6ec16465c7b10 | Python | 2,282 | 67 | #! /usr/bin/env python
import os
import sys
import json
import glob
def main():
if len(sys.argv) != 3:
print('usage: {} <input dir> <output file>'.format(sys.argv[0]))
exit(1)
input_dir = sys.argv[1]
output_filename = sys.argv[2]
files = glob.glob(sys.argv[1] + '/*.json')
if len... |
b92031415a8cecd2093f12e2503ac7a5beec503564a90d414be73809632d8386 | Python | 2,283 | 69 | # -*- coding: utf-8 -*-
"""
Created on Thu December 10 11:41:02 2022
@author: Pawan Panwar, Quanpeng Yang, Ashlie Martini
PyL3dMD: Python LAMMPS 3D Molecular Dynamics/Descriptors
Copyright (C) 2022 Pawan Panwar, Quanpeng Yang, Ashlie Martini
This file is part of PyL3dMD.
PyL3dMD is free software: you ... |
018cd43c4143ed025be68cd9638b3bb6abfef6e4fbd8bb94cdecb022ea2d5d1d | Python | 2,284 | 55 | import numpy as np
import scipy.stats as stats
class StatisticalTester:
def __init__(self, standardSamples):
np.random.seed(123456)
self.standardSamples = []
for sample in standardSamples:
# self.standardSamples.append(sample)
# self.standardSamples.append(sample - ... |
2ccc7aaef0aee9622e54e05c5a4a88629129d8d1743f787780169e2e10733b88 | Python | 2,284 | 71 | # Copyright 2019 DeepMind Technologies Ltd. All rights reserved.
#
# 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 appl... |
7a73e9c4b4798a792e09a023ecdedb6e4cca349f50e0951affe7a35e1d2f7d16 | Python | 2,284 | 77 | import pytest
from unittest.mock import patch #, MagicMock
import tempfile
import numpy as np
import os
import seas
# create a temporary folder for test files
TEMP_FOLDER_HANDLE = tempfile.TemporaryDirectory()
TEMP_FOLDER = TEMP_FOLDER_HANDLE.name
test_video_shape = (10, 100, 100)
test_video = np.random.random((te... |
8b13e958ba6d29719648fb88d87265a978056a24b9766f3a645f122ad230971d | Python | 2,284 | 72 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import textwrap
from typing import Any
from onnx.reference.op_run import OpFunction, OpRun
from onnx.reference.ops._helpers import build_registered_operators_any_domain
from onnx.reference.ops.experimen... |
9a82d4dfe374530cda45d80243c714a1e17a577eb9c759fd5a7a6f79c46c6c46 | Python | 2,285 | 78 | """Simple ClaSP test."""
__author__ = ["patrickzib"]
__all__ = []
import pytest
from sktime.datasets import load_gun_point_segmentation
from sktime.detection.clasp import ClaSPSegmentation
from sktime.tests.test_switch import run_test_for_class
@pytest.mark.skipif(
not run_test_for_class(ClaSPSegmentation),
... |
d8e7887e6299f6fa86b5863a3b504d3093e5ba045b748393c1a0f7f64214424d | Python | 2,286 | 68 | """cbam.py"""
"""
Ref: https://github.com/luuuyi/CBAM.PyTorch/blob/master/model/resnet_cbam.py
Author: Yimin Yang
Last revision date: Jan 18, 2022
Function: Add CBAM to raw TransUNet
"""
import torch
import torch.nn as nn
class Flatten(nn.Module):
def forward(self, x):
return x.view(x.size(0), -1)
clas... |
bffaaf6d25b6c4cb3492c03a7687b88ae1019a5574d708fcdc65606cfa7abea0 | Python | 2,287 | 62 | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... |
d1d8c48114fadbcde4debb3d936fecabb7aa3690c037115c417689b485279060 | Python | 2,287 | 78 | import torch
from torch.autograd import Variable
from .text_handler import TextHandler
from torchtext.data.utils import ngrams_iterator
class TextClassifier(TextHandler):
"""
TextClassifier handler class. This handler takes a text (string) and
as input and returns the classification text based on the mode... |
f567291ba1d391043663dd8e1a4d4b429c8cd72450ea8c5de91832cc4e2cb607 | Python | 2,289 | 66 | from typing import Any
from flair.embeddings import (
DocumentCNNEmbeddings,
DocumentLMEmbeddings,
DocumentPoolEmbeddings,
DocumentRNNEmbeddings,
FlairEmbeddings,
TokenEmbeddings,
WordEmbeddings,
)
from tests.embedding_test_utils import BaseEmbeddingsTest
word: TokenEmbeddings = WordEmbedd... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.