sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
4b3dd8c0176cf56efba03a5b6f21523ec83ef1e583db7a86724fa6739a3e71e2 | Python | 2,083 | 76 | # 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... |
8725f9beb7ca951020d74d919cd7268aed2a12bd68eb850b496f14ede40b3c27 | Python | 2,083 | 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... |
ba5f364d064050b76ea6be2d2410027648e51e6da6b7c2c9f54a703561876211 | Python | 2,083 | 87 | # 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... |
b74ba6f93846f45437da2dfcd9b4e141cc0baf5fcda20ac793d0fb713bc90be3 | Python | 2,084 | 65 | import numpy as np
import torch
import cv2
import os
import pandas as pd
import argparse
from glob import glob
from lib.model import RiceYieldCNN
from torch.utils.data.sampler import RandomSampler
parser = argparse.ArgumentParser()
parser.add_argument('--checkpoint_path', type=str, required=True)
parser.add_argument("... |
de93e14a4868cc5573c2447dc01b471380545f0562cb92ed4da12940e9038a77 | Python | 2,084 | 65 | import io
from PIL import Image
from torchvision import transforms as T
from torch.autograd import Variable
from .vision_handler import VisionHandler
class ImangeSegmenter(VisionHandler):
"""
ImangeSegmentor handler class. This handler takes an image
and returns output shape as [CL H W], CL - number of cl... |
f33c6a3d371c7647bcd49c8560c584ab385439f3a699c2d1e8c9095875b28000 | Python | 2,085 | 52 | # The dwarf_v5_forms.debug file was generated as follows, using gcc 11.2.0 on
# an x86_64 machine.
# $ cat dwarf_v5_forms.c
# int main();
# {
# char ** val;
# return 0;
# }
# $ gcc -O0 -gdwarf-5 dwarf_v5_forms.c -o dwarf_v5_forms.debug
# $ strip --only-keep-debug dwarf_v5_forms.debug
import os
import un... |
6dcaafca3dfc21b6d6d48bb612c91f8651b80b87f7865d78716cf8bb0ab406d1 | Python | 2,087 | 57 | # 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 _specify_int64(indices, inverse_indices, counts):
return (
np.array(indices, dtype=np.int64),
np.array(inverse_indice... |
b1bfcb62c22505c492a23540eb0b1741bd0bef9117c9974ebaf069715dbead23 | Python | 2,087 | 73 | import os, glob
import tifffile
import numpy as np
import nibabel as nb
def load_tiff_sequence(imgdir, imgtype='tif', zrange=None):
"""
Load image sequence stored in the same directory.
Only monochrome image can be loaded with this function.
e.g.
vol = load_tiff_sequence(imgdir, 'tif', zrange=[10,100])
"""
... |
9c73af5b86976a3b8959e92be5962b597987bcb8830399e0bed1697cb4043dba | Python | 2,088 | 65 | """Isolated numba imports for _wdtw."""
__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 Num... |
20257e27a99012e740bc7f153a43ff94f0b9230fa1c845a208097da1b936ea07 | Python | 2,089 | 74 | # 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... |
61f66b210e79b473b268eb6f3f097a442e3f3a5f1a5a3d28600f83d12e970bc2 | Python | 2,092 | 61 | from pytest import mark
import numpy as np
from asreview.models.balance import get_balance_model
from asreview.models.balance import list_balance_strategies
def generate_data(n_feature=20, n_sample=10):
X = np.random.rand(n_sample, n_feature)
n_sample_zero = np.int(n_sample / 2)
n_sample_one = n_sample -... |
9673f71c984660734ecc8c160e2c2979c94535ce04da178259d7d7c8caa0d27a | Python | 2,093 | 60 | # 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... |
caa5ce97f3a5f22710fad890fdc3c765d9b144b7199552bd50378e33c6739f9b | Python | 2,093 | 48 | import matplotlib.pyplot as plt
import numpy as np
import pickle
def plot_graph(data, threshold, title, linestyle, lower=5, upper=95):
numNeurons = data['shape']
torchCPURawTimes = data['torchCPU']
torchCPUAvgTimes = np.mean(torchCPURawTimes[:,1:], axis=1) * 1000
torchCPUVar = np.std(torchCPURawTimes[... |
1117e8ea15ac838a411b5dd8eefdaa228a3e8ebdeaf95915d18e5db9dfd57ad9 | Python | 2,095 | 64 | import numpy as np
import torch
import torch.nn.functional as F
def sdr(output, target):
num = target.size(0)
c = target.size(1)
SDR_all=0
R_all = 0
for i in range(num):
for chan in range(c):
img = output[i, chan]
mask = target[i, chan]
#Calculating the... |
ee8d6ea22879d52b541cd21a2cdd7221611691c4e7303e9e7057840e9e2ba35f | Python | 2,096 | 54 | import functools
import torch.nn as nn
import torch.nn.functional as F
import models.modules.module_util as mutil
class MSRResNet(nn.Module):
''' modified SRResNet'''
def __init__(self, in_nc=3, out_nc=3, nf=64, nb=16, upscale=4):
super(MSRResNet, self).__init__()
self.upscale = upscale
... |
907fdb6ad763fee8288c828341c01b2e3f962ea6d4bc40ca9cb046e11fb99546 | Python | 2,097 | 59 | # 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... |
9dd3500d0d99c10f884685527feff56701bab749d0225d6283943c07133a137d | Python | 2,097 | 59 | # 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... |
ebeee9d216f64b72c8864de09c40175a2c26ae71fb0c9ab2132a1e6be5138aef | Python | 2,097 | 64 | # 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
#
# ... |
a78f6369eb2d55df582c9eb0f710f18491cb5002e78b3d93db957f29d9f0b8d3 | Python | 2,098 | 63 | # 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... |
d1fb23fc3c00d3b165705f54d844051dd1dcb97c9d473bfdefbcb056b8417edb | Python | 2,098 | 63 | # 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
#
# ... |
2fdd1588d5d1263133260526f9ffd9180497fdc9c9c85aa4e831faed5855d62b | Python | 2,099 | 66 | # 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... |
a05d5ae9b158b07ba51bcda9c078cb43e05dad3736ccd6f6b120f742c8246a27 | Python | 2,101 | 62 | # 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... |
bcdeb054d7df87261fa3e0320aae32e8927a2553117f5f00fa33d1abdbaa9711 | Python | 2,102 | 59 | #
# # Different node styles
#
# [Open interactive notebook in Binder](https://mybinder.org/v2/gh/wiheto/netplotbrain/main?filepath=docs/gallery/node_styles.ipynb)
#
# There are currently three different node style options to choose from: circles, spheres, parcels.
# You just need to change the specification in the no... |
ef48f7dad37d9f3df92873e3258f9979b765f267e4920f4355b049faf290f9cc | Python | 2,102 | 50 | # 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... |
33b55d3ee38080f5d0380c67e9bb95c0aaec4a36f7520add01b06a6b717f5878 | Python | 2,103 | 74 | """" Show the parameters for a given model run.
This probably should be set up to be called from DataTablesVCN
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, ... |
8b102777884f86c83bf42242e64198eed0953757eaf0e2ef31d5fab90922550d | Python | 2,104 | 78 | import time
from collections.abc import Callable
from sktime.datatypes import convert_to
from sktime.utils._testing.panel import _make_panel_X
from sktime.utils._testing.series import _make_series
def create_test_distance_numpy(
n_instance: int,
n_columns: int = None,
n_timepoints: int = None,
random... |
acdfee432db207f400f158c287a900cd53e896b9ad97b6853c0d16e91473b050 | Python | 2,104 | 55 | """
Alpha mesh generation from pial surface mesh point cloud. Alpha surface tight wraps the pial surface.
Parameters:
---------
Reads {h}.pial.ply mesh file
Returns:
-------
Outputs {h}.alpha.ply and {h}.alpha.vtk alpha-mesh files. The output file format can be changed accordingly.
"""
def mesh_alpha(subject... |
338fd7d75ba04b91901d46d296d711e7cd5b1d198aa5e8b5153c76f7e2123f27 | Python | 2,105 | 81 | #!/usr/bin/env python
import click
from functools import partial
from multiprocessing import Pool
import os
from tqdm import tqdm
bar_format = "{percentage:3.0f}%|{bar:20}{r_bar}"
from jaspar2logo import _get_figure
from meme2scores import _get_PWMs
from utils import get_file_handle
CONTEXT_SETTINGS = {
"help_op... |
30514346fb177d7c5c7b462fd6692aa90253eeb74913b31a4b6c8e94c0d41d36 | Python | 2,106 | 60 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import onnx
import onnx.onnx_cpp2py_export.inliner as C # noqa: N812
def inline_local_functions(
model: onnx.ModelProto, convert_version: bool = False
) -> onnx.ModelProto:
"""Inline model-l... |
bd4ad33b64ea4d72ebd4e3a32a0e44ea04c0efe634b3d4b649416ac68777182c | Python | 2,110 | 55 | """Main configuration file for pytest.
Contents:
adds the following options to pytest
--matrixdesign : bool, default False
allows to turn on/off the sub-sampling in the tests (for shorter runtime)
"on" condition is partition/block design to ensure each estimator full tests are run
on each operating system ... |
421746216da056b70220128f3c53c8da752bad9afcc1c6e4c27d2ae782a4c157 | Python | 2,111 | 51 | import logging
import torch
import io
from torchtext.utils import download_from_url, extract_archive, unicode_csv_reader
from os import path
from torchtext.datasets.text_classification import URLS
from torchtext.data.functional import generate_sp_model, load_sp_model, sentencepiece_numericalizer
from torchtext.datasets... |
a81233d64d783d8da3cdec992c8025565dbd8c60a1b3eb795f4baf1371f31b63 | Python | 2,113 | 62 | # 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
import smote_cd
import sphinx_rtd_theme
# -- Path setup -----------------------------... |
dab89bc9511038de3fde51dd25a7c105da589742f3f75203a7387ddc8c569296 | Python | 2,115 | 57 | """cloud_cover_lightning_base.py"""
"""
Author: Yimin Yang
Last revision date: Jan 18, 2022
Function: cloud cover dataloader for training sets, test sets and validation sets
Ref: https://github.com/HansBambel/SmaAt-UNet
"""
class Cloud_base(TransUnet_base):
def __init__(self, hparams):
super(Cloud_base,... |
6c836a5ada0baca97dfb72c31277a23487a15b2a0fdace0d4f9ba21d92c09a34 | Python | 2,116 | 58 | #-------------------------------------------------------------------------------
# Tests the functionality of get_section_index
#
# Jonathan Bruchim (YonBruchim@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
import os
import unittest
from... |
eb3692e9238636638cc997f7b80b5801bf005fcd2648a22c8304a52195c4f66d | Python | 2,117 | 67 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 5 15:00:47 2018
@author: wanglab
"""
from sklearn.model_selection import train_test_split
import os, shutil
#doing this so i can remember which datasets are in which category - makes it easier to have physical copies
data_pth = "/home/wanglab/Lig... |
f5915ecfd00397897b3d567a86ffd4e5e1a3a7c781c271183de20991c0bafbd4 | Python | 2,117 | 71 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
# Ported from skchange (BSD-3-Clause), original authors: Tveten
"""CUSUM change score for a change in the mean."""
__author__ = ["Tveten"]
import numpy as np
from sktime.detection._utils import col_cumsum
from sktime.detection.base._base_interva... |
88508d1bae35c824ae217153637d3181142a2c44431cca89ac0cb749d2a4009e | Python | 2,118 | 63 | # 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... |
f60ef9f504859f28375b767bcfda713729f01fe8a54a27af8186a8de61285280 | Python | 2,118 | 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... |
42c3737e1d3ac99145fd3e09a8bcc0bc6cf6495a1439c0f297478f83222c8278 | Python | 2,119 | 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... |
757bae022fe38ed46936baaef2019947dea3a92747b87d7c36a4292822e18099 | Python | 2,119 | 55 | # Copyright 2019 Martin Haesemeyer. All rights reserved.
#
# Licensed under the MIT license
"""
Script for testing caiman - cai_demo.py implementation with slight adjustments
"""
import numpy as np
from utilities import ui_get_file
import matplotlib.pyplot as pl
import analysis as ana
from os import path
import log... |
f8f4ca61b76b2d6bbcfc2f407d5b2e91e56706c441cf1698d998be41027c4fc4 | Python | 2,119 | 60 | # 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... |
9e0dcb9579b7dfcf9361feda48fca8e08cacb1ede4a44518a730f492570d5ff8 | Python | 2,121 | 49 | # 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.datasets import load_fb15k_237
from ampligraph.latent_features... |
f65428397bfc959527c8c76e01b5800700c89100b441323c576df2c743633818 | Python | 2,122 | 57 | # 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... |
77a3f0d65cc0de1165bdf62bb183039fe1e04685db833d8c6698a850202e9e08 | Python | 2,123 | 87 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
from setuptools import find_packages, setup
with open("README.md") as readme_file:
readme = readme_file.read()
test_requirements = ["scipy"
]
docs_requirements = [
]
setup_requirements = [
]
dev_requirements = [
*test_re... |
e6b686b0651d514cf8025b8147767877f260eada93c0acbf392857a448808c75 | Python | 2,124 | 57 | import scipy.stats
import numpy as np
from .population import Population
from .. import cells
class Bushy(Population):
"""Population of bushy cells.
Cells are distributed uniformly from 2kHz to 64kHz.
Note that `cf` is the mean value used when selecting SGCs to connect;
it is NOT the measur... |
71ec27817ef0e00b050618b57a77a13e390df5b24e7c978b96a9c41830875d10 | Python | 2,125 | 82 | import math
import torch
EPS = 1e-16
def get_p_polar(p):
"""
(E, px, py, pz) or (px, py, pz)-> (eta, phi, pt)
"""
if p.shape[-1] == 4:
_, px, py, pz = p.unbind(-1)
elif p.shape[-1] == 3:
px, py, pz = p.unbind(-1)
else:
raise ValueError(
f"Wrong last dimens... |
cd94494cccd21696863887c3309de5a2448da9644de8cb0ae6edd5e4e7cff793 | Python | 2,125 | 54 | import rdflib
from pyontutils import combinators as cmb
class AnnotationMixin:
@property
def __graph(self):
if hasattr(self, 'out_graph'):
return self.out_graph
elif hasattr(self, 'graph'):
return self.graph
else:
raise AttributeError('no graph or ou... |
655e9faa8ec3e1f1ef7a3f06f2028ac304020ac7d2ac2b21f202b110a9c56ca1 | Python | 2,126 | 74 | # 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... |
786f2ac3d097ed1ca4e72b79bbf6f0d15c5a5ebe839971a713e11159f726988d | Python | 2,126 | 50 | #-------------------------------------------------------------------------------
# elftools tests
#
# Seva Alekseyev (sevaa@sprynet.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
import os
import unittest
from elftools.dwarf.locationlists impor... |
fe77422b52ff5167e0b7221ccc4357927ada97c15ce84bc39c87c9bb746ea1b6 | Python | 2,126 | 66 | import numpy as np, tifffile
from soup.classic import *
from scipy.ndimage import median_filter, convolve
"""
http://docs.opencv.org/2.4/doc/tutorials/imgproc/histograms/histogram_equalization/histogram_equalization.html
http://vzaguskin.github.io/histmatching1/
https://en.wikipedia.org/wiki/Histogram_matching
"""
def... |
4cb4b933c90a43de47b5a7fca78c47fa987814178160cfd14102f550f8c96953 | Python | 2,127 | 71 | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 15 17:48:41 2016
@author: daniel
"""
from neuron import h
import d1msn as msn
import spillover_experiment as se
import pickle
import parameters as p
import json
# --- 1. Create a cell and other useful stuff
params = "./params_dMSN.json"
with open('D1_71bestFit_updRh... |
938a3754172a2625b8a55a34a7c11727cd346f278d5db230992fa270cf31329b | Python | 2,128 | 67 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Base classes for classification datasets."""
__author__ = ["felipeangelimvieira"]
from sktime.datasets.base import BaseDataset, _DatasetFromLoaderMixin
__all__ = [
"BaseRegressionDataset",
"_RegressionDatasetFromLoader",
]
class Ba... |
f3833d38a0a4c870b7cf3dd1fccc390906ebf8affecd77975adcc6a417f734b6 | Python | 2,128 | 67 | # Copyright 2019-2021 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... |
373549b6d5eae0c488e3ed444315ed770d6b0be053bcac78f90a4a4da338d92b | Python | 2,129 | 80 | # 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 SplitToSequence(Base):
@staticmethod
def export_with_split_1()... |
5a1c14c42d2fbad108da9a707a8a255c3cfd981be2cf13fd6ee96f6e0b582b56 | Python | 2,129 | 66 | r"""
These tests run on the simplest models and datasets to speed up things, as here it is about testing the VP suite itself.
The testing of all models and datasets is done in test_models.py and test_datasets.py.
"""
import tempfile
import json
import pytest
from vp_suite import VPSuite
from vp_suite.defaults import S... |
b9fef8a648ebbdfb7b63c252609659dffcee3a2f7030b714eea9a813d033de62 | Python | 2,131 | 61 | import unittest
from pathlib import Path
from pyontutils.utils import get_working_dir
from pyontutils.config import auth
from pyontutils.integration_test_helper import _TestScriptsBase, Folders, Repo
import nifstd_tools
class TestScripts(Folders, _TestScriptsBase):
""" woo! """
skip = tuple()
ci_skip = (
'c... |
1ec59130e02e38fd7d9502e4f0beeb9467db4b2d1f51b1a9206be42b92e4ba67 | Python | 2,133 | 53 | import os
from ray.rllib.agents.trainer import Trainer
from ray.tune.trial import ExportFormat
from ray.tune import TuneError
class WeightsUtilsTrainerMixin(object):
def _export_model(self, export_formats, export_dir):
MODEL_WEIGHTS = "model_weights"
try:
ExportFormat.validate(expo... |
a77882884bef209f1bf51a24323822078630296e023f686fae505ac75d0c6fce | Python | 2,133 | 50 | """Detect bursts: amplitude threshold approach."""
import numpy as np
from bycycle.utils.checks import check_param_range
from bycycle.burst.utils import check_min_burst_cycles
###################################################################################################
##########################################... |
0abcc4fba9b24f70050ff00d1c2b010d63ba6dce26096afbca208b770e11d3bb | Python | 2,134 | 69 | """Tests for bcblib.imaging.manipulate."""
import numpy as np
import nibabel as nib
import pytest
from bcblib.imaging.manipulate import extract_roi, merge_images, split_image, copy_geometry
def _make_nii(shape=(4, 5, 6), val=1.0, affine=None):
data = np.full(shape, val, dtype=np.float64)
if affine is None:
... |
051dacefe31b86d9ea15041dd70a7427df81679066b7d9bfb287fd7ae6084ea8 | Python | 2,136 | 68 |
import numpy as np
from keras.models import *
from keras.optimizers import *
from sklearn.metrics import mean_squared_error, r2_score
import scipy as sp
from scripts import models_util
from scripts import data_handler as dh
from keras.callbacks import Callback
from scripts_tl import data_handler_tl as dh_tl
... |
0682f8fb3b1cfb3b29e9c701d96f5c8700672c381bdfaaca1c759368de34fb9b | Python | 2,137 | 58 | import pytest
import torch
from tests.fixtures.models import CustomParameter, EdgeCaseModel, IdentityModel
from torchinfo import summary
def test_invalid_user_params() -> None:
test = IdentityModel()
with pytest.raises(ValueError):
summary(test, verbose=4)
with pytest.raises(ValueError):
... |
d26741545d91b8e1bee4ac320cc07d083e58ea177a1a47bc8cbd2829b7e522b9 | Python | 2,137 | 62 | from __future__ import annotations
from pathlib import Path
from typing import Optional, Sequence
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
def plot_gene_usage_boxplot(
usage_long: pd.DataFrame,
gene: str,
groupby: Optional[str] = None,
ax: Optional[plt.Axes] = None,
... |
5b588246f91181be2ea9c7b93055493a6d08aa4fc5b6f147b7b7c2f58786b59d | Python | 2,139 | 67 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import Any
from onnx.reference.op_run import OpRun
def _split_class_name(name):
if "_" in name:
prefix, vers = name.rsplit("_", maxsplit=1)
try:
v = int(ve... |
d8294d02a4e96b35c1bf5576252b5274e60a77b41a022eb3a11ae6b964325290 | Python | 2,140 | 44 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# (C) Copyright 2015 Frankfurt Institute for Advanced Studies
# (C) Copyright 2016 Max-Planck Institute for Brain Research
#
# Author: Philipp Huelsdunk <huelsdunk@fias.uni-frankfurt.de>
#
# Redistribution and use in source and binary forms, with or without
# modificat... |
1eb9a671f49d291e994c36773ddff5bd3328ee955b48ed2a65b1371ba75b8a21 | Python | 2,143 | 74 | # 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... |
9bc9889dd9a99630fad59c9c59a2f520d9d49052ee71d355f80fdf46dda053d8 | Python | 2,143 | 70 | #!/usr/bin/env python
from __future__ import print_function
import sys,os
import re
import argparse
import logging
import gzip
from functools import partial
desc = 'Renaming single genome fasta'
epi = """DESCRIPTION:
Renaming genome fasta file based on taxon name.
"""
parser = argparse.ArgumentParser(description=desc... |
5f05823d15c805d401c8f6f976a594f935bc0675e786ec4b4ee374f74278252b | Python | 2,144 | 58 | from os.path import isdir, join
from os import mkdir, listdir, chdir
from keras.layers import SimpleRNN, LSTM, GRU
from preprocess import PreProcessor
from plot import Plotter
from models.RNN import RNN
if __name__ == '__main__':
# Change dir to root
pred = ['drive']
prob = ['classification... |
fa65b90543d397bbc677e1899c790d52aa6398d8d25b4a75d25df4d7e41b9e33 | Python | 2,146 | 49 | # 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... |
c70dd9e9419be40dd2c76b9fddeb35bc7d0800c10afc20ce4eb6b4c3a0c225e8 | Python | 2,148 | 76 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 16 16:00:03 2018
@author: wanglab
"""
import os
import h5py, tifffile
from augmentor import Augment
from dataprovider3 import DataProvider, Dataset
class Sampler(object):
def __init__(self, datadir, spec, vols=[], mode="train", aug=None):
... |
767b77db008789ac55138f157556e36031befdf5770541984c306b4e9f6b5860 | Python | 2,149 | 74 | import os
import pytest
import numpy as np
from os.path import join as pjoin
from dnnbrain.utils import util as db_util
DNNBRAIN_TEST = pjoin(os.environ['DNNBRAIN_DATA'], 'test')
TMP_DIR = pjoin(os.path.expanduser('~'), '.dnnbrain_tmp')
if not os.path.isdir(TMP_DIR):
os.makedirs(TMP_DIR)
def test_gen_dmask():
... |
572a561762c29cdf7f1bddacdba5910472d3ede5edc6c163cd005cdb86cdd454 | Python | 2,150 | 73 | # 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... |
b1ee44a66005908355e16e1cfe8f4b4600ca8af01688667c3494c4c9bba2fa9f | Python | 2,150 | 60 | # 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... |
59e80566b0f3129bd9155ba62d8a146d30a49a146a9d541479f3d7288f1f80b6 | Python | 2,151 | 60 | from flask import Flask, render_template
import os
import webbrowser
import platform
import random
from threading import Timer
import logging
run_flask_logger = logging.getLogger(__name__)
def get_browser(port_num):
url = 'http://127.0.0.1:%d' % port_num
my_os = platform.system()
if my_os == 'Windows':
... |
a4a14f42493751a64de5e83733509bec0dcd1aaf9e9904a1779e77e4b0b8365c | Python | 2,151 | 95 | #!/usr/bin/env python
# Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import argparse
import os
import shutil
import subprocess
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(os.path.basename(__file__))
parser.add... |
eef1a6d3afcda0b48d3877436c9a5f2883ea0ec6ed84bc4346d764f2c4f55178 | Python | 2,152 | 65 | # 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... |
2bdef8d86543043a03c556100a501dcfa2f803c7f95b085db9e15c4f3f84eb7d | Python | 2,155 | 46 | from sklearn import ensemble, linear_model, svm, neural_network
# import xgboost as xgb
from staticDecisionTreeClassifier import StaticDecisionTreeClassifier
class ClassicalClassifier():
def __init__(self, params, paramID):
self.classifierType = params.classifierType
self.classifierParams = params.class... |
9212f74ae4e97dfc0fb85349090f9df5ca08480c3eb8591ed8ef02c98cf3f06f | Python | 2,155 | 70 | import numpy as np
import pandas as pd
from sklearn.datasets import make_blobs
__author__ = ["vagechirkov"]
__all__ = ["make_moving_blobs"]
def make_moving_blobs(
n_times=3,
n_samples=15,
cluster_std=0.10,
random_state=10,
centers_origin=np.array([[-1, -1], [0, 0], [1, 1]]),
movement_mode="co... |
9f8b240c6e8a6074d81b8a5b46b48ce2473ae049d493443a68cbd09e4fd74008 | Python | 2,156 | 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... |
aef6512bbedab8f022ec83ffc3d1674655cf96c8949512e27c6d23293da9d3e3 | Python | 2,156 | 72 | # 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... |
385c2391be2195275ed407bf7bd536b06900431061c4c84fabe8443fd04649dd | Python | 2,157 | 67 | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmcv.utils.parrots_wrapper import _BatchNorm
from mmcls.models.backbones import ResNet_CIFAR
def check_norm_state(modules, train_state):
"""Check if norm layer is in correct train state."""
for mod in modules:
if isinstan... |
567102299fdc2e27a5254fafdde8eb9b82caea5c870ab17bca49ca0e1123c4e7 | Python | 2,157 | 70 | from __future__ import annotations
import pandas as pd
from scipy.cluster import hierarchy as sch
def cluster(
hotspot_df: pd.DataFrame,
AI_series: pd.Series,
n_svgs: int = 1000,
n_svg_clusters: int = 8,
threshold: float = 0.3,
) -> pd.Series:
"""
Cluster SVGs using hotspot matrix.
P... |
ac98e28d4f8a34db8f6b7c62bb1132efde197974d4e839956781710a0e5156ad | Python | 2,157 | 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... |
55f0a6e3ad9ee3229beba7b337da92792cc56535571029abd578479b3f63aa07 | Python | 2,159 | 75 | # 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... |
3b6f3be3b523d36fde764507046eb12507383eccb25591d1791d71d60c06e77a | Python | 2,161 | 65 | import pytest
import torch
from tests.fixtures.models import LinearModel, LSTMNet, SingleInputNet
from torchinfo import summary
from torchinfo.model_statistics import ModelStatistics
@pytest.mark.skipif(
not torch.cuda.is_available(), reason="Cuda must be available to test half models."
)
class TestHalfPrecision... |
04b301b6a3d32544e4a658e7b203d4009d15ab329873376affb19abc91d3a057 | Python | 2,163 | 71 | # 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
from onnx.reference.ops.op_conv import _conv_implementation
class CausalConvWithState(OpRun):
def _run(
self,
input,
... |
c579acad816c71c0692509df165f68336b3defc511292beae820868e5ee5a152 | Python | 2,163 | 40 | import anndata as ad
import numpy as np
import pandas as pd
import pytest
import torch
from short2long.competitive_model import CompetitiveAllocationNet
from short2long.competitive_predict import align_genes, infer_h5ad
def test_gene_mapping_is_strict():
selector = align_genes(["ENSG0001.2", "B", "A"], ["A", "EN... |
2225561d33226b309cad25586acec5f0d7ad322586cc6937c23f43190beec54a | Python | 2,165 | 75 | """Test single problem loaders using data shipping with sktime."""
import numpy as np
import pandas as pd
import pytest
from sktime.datasets import (
load_acsf1,
load_arrow_head,
load_basic_motions,
load_italy_power_demand,
load_japanese_vowels,
load_osuleaf,
load_plaid,
load_tecator,
... |
4f6617d7cb8ec2ee12d8b663e6a19a9a858a5412a6dd1500e52d42ddb50bf675 | Python | 2,165 | 67 | #%% [markdown]
# # *P. pacificus* pharynx connectomes
#%%
import datetime
import time
import networkx as nx
import pandas as pd
from graspologic.plot import adjplot
from pkg.data import DATA_PATH
from pkg.utils import create_node_data, ensure_connected, select_lateral_nodes
OUT_PATH = DATA_PATH / "processed_split"
t... |
2a9c7f29c5147e7c413463539c9da1c4ca3eb0b5da129007e4f291034a0f08a4 | Python | 2,166 | 60 | import pickle
import yaml
from types import SimpleNamespace
import numpy as np
import torch
def load_data(path,device):
file=open(path,'rb')
x,xf,tr,st= pickle.load(file)
x_t,xf_t,tr_t,st_t = torch.tensor(x).double().to(device), torch.tensor(xf).double().to(device), torch.tensor(tr).double().to(device), to... |
d510833ed82e78a17d65793e60dc888ba47c00fe9682369a96bba79666480788 | Python | 2,166 | 78 | # Read gpu results and save them in a single csv file
import pandas as pd
import numpy as np
import os
model_scores = pd.DataFrame(
columns=[
"target",
"seed",
"conv",
"pool",
"loss",
"lambda1",
... |
437d8f3b95255149786d0389533fa5dda54eb5d5a0f1136e6518f56053d98076 | Python | 2,167 | 56 | import distutils.dir_util
from NetworkBasis.networks import *
import config as cfg
distutils.dir_util.mkpath(cfg.logs_path)
def buildmodel(architecture, inshape, write_summary=True):
if cfg.training==True:
model= SemiSupervisedSegModel(inshape=inshape, architecture=architecture)
elif archit... |
3ff98f36213917d7a7e61d0a5db32b6df4ef4a1753bdb4a808011ed100575464 | Python | 2,172 | 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... |
67565562812d6706d7cca093b94e9e56cc404397470f1369cb5d017a60f72df5 | Python | 2,173 | 63 | from __future__ import print_function
import sys
from os import listdir
import pickle
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
from parameterSetup import ParameterSetup
from algorithmFactory import AlgorithmFactory
args = sys.argv
if len(args) > 1:
option = args[1]
else:
opti... |
1f3bdfd9f3c2b168788e2b10e2158199c1adc92c01563c9944882bf93d03660f | Python | 2,179 | 76 | import torch
import pandas as pd
import os
import numpy as np
from torch.utils.data import Dataset
from STIFMaps.training import CustomImageDataset, AlexNet, train_model
from PIL import Image
import tempfile
def create_dummy_dataset_dir(num_samples=10):
temp_dir = tempfile.TemporaryDirectory()
sample_names = ... |
59a950e7cf6f15b809e036dd179e73854cef7d57149d5828338733eae9becbe6 | Python | 2,180 | 52 | import torch
import flair
START_TAG: str = "<START>"
STOP_TAG: str = "<STOP>"
class CRF(torch.nn.Module):
"""Conditional Random Field.
Conditional Random Field Implementation according to sgrvinod (https://github.com/sgrvinod).
Classifier which predicts single tag / class / label for given word based o... |
db452c0f7a0aba99403addd2b68d21eba078f6304f5f9c917184097be317da31 | Python | 2,180 | 72 | """USChange dataset for forecasting growth rates of consumption and income."""
from sktime.datasets._single_problem_loaders import load_uschange
from sktime.datasets.forecasting._base import _ForecastingDatasetFromLoader
__all__ = ["USChange"]
class USChange(_ForecastingDatasetFromLoader):
"""Load USChange data... |
fedce0b0dd1005b42e605c7257c186a20611608d54c816f7bb3c59dc61a0cb14 | Python | 2,181 | 83 | import pickle
import pandas as pd
from hbip import preprocess as pp
def read_seqs(_file_path):
"""Read text file (a fasta file) with sequences and description
Parameters
----------
_file_path: str
Path to fasta file
Returns
-------
df : dataframe
Dataframe with columns:... |
39abac2cfec81b27eeaf00564fb4580d3bfb2f24099cbed57c6b28f2cc02383e | Python | 2,182 | 63 | # 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... |
735ada2eb418e9c1d359444dee4706270822795242ad5776efc7385091b1a20a | Python | 2,182 | 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... |
d073818108999ae937d9bde966b8b38b2765a44912afb1b814f15a1840cc6e4d | Python | 2,182 | 77 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 19 15:30:12 2022
@author: sudhanshu
Usage: File is run to fix some directory settings for CAPSIF:V scripts
"""
import os
import sys
class dot_variable_class:
def __init__(self):
pass
@property
def all_methods(self):
ret... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.