sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
cede517fc093e2b1de1c0f56910ebece36090eda601532d0e2108933a43a38d9 | Python | 1,978 | 49 | import numpy as np
import os
import torch
from tqdm import tqdm
from atom3d.util.transforms import prot_graph_transform
from atom3d.datasets import LMDBDataset
from torch_geometric.data import Data, Dataset, DataLoader
class GNNTransformPSR(object):
def __init__(self):
pass
def __call__(self, item... |
037df9966601409860e171f505b5247cb27ead2cd4a3c7c45161a535fbd6555c | Python | 1,979 | 55 | # SPDX-License-Identifier: LGPL-3.0-or-later
from typing import (
Any,
)
import torch
from deepmd.dpmodel.long_range.kernel import LESKernel as LESKernelDP
from deepmd.dpmodel.long_range.kernel import SOGKernel as SOGKernelDP
from deepmd.pt_expt.common import (
register_dpmodel_mapping,
to_torch_array,
)
... |
54509bbce079c3cda2334f2a6cd5b23579f98578728e0a410f85fead4e95ab25 | Python | 1,979 | 82 | """
Plot soma-dendrite area and some other parts for a supplemental figure.
This module is part of *vcnmodel*.
Support::
NIH grants:
DC R01 DC015901 (Spirou, Manis, Ellisman),
DC R01 DC004551 (Manis, 2013-2019, Early development)
DC R01 DC019053 (Manis, 2020-2025, Later development)
Copyright 2017-2... |
099b1b711c8ca3ea08a5a5dc52ba85b79960c0ee4f5c0396c8a93d18c65239e8 | Python | 1,980 | 69 | # 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 StringConcat(Base):
@staticmethod
def export() -> None:
... |
83e13ef9ccc624a790cd8f5489581a98b03243f896426c12e5755d10d5a0c36d | Python | 1,980 | 54 | import pytest
from flair.data import Dictionary, Sentence
from flair.embeddings import TransformerDocumentEmbeddings
from flair.models import TextClassifier
from flair.nn import Classifier
from tests.embedding_test_utils import BaseEmbeddingsTest
class TestTransformerDocumentEmbeddings(BaseEmbeddingsTest):
embed... |
cb64cb365b94ea85df88d2031f6cebab6c16e83209762787aa8271888ef66d9d | Python | 1,982 | 56 | #-------------------------------------------------------------------------------
# test/utils.py
#
# Some common utils for tests
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
import os
import subprocess
import sy... |
60653a0dead3c01d3d92ebcc5de04f320bbc41ec2c5284559996e9f7841c7163 | Python | 1,985 | 68 | from __future__ import annotations
from pathlib import Path
from graynet import config_graynet as cfg
from graynet.domain import AtlasInfo
from graynet.parcellate import roi_labels_centroids
from graynet.utils import check_atlas
from graynet.volumetric import volumetric_roi_info
def format_node_label(node) -> str:
... |
94b01ea130e643ce31ed74dba4f24a38d6b42a4b85e5004e76ee8ea91901c412 | Python | 1,987 | 51 | import csv
def make_csv_file(eval_file_path, header_row):
"""
Creates a new CSV file at the specified path with the given header row.
Parameters:
eval_file_path (str): The path where the CSV file will be created.
header_row (list): A list containing the column headers for the CSV f... |
57a21243a7b19bcdfdbdd173609e03947b5278f615be912eb8a0f01787808dd7 | Python | 1,988 | 58 | import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
sns.set(style='white')
def matrix_scatterplot(M, xticklabels, yticklabels, xlabel='', ylabel='', mc='dodgerblue', fig_width=10, fig_height=14, scale_factor=10.0, **kwargs):
"""Plots a matrix with points as in a scatterplot. Area of points p... |
0eca9b2a2d8b584b04bacc029aa16253f261aff69096a775bbc10e448e7459ce | Python | 1,990 | 51 | # Import required code for visualizing example models
from fooof import FOOOF
import scipy.io as spio
import numpy as np
import matplotlib.pyplot as plt
import math
# import data from MATLAB
mat = spio.loadmat('D:\\Workspace\\EEG_Data\\data\\fft_data_60s.mat', squeeze_me=True)
# index start from 0 in python... |
68aed0cc5172c8a24d686201c871b1cb7666718d7741982b8d48efc2168c135c | Python | 1,990 | 90 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 15 16:01:47 2022
@author: sudhanshu
"""
import numpy as np
import os
import shutil
train_percent = 72
val_percent = 8 #(of 80)
test_percent = 20
# np.random.seed(3123)
uniq_pdbs = "../pdb_chains/dataset/dataset_voxel/uniq_pdb_chains.txt"
randomiz... |
0b2ab8053a012cb0a85ac8255d602d788c0448cee14635d4569853d6fb33f3bb | Python | 1,991 | 51 | # 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... |
ee7ec87abe935157ab3b12f09dd4c20ecf528890e3451b32e963253d8a54c4b6 | Python | 1,992 | 58 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
def _gather_nd_impl(
data: np.ndarray, indices: np.ndarray, batch_dims: int
) -> tuple[np.ndarray]:
# Note the data rank - will be re... |
a9eb30162db17144529c2cd94c9dd8605edd90a1bcfb2380d27e6f5fc447cb4f | Python | 1,995 | 60 | import pytest
import torch.cuda
from vp_suite.models import MODEL_CLASSES
from vp_suite.base import VPModel
IMG_SHAPE = (3, 64, 64)
ACTION_SIZE = 3
TEMPORAL_DIM = 3
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
# model input shapes
b = 2 # batch_size
c, h, w = IMG_SHAPE
p = 5 # pred_frames
@pytest.mark... |
5194af35cd4c20ae8887988d6ad2d1ffc1b3ee92e3669b02c85b10d9d2dab517 | Python | 1,997 | 57 | # Copyright 2020 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... |
0a98d7cf2aae658832a16db951107c16210cc86615d18c40ef859eabc4d5b69b | Python | 1,998 | 52 | from __future__ import division
import mkl
mkl.set_num_threads(1)
import sys
from SPHARM.lib import plotting as plt
gridsize = 120
#################################
args = sys.argv[1:]
if len(args) > 0:
path = args[0]
if path != 'test':
if not path.endswith('/'):
path += '/'
p... |
9b99d4aecdae794cd7da5586520f1c0093384ab4e0444d59430ccc0232993477 | Python | 2,000 | 67 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from onmt.utils.logging import init_logger
from onmt.utils.misc import split_corpus
from onmt.translate.translator import build_translator
import onmt.opts as opts
from onmt.utils.parse import ArgumentParser
import numpy as np
def... |
7c3dacfb2b37fc88df4c12a421274a6a76208aa13b82dda092f88fe8569aed0c | Python | 2,004 | 81 | import os
from tqdm import tqdm
import argparse
import numpy as np
import cv2
from PIL import Image
from pycocotools.coco import COCO
# Give color values in BGR order
KIT_ID, KIT_COLOR = 0, (0, 0, 255) # RED
MEMBRANE_ID, MEMBRANE_COLOR = 1, (0, 255, 0) # GREEN
BACKGROUND_COLOR = (255, 0, 0) # BLUE
parser = argparse... |
eea4ee58f3eacb6ca3b3bd0bf4d9dd69f251eb27903e177da014ad5167d9e25b | Python | 2,005 | 59 | import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
sns.set(style='white')
def matrix_scatterplot(M, xticklabels, yticklabels, xlabel='', ylabel='', mc='dodgerblue', fig_width=10, fig_height=14, scale_factor=10.0, **kwargs):
"""Plots a matrix with points as in a scatterplot. Area of points p... |
d989b76ea31a3c71a494397d7b0fb12ff78c51f9b8d02cd9f9afee7f88163016 | Python | 2,006 | 68 | # SPDX-License-Identifier: LGPL-3.0-or-later
from collections.abc import (
Callable,
)
from deepmd.pt.model.descriptor.base_descriptor import (
BaseDescriptor,
)
from deepmd.utils.data_system import (
DeepmdDataSystem,
)
class DPModelCommon:
"""A base class to implement common methods for all the Mo... |
0911df985a01952f5262972e36abcec3f664681436517d1cba396a41ba26a8ae | Python | 2,008 | 45 | #=======================================================================================================================
# Copyright (C) 2021 Matvey Safroshkin, Grigory Arutyunov, Patrick Mueller
# Computer Vision Studio
# Friedrich Miescher Laboratory of the Max Planck Society
# Systems Biology of Development, Univers... |
7368e1c509715e1f1fc15ac6ee49e153604538696dba24a5a97df7a2f40a4d4c | Python | 2,008 | 51 | import numpy as np
from collections import defaultdict
from helper_functions import sortby, make_callability_from_bed, Make_folder_if_not_exists
def make_mutation_rate(freqfile, outfile, callablefile, window_size):
snps_counts_window = defaultdict(lambda: defaultdict(int))
with open(freqfile) as data:
... |
6883e2ee8d7e3a945c017407cb4eb2f09e788640da4ba436c29d7a3fc3fa1300 | Python | 2,009 | 74 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 10 14:40:22 2022
This code can be used to filter down all Rosetta Readable pdb files.
It runs on the given directory and moves all unreadable files to
./unread/.
last update 3/6/2023
@author: sudhanshu
"""
import os
from pyrosetta import *
from p... |
1b7b8863e6c1264cf9d2698208aa8ca3db74535ef4973821f088102783f3c18d | Python | 2,010 | 58 | # 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 InstanceNormalization(Base):
@staticmethod
def export() -> Non... |
fadfcfc9fafc283bec0c176ad18de7f75e59a5974c23d394bcd608cd80ae5c55 | Python | 2,010 | 52 | from networkunit.tests.two_sample_test import two_sample_test
from networkunit.capabilities.ProducesSpikeTrains import ProducesSpikeTrains
from quantities import ms
from elephant.conversion import BinnedSpikeTrain
from elephant.spike_train_correlation import spike_train_timescale as timescale
import numpy as np
from ne... |
edccfd5dd792a0d6a2bb1ec9e78634f570aebf38c958cf36589ae27ac575a093 | Python | 2,012 | 54 | # 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... |
492a41590896f2e08ec0cc9658ed6b017671d5d5c30760ad9b816cc9ad91344f | Python | 2,013 | 54 | import unittest
import numpy as np
import sys
sys.path.append("..")
import pyfilterbank.sosfiltering as sf
import pyfilterbank.butterworth as bw
class ButterSosTestCase(unittest.TestCase):
def setUp(self):
self.types = 'lowpass', 'highpass', 'bandpass', 'bandstop'
self.sample_rate = 44100
... |
ab48926999c0507f0375b703bb8f263a5001c2d71a7a9608ccd56ab68a01df54 | Python | 2,013 | 68 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 8 13:15:21 2019
@author: wanglab
"""
#in python 3!!
import os, numpy as np, multiprocessing as mp
from skimage.external import tifffile
from skimage import filters
from utils.io import listdirfull
def otsu_par(saveLocation, otsufld, guassian_sig... |
e6c9186092804e71544183d6d9706f41dc4cf3ff576ba1fad677592b83b87137 | Python | 2,014 | 64 | #transfer from PNI scratch to tigress using globus https://app.globus.org/file-manager
import os
from utils.io import make_inference_output_folder
inn = "/jukebox/scratch/zmd/"
out = "/scratch/gpfs/zmd/"
logs = os.path.join(out, "logs")
if not os.path.exists(logs): os.mkdir(logs)
repo = "/tigress/zmd/3dunet"
slurm_scri... |
bb41bdf433883380e291adfca3a1e7600e35d6ef21381579d4b0539bbf7f006f | Python | 2,015 | 62 | # 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... |
2d01a683150bf8d9ef60db7529df7a878d767fc654dce14db78d9c21884c3b70 | Python | 2,017 | 52 | from pathlib import Path
from unittest import mock
import urllib.request
import pytest
from genomic_benchmarks.loc2seq.loc2seq import CLOUD_CACHE, download_from_cloud_cache
def test_download_from_cloud_cache_fails_for_unknown_key():
with pytest.raises(ValueError):
download_from_cloud_cache(file_key='unkn... |
566dc1f3e9bca23317fe3da3611732080aa77df08021c441a60b892c597f9894 | Python | 2,018 | 60 | """Tecator dataset."""
from sktime.datasets._single_problem_loaders import load_tecator
from sktime.datasets.regression._base import _RegressionDatasetFromLoader
__all__ = ["Tecator"]
class Tecator(_RegressionDatasetFromLoader):
"""Load the Tecator time series regression problem.
Returns
-------
X:... |
b9722f800739919c1f4152c4ba18d6c90280c32b9cd9b823eb9ba1642615fb49 | Python | 2,018 | 40 | # 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... |
2df7bebd7ce76faa01602db22876d8284476c368d6e3f4555a508b4d704bac50 | Python | 2,022 | 53 | import pytest
import importlib
from pyontutils.core import OntConjunctiveGraph
from .common import skipif_no_net, log, testing_base, _TestNeuronsBase
class TestNeurdf(_TestNeuronsBase):
@pytest.mark.skipif(not importlib.find_loader('neurondm.compiled'), reason='no compiled sources')
def test_models(self, deb... |
557df37e8b513e075ec42c9bff246cf8199ffdee128c65334d6d687d83f382bc | Python | 2,023 | 55 | import shutil
import unittest
import augpathlib as aug
#import sys
#import pudb
#sys.breakpointhook = pudb.set_trace
# TestRoundtrip by itself is not sufficient to induce the cross module version
#from test.test_neurons import TestRoundtrip # for now comment this out due to issue in test_ttl_simple
from .common impor... |
7f13a61190e7ea6357468c15458880837f6c9a793589fc0942426ef593ae97fa | Python | 2,023 | 69 | # 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... |
11548f6a96698341ad4c09ac4441bee288eb43ba307d1e6fba21f5d6ee6e12ec | Python | 2,024 | 65 | # -*- encoding: utf-8 -*-
import pytest
import sys
from cnmodel import data
table = u"""
Description of data
It has multiple lines
And empty lines.
-------------------------------------------------------------------------------
col1 col2 col3
param1 15±6.5 [1] 2.2±1.5 [2] 0.87±0... |
de8f23cfa5d0c8aadb010f82f2699c3f129ad11e5af75e6eb95e9dab2c5ab087 | Python | 2,024 | 70 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 19 14:25:36 2022
@author: nagehan
"""
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
x = np.linspace(0,3.3,10)
y = x
plt.plot(x, y, '--', color='lightgray', zorder=1)
plt.ylim(1.2,3.3)
plt.xlim(1.2,3.3)
# Tufted capuchin
... |
7c19ff63aeed8f1079924f20831d8f62116efc9975250946a849b2d6dca17ebf | Python | 2,028 | 47 | 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"
df_demo = pd.read_csv("time_samplegroup_KO/d50_engineered_Cre_vs_Flp.txt", sep = "\t", header = 0, index_col = 0)
df_deg_values = pd.Data... |
45f41f32f2236a0791210f08b2aa559d7e5703f70c93698dfef6cdf73a1fb429 | Python | 2,031 | 62 | # -*- coding: utf-8 -*-
#
# Copyright © 2023 Charles E. Vejnar
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://www.mozilla.org/MPL/2.0/.
#
import logging
import os
import subprocess
fun... |
aea3650059a8ae12e6ca54931328ca685ac47ba6e4d8a5faffe3a7623fb791c3 | Python | 2,031 | 45 | from joblib import Parallel, delayed
import pandas as pd
import os
from expert.src.utils import read_input_list, runid_from_taxassign, format_sample_info # biome, meta, desc
from expert.src.resources import MGnify
from tqdm import tqdm, trange
from functools import reduce
import urllib.request
def download(... |
d15a4d57fefa39af6b7c038f82108d920e0b16788c812fb0faebb13286719623 | Python | 2,031 | 73 | # 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
#
# ... |
e931b948641133fb81926b13b098d050c8fa6f7ad2b13df257196ddff4010e71 | Python | 2,032 | 56 | # 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... |
41fc2235794e04c7f47ebe61367758a88288d2173ec94c244843b2127d3380eb | Python | 2,033 | 83 | import socket
import pickle
"""
Send and receive arbitrary python objects with sockets without having to worry about transport protocol
https://pythonprogramming.net/pickle-objects-sockets-tutorial-python-3/
"""
HEADER_SIZE = 10
import time
def listen_and_accept_connection(port):
s = socket.socket(socket.AF_INE... |
abc5f4567fa4f68a453ac1abf59beadd2387dc51102f7a5bd83da7d5b0e31baa | Python | 2,033 | 84 | """!
@file config.py
Sets the parameters for configuration
"""
import SimpleITK as sitk
import os
from enum import Enum
#Insert the paths to your folders here
path_fixed = ""
path_moving = ""
path_seg_fixed = ""
path_seg_moving = ""
path_result = ""
path_pretrained = ""
experiment_name = "T_BenchmarkCNN/"
logs_path ... |
15204070b047a992bb361764f1972935a2658bda8deb8d89986e77163c3212f6 | Python | 2,035 | 63 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
"""Check that NOTICE matches the dependency metadata in sbom.cdx.json.
NOTICE is the third-party attribution shipped inside the wheels, so its
versions and licenses have to follow the dependencies CMake actually builds.
"""
from __futur... |
15f12ceb45fadcd6dc3a2fd0844b676e3d7853f543a50bc92299aa01ee9a3159 | Python | 2,035 | 53 | # 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... |
969bedb447772ab5587cc2f9257240d5289f45faaef488f1947a90f07366aeef | Python | 2,036 | 72 | import os
import random
import numpy as np
import tensorflow as tf
def is_cuda_available():
return tf.test.is_gpu_available(cuda_only=True)
def set_seed(seed):
"""
Referred from:
- https://stackoverflow.com/questions/38469632/tensorflow-non-repeatable-results
"""
# Reproducibility
random... |
db0fb3043f033c254b75a0f043d356c3a5c6b08f7f1afb6d4f24e832918f492c | Python | 2,036 | 55 | # 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... |
f93709c5271d672dc98aecbebc6b8b67e9280ad49c6505975d8e17c3475c8d2f | Python | 2,036 | 66 | """
@file: cross_entropy.py
Created on 16.11.19
@project: CrazyAra
@author: queensgambit
Definition of Cross-Entropy-Loss with non-sparse targets.
The default SoftmaxOutputLayer() only supports one-hot encoded labels.
The target definition distribution is meant to have values in [0,1].
This operator has no effect in t... |
3eac755f8cf8ceaf627982d0a5f594cea77df472390e7c22d0c54ac015e64f41 | Python | 2,037 | 61 | # SPDX-License-Identifier: LGPL-3.0-or-later
from typing import (
Any,
)
from paddle.io import (
Dataset,
)
from deepmd.pd.utils.env import (
NUM_WORKERS,
)
from deepmd.utils.data import (
DataRequirementItem,
DeepmdData,
)
class DeepmdDataSetForLoader(Dataset):
def __init__(self, system: ... |
7a47f313ff52719ccc91831d82951c6ef2fe6119c2768a184011be40d00a334e | Python | 2,037 | 63 | # 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... |
b3e1e4c48e25b8a6e4f210e931587c5c67f73a574770262efc30137e105c7dae | Python | 2,037 | 57 | # 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... |
19f30266592563dcb0c3001fdec87fc9414fb1eba6e9f19d67c0491175c957cb | Python | 2,040 | 62 | # 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 MatMul(Base):
@staticmethod
def export() -> None:
node... |
b52875c4fbd5653b7242f37de67c936b1cb8d5b6b5cfaeded34a480fd5c041eb | Python | 2,040 | 60 | # ----------------------------------------------------------------------------
# Copyright (c) 2017-2026, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
d4ba761fe3717eb729fd6f9938e68cfb093039418e228e465c4c9384c2404d6b | Python | 2,040 | 57 |
import os
import sys
import stat
from os.path import join as pjoin, exists as pexists, realpath
import numpy as np
from pyradigm import MLDataset
from graynet.utils import import_features
from neuropredict.run_workflow import get_metadata
import traceback
base_dir = '/u1/work/hpc3194'
features_freesurfer = ['freesur... |
2025d21efba91f44f3b879fa5a77cd4d49534df7d29ceedc5ef25994dc7d1d13 | Python | 2,041 | 58 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops._op import OpRunReduceNumpy
def compute_log_sum_exp(data, axes, keepdims):
dtype = data.dtype
if dtype == np.float16:
# The exponential sum c... |
0a16b8d380e65a14369bbe0382b3731f5218dc54197a75ddd5d8e0e4d5dce3fd | Python | 2,043 | 64 | # 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... |
58d75607d934ab0d3a183a8498efebf03cf0c3c6cac2c02e5bf9fdfc4ae621e1 | Python | 2,043 | 55 | # 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
#
# ... |
0ef7e9ec25c68d673e8f1fc2cf8ba7aef4e3b0c67b3929545c40dcb784ba1641 | Python | 2,044 | 73 | import torch
def adapt_var_list(var, num_cg_levels):
"""
Adapt variables to a list of length num_cg_levels.
- If type(var) is float or int, adapt it to [var] * num_cg_levels.
- If type(var) is list, adapt the length to num_cg_levels.
Inputs
-----
var : list, int, or float
The vari... |
236678df08a387d521d1c6863c76a1339eeca06213b3359a0fbee2000cb423ff | Python | 2,044 | 66 | # 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
from onnx.backend.test.case.utils import all_numeric_dtypes
class Max(Base):... |
38e2377a26af781a76eaa5df824df2f3dd41f5aa9277d02f4742d2750a7fd9c3 | Python | 2,044 | 66 | # 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
from onnx.backend.test.case.utils import all_numeric_dtypes
class Min(Base):... |
3a63ac621f7f97b6895c4536887b9bd7b0b849a64f668e75346e9da592a4ea94 | Python | 2,044 | 42 | preset_parameters = {}
# Define registration parameter presets.
preset_parameters.update({'identity' : dict(translational_stepsize=0, linear_stepsize=0, deformative_stepsize=0, sigma_regularization=0, num_affine_only_iterations=0, num_iterations=1)})
preset_parameters.update({'clarity, mouse' : d... |
9ef5b2eb5c891605fd918bb50341a6a10750e26f4ba46029530e7fdb5caa69f6 | Python | 2,046 | 74 |
from __future__ import annotations
from dataclasses import dataclass
from typing import ClassVar, cast
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
import numpy as np
from pandas import DataFrame
from seaborn._core.scales import Scale
from seaborn._core.groupby im... |
05671f97858c2a7addcc3dcc68cfce8216589744a90b0248b060f0a6705af61a | Python | 2,048 | 53 | import os
import subprocess
from os.path import join as pjoin
from tqdm import tqdm
#%%
ncpu = input('Cpu num:')
sub_id = input('Sub ID(split by space):')
#start = input('Start index:')
#end = input('End index:')
# %%
# input path includes all subject folds
input_path = '/nfs/z1/zhenlab/BrainImageNet/action/data/bol... |
1a76a49c74e48314a166f4289022c528bab8d153ff27db77290405d9e2c48429 | Python | 2,048 | 64 | '''
@author: Nicholas Browning
'''
from __future__ import print_function
# module load anaconda/4.3.1
# module load openbabel/2.3.2/gcc-4.9.2
# export PYTHONPATH=$PYTHONPATH:/path/to/GABio/src
# CALL ME LIKE THIS: python mutate_protein.py -molecule gpgg.pdb -rotamer_path /lcbcdata/nbrownin/Rotamers_mol2/LYS/K14.mol2 -... |
05bf04f20510a72af6fa5b397291fbcb2aa29bab55e47abcf4a22ed8df3f9603 | Python | 2,051 | 47 | import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
from scipy.spatial import Delaunay
# plotgiiSurf(GIImesh['giiSurface_Both'][0,0], surfvalDisp, viewE, viewA, viewR, cRange, 0, 5, currAx)
def plotgiiSurf(giiSurf, valDisp, viewE, viewA, viewR, cRange, flipCmap, cmapType, currAx,... |
49342374c15e6b2ef0070d2ecf5466aaea276c960be0cede4e0e4b0b7a68dc39 | Python | 2,052 | 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... |
d9fecdb71b53a0ec32c9d9f2e01ccaf192776223644f5768caaad757be833d14 | Python | 2,052 | 57 | #!/usr/bin/env python3
from pyontutils.config import auth
""" Synchronize KnowledgeSpace definitions to the ontology
"""
import os
from glob import glob
from pathlib import Path
from rdflib import Literal
from pyontutils.core import Ont, Source, build
from pyontutils.namespaces import makePrefixes
from pyontutils.clos... |
04bbd0842b87373046ddc2a72c6651c7f161a6163a5ed707b03338fe82c38b13 | Python | 2,053 | 74 | """
Test connection between two cell populations.
Usage: python test_populations.py <pre_celltype> <post_celltype>
This script:
1. Creates two cell populations (pop1 and pop2)
2. Connects pop1 => pop2
3. Instantiates a single cell in pop2
4. Automatically generates presynaptic cells and synapses from pop1
5. Stimul... |
63b84ffd0aaf5dc17de522ae05973ceaaa26ab4b907541503f694122f1648dbf | Python | 2,056 | 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... |
bf6a43c65134e3a34ef13d0b7fd1f78decc3829bc185e7ce509236db8cf1c94f | Python | 2,056 | 66 | # Copyright 2019-2020 The ASReview 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 appl... |
c036bfcc1f31a37f30dfa7bc143bfe1b67ed810f197c82097c2ab2d7926f0948 | Python | 2,057 | 58 | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
# import torch.nn.functional as F
from torch.autograd import Variable
class ShakeDropFunction(torch.autograd.Function):
@staticmethod
def forward(ctx, x, training=True, p_drop=0.5, alpha_range=[-1, 1]):
if training:
gate = torch.cu... |
eb0853dbaa91660c2b682ee5f6c124d0967cfaa58307ea7c097896a24eb29593 | Python | 2,058 | 82 | import os
import pytest
import tempfile
import pandas as pd
from scipy.sparse import load_npz
from pciSeq.src.core.utils import load_from_url
from utils import setup_logger
conftest_logger = setup_logger(__name__)
bbox = [
(4238, 364), # bottomleft, [x0, y0]
(5160, 933) # topright, [x1, y1]
]
def pytest_c... |
0e08fae7fc4e62a7cf3f9f63592becd9b49fcb2519be2529796d2df896729d63 | Python | 2,059 | 79 | # 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... |
b40b9cf98d79e16befc7ea1b5dc232449d799cd43e76aaf4f30c16b755056725 | Python | 2,059 | 90 | # -*- coding: utf-8 -*-
"""
Demonstration of SFA and the other algorithms using illustrative example from
Bellec et al. 2015 paper on SFA and STDP kernels.
Creates input signal, runs selected method, and then plots original input signal
and three features of selected method.
When applying linear SFA should see the ... |
4065cd1c0319230f701da9cdad1dc40e9eb133ff19fb4292af5b6d750f70510e | Python | 2,060 | 57 | """
Various Utility functions used when creating/simulating the various backends.
"""
import matplotlib.pyplot as plt
import torch
def send_vars(variables, device):
"""
Send a set of variables to a specific device. Used with PyTorch backends.
:param variables: Variables to send.
:type variables: ... |
78407e48e9bffdd0f6b042acf8e72110776caf920a1dd2eadea0ac57e35f2b90 | Python | 2,062 | 62 | """Isolated numba imports for _lcss."""
__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 Nu... |
0dbfb16ece732a884ebafcaf3de490c7acb3083bb23aa65595cfb75cafa8bfcc | Python | 2,063 | 49 | import numpy as np
import os
import torch
from tqdm import tqdm
from atom3d.util.transforms import prot_graph_transform
from atom3d.datasets import LMDBDataset
from torch_geometric.data import Data, Dataset, DataLoader
class GNNTransformRSR(object):
def __init__(self):
pass
def __call__(self, item... |
13f64d20edb141de3076b52e0d461d60cbabafd445dec7dcdf3bc94babbc1077 | Python | 2,064 | 52 | # 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... |
2fb94d8a52b6c59932bcdfb4bf131a3aede37da7b9348b02cbd7ff3c7e10e57e | Python | 2,064 | 59 | import numpy as np
#import matplotlib
# Force matplotlib to not use any Xwindows backend.
#matplotlib.use('Agg')
import matplotlib.pyplot as plt
#==============================================================================
class covar_pdf_ei:
"""
Plots the probability density distributions of prediction and... |
d35824040344c4efb34f6d69ba98b547110cea351b39b745d13bb22ceb6c9341 | Python | 2,064 | 70 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import math
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class LRN(Base):
@staticmethod
def export() -> None:
... |
8509b16a67a469019a3ff5059a5a00f8962fa5698c296ec87fb9aaa12fb8c05d | Python | 2,065 | 69 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 9 10:59:42 2017
@author: tpisano
"""
#RL deconvolution
#http://scikit-image.org/docs/dev/auto_examples/filters/plot_deconvolution.html
pth = '/home/wanglab/wang/pisano/Python/psf_for_deconvolution/psf_001na_650_665_5umx3um_lswidth15um.h5'
import h... |
a4afb0b4e02522a9268abfb1c70b4d376741434d496ba165b8bae0b8962e1ee8 | Python | 2,065 | 65 | # 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... |
b134f823abc2ac257dfad09c59694fd4a089dd27574cf59e94db82f7c1753300 | Python | 2,065 | 68 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
# Ported from skchange (BSD-3-Clause), original authors: Tveten
"""Direct L2 saving for a zero-valued baseline mean."""
__author__ = ["Tveten"]
from sktime.detection._utils import col_cumsum
from sktime.detection.base._base_interval_scorer impor... |
3665e5c76a211641ae8aaf32fed2b2317cfd80a529b2a73f9d1c07edfbc4583c | Python | 2,068 | 46 | #!/usr/bin/env python
import pandas as pd
def reciprocal_best_permissive_blastp_or_diamond_blastp(
x_to_y_blastp_results, y_to_x_blastp_results, outfile):
"""
This function finds reciprocal best blastp hits between two samples.
The input is a blastp results file where x was blasted against y,
... |
9a5fe6f7b1827e1ece8205e306a5a98731fc4460f44554eb363446ff480c732d | Python | 2,068 | 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... |
f48bcb1156b82ba5d9a66a6784dfb5385289665036715fb3c7ad184f43cb713e | Python | 2,068 | 58 | import logging
import click
from src.definitions import RAW_DATA_DIR, PROCESSED_DATA_DIR
import src.data.preprocess_data as prep
@click.command()
@click.option('--select-one-child-per-family',
help='Whether to randomly select only one child per family.',
is_flag=True)
@click.option('--seed... |
4118fdc8f38b88461d4eb48b7019ba3ee3e3e5d8499e9976957c1788ab0aa6ca | Python | 2,070 | 50 | """
Test that elftools does not fail to load debug symbol ELF files
"""
import os
import unittest
from elftools.dwarf.callframe import ZERO
from elftools.elf.elffile import DynamicSection, ELFFile
class TestDBGFile(unittest.TestCase):
def test_dynamic_segment(self):
""" Test that the degenerate case for ... |
ede14770cb605c50f081652b4d80056b98deb6f2bf7c1c2a810dbf56ffe21af5 | Python | 2,071 | 83 | import numpy as np
from scipy import interpolate
from Historia.shared.constants import RESOURCES_HEADERS_DIR, posix_path
def init_header(rat, n_stims, filename):
default_header_file = posix_path(
RESOURCES_HEADERS_DIR, f"{rat}/MeshFlatBase.in"
)
with open(default_header_file, "r") as f:
w... |
0d254c72c234879099e031d453d95fae4bcb23db3cb7f4e245314c0b154119cf | Python | 2,072 | 61 | import pandas as pd
import atom3d.datasets as da
import atom3d.filters.filters as filters
import atom3d.filters.pdb as pdb
dataset = da.load_dataset('tests/test_data/lmdb', 'lmdb')
PDB_ENTRY_TYPE_FILE = 'atom3d/data/metadata/pdb_entry_type.txt'
RESOLUTION_FILE = 'atom3d/data/metadata/resolu.idx'
def test_size_filt... |
b1ba4553b91bceab6252de97824a7ece4b66d9f2a044fe01a6b366508564acca | Python | 2,072 | 66 | """Tests for bycycle.group.utils."""
import pytest
import numpy as np
from bycycle.group.utils import progress_bar, check_kwargs_shape
###################################################################################################
#################################################################################... |
e38d5f7e6cb3ee8e937a5148e8c2c0c534eb9190caf47eaa20564356ebaca0d3 | Python | 2,072 | 61 | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmcls.models.backbones import ResNeXt
from mmcls.models.backbones.resnext import Bottleneck as BottleneckX
def test_bottleneck():
with pytest.raises(AssertionError):
# Style must be in ['pytorch', 'caffe']
BottleneckX... |
7ea77af7c6627254192e6745ebbd301d187fc4cf2dc2a48ade5c8637fecee086 | Python | 2,074 | 71 | """Tests for bcblib.imaging.orient."""
import numpy as np
import nibabel as nib
import pytest
from bcblib.imaging.orient import get_orientation, reorient_to_standard, set_orientation, swap_dimensions
def _make_nii(shape=(4, 5, 6)):
data = np.arange(np.prod(shape), dtype=np.float64).reshape(shape)
return nib... |
9f7dd4c3e639c0cf99f82670d8148b20a5f22c72ef4704c46647c03a1cbd4fb4 | Python | 2,076 | 64 | # 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... |
a7c66b3ec6b4c66a07531745376c210838432162ee3b4bce129521d4e22242e4 | Python | 2,077 | 75 | """Deep learning based classifiers."""
__all__ = [
"CNNClassifier",
"CNNClassifierTorch",
"CNTCClassifier",
"CNTCClassifierTorch",
"FCNClassifier",
"FCNClassifierTorch",
"InceptionTimeClassifier",
"InceptionTimeClassifierTorch",
"LSTMFCNClassifier",
"MACNNClassifier",
"MACNN... |
2baa2869efda721bd0d3f996e93dc99f4a32070bfbe5cd7dee17a004dbc2940c | Python | 2,078 | 77 | """Shared pytest fixtures for odp.
These paths replace the ad-hoc sys.path.insert dance in test files. Any
test that needs to import a module from `source/`, `scripts/`, or
`dependencies/afp.py` should depend on the matching fixture (which
also prepends to sys.path the first time it is resolved).
"""
from __future__ i... |
d76c41431719ef4ddd9053585a4e67ee29b2692516c22d98b0eeb02c9c2d0084 | Python | 2,078 | 59 | # Copyright 2022 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... |
6a5d6069b02e6bce0df86f13da49f36d513c850559d213f9012568eec4e7e51c | Python | 2,080 | 66 | # 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... |
0aee571a06628813b10d8cffe67d7c7d48c7013642f6aa958d9414c46f7cc96f | Python | 2,082 | 70 | import numpy
def ks_stat(data1, data2):
data1, data2 = map(numpy.asarray, (data1, data2))
n1 = data1.shape[0]
n2 = data2.shape[0]
n1 = len(data1)
n2 = len(data2)
data1 = numpy.sort(data1)
data2 = numpy.sort(data2)
data_all = numpy.concatenate([data1,data2])
cdf1 = numpy.searchsorted... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.