sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
f5150e48d55d482ec32ea832883991f85c70aae442137f7f81164f52996584f5 | Python | 6,442 | 213 | # 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 ReduceLogSumExp(Base):
@staticmethod
def export_float16_large_... |
713f9d0289853c691a2c7de3e845905712119d3b5e154bb7a55b525b25a5bf17 | Python | 6,443 | 194 | import math
import numpy as np
import time
from .geometry import Box, Vec3d, centered_box
from . import utils
class TensorData(object):
"""Read-only tensor data.
The 1st dimension is regarded as channels, and arbitrary access
in this dimension is not allowed. Threfore, every data access should be
ma... |
9aa51c62ffcceca957eb37cee5a52b6d4daba21e5d96bbf98c50fe9309553b7d | Python | 6,445 | 172 | import networkx as nx
from rxnebm.data.chem_utils import BOND_TYPES, get_sub_mol
from rdkit import Chem
from typing import List, Tuple, Union
class RxnGraph:
"""
RxnGraph is an abstract class for storing all elements of a reaction, like
reactants, products and fragments. The edits associated with the reac... |
134267be9e59a3f88ae9d0a219317067eeab2ecce29c654d3015d5793833f2cd | Python | 6,448 | 174 | """
plot_precision.py
Equal weights different variance, different weights equal variance.
Load and plot data generated by precision.py.
"""
import json
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import wilcoxon # Statistical comparison between groups
import simulation_utilities as simutils
i... |
8314bef7631a5ae879ed9c8168d352d03b3016e07919ee43cbaf78383cfd326a | Python | 6,448 | 231 | from typing import Tuple
import torch
import numpy as np
from lgn.cg_lib import CGDict
def rotate_part(D, z, side="left", autoconvert=True, conjugate=False):
"""Apply a D matrix using complex broadcast matrix multiplication."""
if autoconvert:
D = D.to(z.device, z.dtype)
if conjugate:
D = ... |
6f9187e09b390ea0304ab79d5abe99eeb23b2c60525f3a0e123c29f3085e7c56 | Python | 6,449 | 232 | from typing import Tuple
import torch
import numpy as np
from lgn.cg_lib import CGDict
def rotate_part(D, z, side="left", autoconvert=True, conjugate=False):
"""Apply a D matrix using complex broadcast matrix multiplication."""
if autoconvert:
D = D.to(z.device, z.dtype)
if conjugate:
D = ... |
4ec631462eace039be25041ff18a40fa2d8ca4fe6233f90e25278b536ecca7d4 | Python | 6,450 | 194 | import math
import numpy as np
import time
from .geometry import Box, Vec3d, centered_box
from . import utils
class TensorData(object):
"""Read-only tensor data.
The 1st dimension is regarded as channels, and arbitrary access
in this dimension is not allowed. Threfore, every data access should be
ma... |
f85aaff19526718cc688a636c37aaf580361c923399bcb006c12298e42674083 | Python | 6,453 | 206 | # 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... |
dfae62cb641bd81d7201881ad092252187e8ed45b761e970bb1bab9006ef2063 | Python | 6,454 | 223 | """Tests for pairwise panel transformer dunders."""
__author__ = ["fkiraly"]
import numpy as np
import pytest
from sktime.dists_kernels.algebra import CombinedDistance
from sktime.dists_kernels.compose import PwTrafoPanelPipeline
from sktime.dists_kernels.edit_dist import EditDist
from sktime.tests.test_switch impor... |
3cd3ba3305679f65f47971c10e7fd07ac35d4deb88eb5ffa61d1cd74cf735e61 | Python | 6,455 | 176 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import configargparse
import copy
import unittest
import glob
import os
import codecs
import onmt
import onmt.inputters
import onmt.opts
import onmt.bin.preprocess as preprocess
parser = configargparse.ArgumentParser(description='pr... |
3a88d7e64feb3f87801436517e0e4ef9892d0fc4da22b01ff25f0a0d9f74d8ea | Python | 6,456 | 171 | from __future__ import division
import os
import re
import pandas as pd
from helper_lib import filelib
from SPHARM.classes.image_stack import ImageStack
def make_metadata_files(**kwargs):
"""
Generate metadata file with the given voxel size.
Keyword arguments
-----------------
*inputfolder* ... |
3fdaf15cbbbaca599769cbe20a1e12585441e170b6fa0c9fecf1a1f8bb4e9c7d | Python | 6,463 | 232 | """Voxel-wise maths on NIfTI images: binarize, threshold, morphology, masking, arithmetic."""
import os
from typing import Optional, Union
import numpy as np
import nibabel as nib
from scipy.ndimage import binary_dilation, binary_erosion, generate_binary_structure
from bcblib.imaging._types import NiftiLike
from bcb... |
bfb5478944b809d876d3001f50ae0a550a483b45bb13410bda3f415ab7e7095f | Python | 6,464 | 198 | import re
import pydoc
from .external.docscrape import NumpyDocString
class DocstringComponents:
regexp = re.compile(r"\n((\n|.)+)\n\s*", re.MULTILINE)
def __init__(self, comp_dict, strip_whitespace=True):
"""Read entries from a dict, optionally stripping outer whitespace."""
if strip_whites... |
47490ed770080b283f60d1589b9a7aa2f3d64b47fb8cb3e6ab365f44361f5151 | Python | 6,466 | 116 | 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']
npRawTimes = data['numpy']
npAvgTimes = np.mean(npRawTimes[:,1:], axis=1) * 1000
npVar = np.std(npRawTimes[:,1:], axis=1) * 1000
npLow =... |
ebb09584a072db34d2bd18e9ca5da7346dfa0c81ca6b197488b6f9d0941e0e1d | Python | 6,471 | 186 | """Test the ComposableTimeSeriesForestClassifier."""
__author__ = ["mloning"]
import numpy as np
import pytest
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import FunctionTransformer
from sklearn.tree import DecisionTreeClassifier
from sktime.classification.ensemble import (
BaggingClassifier... |
208b83bd41f69fe62573b9c878bee3073b763da04b07f61b56b6fb50bfe9f771 | Python | 6,472 | 196 | # 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... |
9321cd9d2a54503fc7e906d649b434ff617608d5510c5beafacc25ea7eadb6f9 | Python | 6,472 | 186 | #!/usr/bin/env python3
import pathlib
from collections import Counter
from lxml import etree
from pyontutils.core import OntResIri, OntGraph, OntTerm
from pyontutils.utils import Async, deferred
from pyontutils.sheets import Sheet
from pyontutils.scigraph import Dynamic
from pyontutils.namespaces import PREFIXES as uP... |
c6117ee56435fb377094796f1a5e16c8e12add9cdc86da3e02a33aa202635cf4 | Python | 6,472 | 180 | import numpy as np, os, cv2, sys
from scipy.stats import linregress
import multiprocessing as mp
from matplotlib import pyplot as pl
from scipy.cluster.vq import kmeans2
import tifffile
pl.ioff()
#%%
if __name__ == '__main__':
src = '/jukebox/wang/abadura/TissueVision/ben/brains'
dst = '/jukebox/wang/abad... |
71c6c38ac70153863e2b2d7ade8a82be193d668c969109f8cf2eecd39dffa89a | Python | 6,475 | 210 | # 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
def compute_if_outputs(x, cond):
if cond:
return []
return x... |
4c98594274c53525c46763afb207804e5fdcf1230db1163fce301ba2148deca1 | Python | 6,479 | 158 | import pytest
import torch
import torch.nn.functional as F
import flair
from flair.embeddings import FlairEmbeddings, WordEmbeddings
from flair.models import SequenceTagger
from flair.trainers import ModelTrainer
from tests.model_test_utils import BaseModelTest
class TestSequenceTagger(BaseModelTest):
model_cls ... |
49d7a518430b6590ee478698c8df8edaa0c2dc87ff927182bf374c9b37c407dc | Python | 6,481 | 198 | import os
import h5py
import pytest
import numpy as np
from os.path import join as pjoin
from dnnbrain.brain.core import ROI, BrainEncoder, BrainDecoder
from dnnbrain.dnn.core import Activation
DNNBRAIN_TEST = pjoin(os.environ['DNNBRAIN_DATA'], 'test')
TMP_DIR = pjoin(os.path.expanduser('~'), '.dnnbrain_tmp')
if not ... |
aafcf4e0adfdeefda55a0bbec8acdf29e8bb271286f34d5333ad81add1657e8f | Python | 6,481 | 160 | """
Module written by Kaarthik A. Balakrishnan for anatomical clustering of coordinates
"""
import numpy as np
import matplotlib.pyplot as pl
from scipy.ndimage import gaussian_filter
from scipy import ndimage
import cc3d
import seaborn as sns
from os import path
import matplotlib as mpl
def Cluster_Neurons(all_cen... |
cae8d11fb5c6c854f1268c36fbc9b474a8a5e4aaee13a28d8db6ec698b3add26 | Python | 6,481 | 179 | from argparse import Namespace
from typing import Iterable, List, Optional, Tuple, Union
from lgn.models import LGNEncoder, LGNDecoder
from lgn.models.utils import resolve_tau_latent
from torch.optim import Optimizer
from torch.utils.data import DataLoader
from utils.data.dataset import JetDataset
from utils.utils impo... |
2103da5565e9ae01328b6008d4bdb2a24ac8d87e26e2d128f55dd6fc0464ec66 | Python | 6,488 | 183 | """Testing machine type converters for scitypes."""
__author__ = ["fkiraly"]
from copy import deepcopy
import pytest
from sktime.datatypes import scitype_to_mtype
from sktime.datatypes._convert import _conversions_defined, convert
from sktime.datatypes._examples import get_examples
from sktime.datatypes._registry i... |
a5c00af254a1f3927a312a1bfdac3ba9d2f35c2a6683d9c19b4f0a6a09f356c4 | Python | 6,491 | 195 | """Space normalisation for lesion images."""
import re
from pathlib import Path
from typing import Optional, Union
import nibabel as nib
import numpy as np
from nilearn.image import resample_img
from bcblib.tools.damage_profile._space import warp_binary_mask
from bcblib.tools.lesion_features._constants import TARGET... |
97eee4a9808c4e36c6f5ea73bbb71fa021c43daf20b41359a198acea68703531 | Python | 6,493 | 186 | import argparse
import json
import logging
import os
import numpy as np
from psychopy import monitors
from cred_assign_stims.generate_stimuli import generate_stimuli, \
get_cred_assign_monitor, check_reproduce
# For full ophys recording (70 min)
SESSION_PARAMS_OPHYS = {
"type": "ophys", # type of session (h... |
1865e0c59a1c7befb69c475b620ab1360b7092e6da3461cc5cff01e263fe3074 | Python | 6,495 | 174 | import numpy as np
import pandas as pd
def get_ds_infos():
"""
Read the file includes data subject information.
Data Columns:
0: code [1-24]
1: weight [kg]
2: height [cm]
3: age [years]
4: gender [0:Female, 1:Male]
Returns:
A pandas DataFrame that contains inforamt... |
40be8594a13d4995cce1be59c1498a77a815ada3a063b271bc1cd00336c210e9 | Python | 6,496 | 180 | """Learning Shapelets Classifier, from tslearn."""
from sktime.base.adapters._tslearn import _TslearnAdapter
from sktime.classification.base import BaseClassifier
class ShapeletLearningClassifierTslearn(_TslearnAdapter, BaseClassifier):
"""Learning Time Series Shapelets Classifier, from tslearn.
Direct inte... |
6115e9b6b428c68bb299ee578ff441f9774fb3ad76d89c8e3f10e93093db1f23 | Python | 6,496 | 152 | # Copyright 2011 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.
"""Test one or more populations for statistical distinguishability.
... |
68f8484d5d14d15431170424ce574fdbff7740b89d6aa166c09a823f0eb58c7e | Python | 6,497 | 222 | #%%
import numpy as np
from pkg.match import BaseMatchSolver
from numba import jit
from scipy.optimize import linear_sum_assignment
from graspologic.simulations import er_corr
import pandas as pd
class BisectedGraphMatchSolver(BaseMatchSolver):
def __init__(
self,
adjacency,
indices1,
... |
925e59785c38a00fdc60c874635cc7608b8898988fbacd7287e8a5c3d152d155 | Python | 6,497 | 190 | # !/usr/bin/env python3 -u
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Sktime window forecaster base class."""
__author__ = ["mloning", "big-o", "fkiraly"]
__all__ = ["_BaseWindowForecaster"]
import numpy as np
import pandas as pd
from sktime.forecasting.base._base import BaseForecaste... |
c7d73a1dd6a214097ba424ce045ae6031fb1b912a50732f87c1bf0d3641f9bf1 | Python | 6,497 | 193 | from __future__ import division
import os
import re
import numpy as np
import pandas as pd
from skimage import measure
from skimage.segmentation import find_boundaries
from skimage import io
from skimage.exposure import rescale_intensity
from mayavi import mlab
import warnings
from helper_lib import filelib
class I... |
f7487f1696dbae6a4742918d5549604120f216f9dbe449de219b7a8de7e3c743 | Python | 6,498 | 192 | """
@file: game_server.py
Changed last on 17.01.19
@project: crazy_ara_cleaning
@author: queensgambit and matuiss2
Handle the game server
This file contains everything related to handling the game server
"""
import json
import logging
import chess
from flask import Flask, request, send_from_directory
from DeepCrazyho... |
a67a49000f772b4ad8c116a6716dac8780da5b3fa0564ae7df1a514c809ac347 | Python | 6,499 | 121 | #!/bin/python3
# Author: Thomas Rolland jerikoo75@gmail.com
# Date: 03/31/2022
import pandas as pd
from numpy import mean
from pyliftover import LiftOver
#=========================================================================
# variant-pext.py
# Annotate pext score for each variant of tabular file
# NOTE: This scr... |
e879455135ae81798cda3c0a3a9d27a0c87715044db8599ab3ef94bcc8a747f1 | Python | 6,499 | 165 | """
This script generates figure 4e in the paper
This is the example additive model fit to a neuron during the passive condition.
Internal notes:
This is from src/data/figure_for_paper_regression_model.py
"""
import os
import numpy as np
import pickle as pkl
import pandas as pd
import src.models.kernel_regression as k... |
0a38533ae1ad1704c7d1bf81d4d5bb5c9e35f6a1c24aa98f65d49047d8174c8e | Python | 6,500 | 159 | import os
from ase.db import connect
import numpy as np
import torch
from torch.utils.data import Dataset
from torch_geometric.data import Data
from torch_geometric.loader import DataLoader as PyGDataLoader
ATOM_DICT = {1: 'H', 6: 'C', 7: 'N', 8: 'O'}
PAIR_DICT = {('Br', -1): 0, ('Br', 0): 1, ('C', -1): 2, ('C', 0): 3... |
678475509bda9c0f5490056a2a63b3711ed977ede12ff7f22d2bb407090bd0e7 | Python | 6,502 | 117 | import scanpy as sc
import numpy as np
import pandas as pd
import sys
def format_DEGs(adata):
keys = ["names","scores","logfoldchanges","pvals","pvals_adj","pts"]
for i,key in enumerate(keys):
a = pd.DataFrame(adata.uns["rank_genes_groups"][key]) # transfer to data frame
b = pd.DataFrame(a.v... |
71815ed6567c780c9373b36798c70789a087377258f7059ab20e04b25fb3b7fe | Python | 6,503 | 192 | # SPDX-License-Identifier: LGPL-3.0-or-later
import importlib
import os
import site
from functools import (
lru_cache,
)
from importlib.machinery import (
FileFinder,
)
from importlib.util import (
find_spec,
)
from pathlib import (
Path,
)
from sysconfig import (
get_path,
)
from packaging.specifi... |
a3e63c36ab391931a20748a2085807ad34c5d8a2b3dbf36dffa10787a3023003 | Python | 6,505 | 165 | """
This script generates figure 4e in the paper
This is the example additive model fit to a neuron during the passive condition.
Internal notes:
This is from src/data/figure_for_paper_regression_model.py
"""
import os
import numpy as np
import pickle as pkl
import pandas as pd
import src.models.kernel_regression as k... |
bcce1c7b6a1c1f3a28e29d821f356c68f103f80fcd4499e151006e190852ef83 | Python | 6,506 | 155 | """
@file: neural_net_api.py
Changed last on 16.01.19
@project: crazy_ara_cleaning
@author: queensgambit and matuiss2
Make the project NN easier to use
This file contains wrappers for NN handling
"""
import glob
import os
from multiprocessing import Queue
import mxnet as mx
import numpy as np
from DeepCrazyhouse.conf... |
8ccbf5b3ce4a185c25a56a8957736eba32170aba1eeaa0b708145f99116d65d9 | Python | 6,508 | 189 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
"""Atheris fuzz harness for onnx.shape_inference.
Two input paths are exercised per iteration, selected by a fuzzer-controlled
toggle byte read from the *tail* of the input (so the head remains a valid
candidate for the raw-bytes path):
*... |
cc91fb28f189dcb8ce1cafb40905403d27ce3b932b4e2f9a3013bab8e99738c9 | Python | 6,508 | 189 | import os
from pathlib import Path
from typing import Any, Iterator, Tuple
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
from torch.nn.modules.loss import BCELoss
from torch.optim import Optimizer
from torch.utils.data import DataLoader
from data.dataset import AudioDataset
from data.sampl... |
6ceace87bf6381f7049a7b2719c892bfa82ca77947b671a4a4809a56d071afc9 | Python | 6,513 | 215 | import os, pickle, pprint
import numpy as np
import neuron
import cnmodel
import cnmodel.cells as cells
from cnmodel.util import UserTester, reset
from cnmodel.protocols import IVCurve
"""
Cell-type tests
"""
def test_bushy():
reset(raiseError=False)
cell = cells.Bushy.create(species='guineapig', modelType='... |
b75b87ac536db45b95030918b00e317c6f6c2c6148f6e02fad75263dee3aaa0b | Python | 6,513 | 182 | #!/usr/bin/env python
__doc__ = """
Training Script
Put all the ugly things that change with every experiment here
Nicholas Turner, 2017-8
"""
import os
import collections
import torch
import tensorboardX
import utils
import train
import loss
def main(**args):
#args should be the info you need to specify t... |
d6797414fadcfdbde08d227415eda7d6d4445b995ccc55d79c724965d8dd9385 | Python | 6,514 | 176 | """K-nearest neighbors time series classifier, from pyts."""
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
__all__ = ["KNeighborsTimeSeriesClassifierPyts"]
from sktime.base.adapters._pyts import _PytsAdapter
from sktime.classification.base import BaseClassifier
class KNeighborsTimeSeriesC... |
0574de2ba46b8ff135c0562c176768a51d19e2ee430d0aa618d577ff28c02131 | Python | 6,515 | 157 | import unittest
from pyontutils.core import OntGraph
from pyontutils.namespaces import ilxtr
#from neurondm import simple
from neurondm.core import (Neuron, Phenotype, IntersectionOf, IntersectionOfPartOf, UnionOf,
Config, LogicalPhenotype, OR, EntailedPhenotype, EntailedLogicalPhenotype)
# F... |
f38d5f26c0e43d3416749012ed1403182f221dc43cc464b2d9f2391634748603 | Python | 6,515 | 198 | #!/usr/bin/env python
from Bio import SeqIO
import click
import copy
from itertools import zip_longest
import numpy as np
import os
import pandas as pd
import random
import re
from sklearn.preprocessing import OneHotEncoder
import sys
sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),
... |
7d1974ba5a7008a322a061a7f0234c0aef33e7d6d1e6dc72c08988122d42ee2b | Python | 6,518 | 244 | """Alignment path plotting utilities."""
import numpy as np
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.dists_kernels._numba_distances._distance import (
distance_alignment_path,
pairwise_distance,
)
_check_soft_dependencies("matplotlib", severity="warning")
def _path_mask(co... |
940577cde813f20a530cc354802809f4e0b2dee239e925b0443ba6f1da49a93a | Python | 6,518 | 177 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
# Ported from skchange (BSD-3-Clause), original authors: Tveten
"""Tests for the CAPA detector."""
import numpy as np
import pandas as pd
import pytest
from sktime.detection._anomaly_scores._l2_saving import L2Saving
from sktime.detection._change... |
03fb40ad2828484bd9b20188d3f512a768ade394506209e30e30e2d4be22a9e1 | Python | 6,519 | 189 | """BIDS path utilities for the lesion_features pipeline."""
import re
from pathlib import Path
from typing import Dict, Iterator, Optional, Tuple
from bcblib.tools.lesion_features._constants import LF_SUBDIR
def parse_bids_entities(path) -> Dict[str, Optional[str]]:
"""Parse BIDS entities from a filename.
... |
930d599e2a8f8e99b0994c45e042df4cb065a7ba780c9dce994848c30a70540a | Python | 6,520 | 199 | # 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
#
# ... |
8deee109ff3b12bc335a33eb3ee4e5f516840c6f6d005606d647c06188c514ce | Python | 6,524 | 181 | """Wrappers to convert distance to kernel or kernel to distance."""
__author__ = ["fkiraly"]
import numpy as np
from sktime.dists_kernels.base import BasePairwiseTransformerPanel
SUPPORTED_MTYPES = ["pd-multiindex", "nested_univ"]
class IndepDist(BasePairwiseTransformerPanel):
r"""Variable-wise aggregate of m... |
bafccfb06dbcd018b7e492a053dd3ade989b5befc301d6a0f6af5cdc0a67388a | Python | 6,524 | 138 | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 25 10:58:01 2016
@author: wanglab
"""
from scipy.ndimage.filters import gaussian_filter as gfilt
from scipy.ndimage import label
import numpy as np
import sys, os
from collections import Counter
from tools.expression_mask.mask import make_mask
from tools.utils.io import ... |
5e7a92be3b2f020169091163b29a14a248a0097218a77166d53b1862f605f408 | Python | 6,525 | 209 | # 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... |
901d026862962c16c77d4469bc4fd1a8cf1b5d06c45c10cab9392f5334ff9b3f | Python | 6,528 | 181 | # 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... |
1137034f960f4e651e1be83b1f33eab1cb9ec70183c0d2ddb695f3fa8b89d3d9 | Python | 6,531 | 183 | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import copy
import os
import os.path as osp
import time
import warnings
import mmcv
import torch
from mmcv import Config, DictAction
from mmcv.runner import get_dist_info, init_dist
from mmcls import __version__
from mmcls.apis import init_random_seed, s... |
202b0db96691a11f7afab6f469abbf00c7e0ce4d25bbf4f3aef2365f10e1001f | Python | 6,534 | 195 | # 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... |
3015a492290e74fad10786171f1f17b72ba2b90f3180f263c67a28bdefd67b6d | Python | 6,536 | 183 | # 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... |
43ef648ee26e65f65710da84089cd65aa7041a01497402ca633a91bdd3061589 | Python | 6,536 | 211 | # 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
#
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# ampligraph documentation bui... |
fdd49487b9aa3c6331677a351272dea36094ea54bae8c1b94178ae31c6be0ab2 | Python | 6,537 | 142 | import torch
from torch import nn
import transformers
from transformers import activations
from transformers import DistilBertTokenizer, \
DistilBertForSequenceClassification, DistilBertModel, DistilBertPreTrainedModel, Trainer, TrainingArguments,EvalPrediction, AutoTokenizer
from torch.nn import BCEWithLogitsLoss, Cro... |
05271d0f7c96a1e451b65ecf98917e80282576c059d98883bfd818b51a6cb2b8 | Python | 6,540 | 155 | # Definition of
# 3D UNet
# Author: Zhe Liu (zl376@cornell.edu)
# Modified by: Jinwei Zhang (jz853@cornell.edu)
# Date: 2018-08-27
from keras import backend as K
from keras.layers import Activation
from keras.layers import Input
from keras.layers import BatchNormalization
from keras.layers import MaxPooling3D
from k... |
fd06b673baaa6e20dab17e4f924f054a3f6388cabdb6b7268d350c9352995d02 | Python | 6,540 | 173 | import augpathlib as aug
from pyontutils.config import auth
from pyontutils.core import OntGraph, OntResPath
def _genlabel(oid):
x = (oid.rsplit("-", 3)[-3]
if oid.endswith('-prime')
else (oid.rsplit("-", 3)[-3] if 'unbranched' in oid else oid.rsplit("-", 2)[-2]))
l = (oid.rsplit("-", 3)[-3]... |
c6f086ef5e251eeafe863d1a486a9ae612320389c5a0e36e945c28f015af1d20 | Python | 6,541 | 155 | # Definition of
# 3D UNet
# Author: Zhe Liu (zl376@cornell.edu)
# Modified by: Jinwei Zhang (jz853@cornell.edu)
# Date: 2018-08-27
from keras import backend as K
from keras.layers import Activation
from keras.layers import Input
from keras.layers import BatchNormalization
from keras.layers import MaxPooling3D
from k... |
a5d2bd3fe85f8a54b1dd07a286f7417a6ccc8a38ed4b38a4a04385495aef653e | Python | 6,546 | 196 | """Tests for the BaseDetector class."""
__author__ = ["Alex-JG3"]
__all__ = []
import pandas as pd
import pytest
from pandas import testing
from sktime.detection.base import BaseDetector
from sktime.tests.test_switch import run_test_for_class
@pytest.mark.xfail(reason="Changed interface, need to update test")
@pyt... |
4f39075b81826d06ceeba4a41f23bee0ca6892e8eddca1d143bd0e30d5349b44 | Python | 6,549 | 164 | import argparse
import os, sys, pickle
from datetime import datetime
from math import inf, log, log2, exp, ceil
import torch
from torch.utils.data import DataLoader
import torch.optim as optim
import torch.optim.lr_scheduler as sched
from cormorant.engine.args import setup_shared_args, BoolArg, Range
import logging
... |
ad88f298dfd36db0163a25781fb3161d367296715054ae16538678efa2ce391a | Python | 6,552 | 186 | # 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... |
7f18aec0fd9e4376415e96ef1156517e7a4e1a89ec3eda8d112608e9f23c7e82 | Python | 6,556 | 277 | #-------------------------------------------------------------------------------
# elftools: dwarf/constants.py
#
# Constants and flags
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
from __future__ import annotat... |
8c0269316ff5bf8c6a0a17d7df4c133489c8936c861909029023ba7ea2518881 | Python | 6,558 | 175 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This prog... |
f1c37f85007248687a5a881f50c8ff6b89b18c4fbc8a1f049babfb654ef75246 | Python | 6,564 | 136 | from .normalization import cast_to_typed_array
from .normalization import normalize_by_MAD
from .normalization import center_to_mean
from .normalization import pad
from .bias_and_artifact_correction import correct_bias_field
from .bias_and_artifact_correction import remove_grid_artifact
from .modify_velocity_fields i... |
0a90f871dd2b7b0f431c6a6b98841f867f3dd32a0337288e263f5861a721896c | Python | 6,565 | 164 | # -*- coding: utf-8 -*-
#
# Copyright © 2013 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 pyfnutils as p... |
cdbc5bef64c6d3b5095647fa8d0a006c99e69777cde59958d302bd0523ab2b22 | Python | 6,566 | 115 | #-*- coding: utf-8 -*-
import argparse
import numpy as np
parser = argparse.ArgumentParser(description='Configuration file')
arg_lists = []
def add_argument_group(name):
arg = parser.add_argument_group(name)
arg_lists.append(arg)
return arg
def str2bool(v):
return v.lower() in ('true', '1')
net_a... |
a3911c51027b5ca475e5bcf97542034acfaedf5e88ff25bea4b04a59e63325f6 | Python | 6,567 | 211 | """Helper classes for organizing docopt programs
Usage:
clifun-demo [options]
clifun-demo sub-command-1 [options] <args>...
clifun-demo sub-command-2 sub-command-1 [options] <args>...
Usage-Bad:
Example:
clifun-demo [options] <args>...
clifun-demo cmd [options]
Reason: <args>... ma... |
da620d6d35b563ead05fa30bbebfb2dd0e7d2e997741f88a17c41d272d46832c | Python | 6,569 | 169 | # -*- coding: utf-8 -*-
#
# Copyright © 2013 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/.
#
"""Interface with the `STAR <https://github.com... |
199d6fa86372cd75d7a4c735406fc6542f2986294b05677285e1b35decbf01cb | Python | 6,573 | 149 | import os
import sys
import stat
from os.path import join as pjoin, exists as pexists, realpath
import numpy as np
import pickle
import networkx as nx
from neuropredict import run_workflow
from pyradigm import MLDataset
from graynet import parcellate
from graynet.volumetric import volumetric_roi_info
"""#-------------... |
898b3d268352406701a54e4d52541c772d282db178e77beee47174b8f7ab088b | Python | 6,575 | 152 | import collections as col
import logging
import os
import re
import sys
from rdkit import Chem
from rdkit import rdBase
from rdkit.Chem.rdchem import HybridizationType
from rdkit import RDConfig
from rdkit.Chem import ChemicalFeatures
import click
import numpy as np
import atom3d.datasets.datasets as da
import atom3d... |
8f7825219e33e13f76a85d2e468f5a88813e605279dfcf63d62f57482a2b7370 | Python | 6,575 | 155 | import itertools
import logging
import os
import re
import shutil
from textwrap import wrap
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import torch
from tensorboardX import SummaryWriter
import utils.evaluator as eu
plt.switch_backend('agg')
plt.axis('scaled')
# TODO: Add custom phase nam... |
8b60159b25e75d80ab4a64a8fd3a31b3eadfe053a9d954f5b9fffd32882e97bf | Python | 6,578 | 163 | import os
import numpy as np
import torch
from torch.utils.data import Dataset
from torch_geometric.data import Data
from torch_geometric.loader import DataLoader as PyGDataLoader
from rdkit import Chem
from dataset.utils import ani1x_iter_data_buckets
ATOM_DICT = {1: 'H', 6: 'C', 7: 'N', 8: 'O'}
PAIR_DICT = {('Br', ... |
a65d8ddaf3b25970e3b662f93c8a26f886ae2662742ce716e9e4980378fccd7f | Python | 6,582 | 137 | #-------------------------------------------------------------------------------
# elftools example: dwarf_member_addresses.py
#
# Find addresses of direct data members in global class/struct objects.
# DW_AT_location describes the object's location, while DW_AT_type refers to
# its class/struct definition. For a DW_TA... |
b7670dd7394d9430383d4b9e8ac58d34edeb60fccdd1787b683ea17b93f67dff | Python | 6,582 | 131 | # In Nomine Functions Team
# distributed under license: GPL 3 License http://www.gnu.org/licenses/
import argparse
import os
import sys
from subprocess import call
class Downloader:
def __init__(self):
parser = argparse.ArgumentParser(description='In Nomine Function downloader')
parser.add_argum... |
109d604ebd155077d733274d24a7bf3c8a717e2761680e9ec5f0b696f71347d0 | Python | 6,583 | 173 | # SPDX-License-Identifier: LGPL-3.0-or-later
import json
import os
import shutil
import tempfile
import unittest
from copy import (
deepcopy,
)
from pathlib import (
Path,
)
import numpy as np
import paddle
from deepmd.pd.entrypoints.main import (
get_trainer,
)
from deepmd.pd.train.training import (
... |
ba967580f9cbc5808effb5e4c8dd909aad394aae40bfe36b46d0d14ad3c462e8 | Python | 6,583 | 145 | import pickle
from os.path import exists as pexists, join as pjoin
import networkx as nx
import numpy as np
from neuropredict import run_workflow
from pyradigm import MLDataset
from graynet import parcellate
"""#---------------------------------#---------------------------------#---------------------------------
Yo... |
5c228575a976fc01ba7f2773f9445458a349a6e2c50732c5bf8cfc0dff8796f4 | Python | 6,584 | 223 | # 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
#
# ... |
1e07888046cc1abe1c9a1bf1cc7600fe098fc85b7f37363e4bb6ca43f6611314 | Python | 6,586 | 204 | #!/usr/bin/env python3
# Copyright (C) 2019 Christoph Gorgulla
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# This file is part of VirtualFlow.
#
# VirtualFlow is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the ... |
3426606d85c875568e2901c0979c521c07097ac5ee1877edeaebf2b74b1ae26f | Python | 6,587 | 213 | import stream as st
import os
# from pathlib import Path
import tarfile
import tempfile
from shutil import rmtree
# import pandas as pd
# from pandas.api.types import is_numeric_dtype
# import numpy as np
_root = os.path.abspath(os.path.dirname(__file__))
def stream_test_Nestorowa_2016():
workdir = os.path.join... |
d30e597615421a6134ff2f8132263bfaacbe95f201cb395e3e92eb8d4cd54713 | Python | 6,590 | 170 | """
This script generates figure 4A in the paper
This is the example additive model fit to a neuron during the active condition, showing the kernels fitted.
Internal notes:
This is from src/data/figure_for_paper_regression_model.py
"""
import os
import numpy as np
import pickle as pkl
import pandas as pd
import src.mod... |
66fb4f52d2f068e2f8d19343fdd76a979bbb82622a6d6d24358c97be5f8db781 | Python | 6,592 | 167 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch
import torch.nn as nn
from ..builder import LOSSES
from .cross_entropy_loss import CrossEntropyLoss
from .utils import convert_to_one_hot
@LOSSES.register_module()
class LabelSmoothLoss(nn.Module):
r"""Initializer for the label smoothe... |
999b6d7fd5c23ce41757ed8ca9b17d377c4f72108829289d6221d713227716f8 | Python | 6,592 | 199 | # 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... |
13bc0ce867cb77da45a721b8ffeaad02c1a748a044e462d1acf9789559ae98f8 | Python | 6,594 | 242 | """Tests for the click command line interface."""
from pathlib import Path
from click.testing import CliRunner
import pytest
from corset_tools import __version__
from corset_tools.cli import main
from corset_tools.fileio import read_fasta
@pytest.fixture
def runner() -> CliRunner:
"""
Build a click test ru... |
c6c5714ad99a2c731637c17541ff026ec6f58b9e8e12b158f06e0390f58d544d | Python | 6,596 | 128 | import os
import pandas as pd
import numpy as np
import sys
sys.path.insert(1, "/Users/hyung/Research23_Network_Analysis/mBIN/Python/InvivoAnalysis/")
from LoadNetworkDataByID import LoadNetworkDataByID
sys.path.insert(1, "/Users/hyung/Research23_Network_Analysis/mBIN/Python/LBD/")
from findPathCoM import findPathCoM
... |
33d2a320ce2928f349801fa037fc40f0dc6f0312bc6dca9f3e674cdfb62c79d6 | Python | 6,598 | 215 | # 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... |
9d9045c166c215bb858ec6748d3bf986665ef13741b29dcbe50d4c55a6a714e0 | Python | 6,600 | 166 | import os
import gc
import numpy as np
from openmm.unit import *
import torch
from torch.utils.data import Dataset
from torch_geometric.data import Data
from torch_geometric.loader import DataLoader as PyGDataLoader
from dataset.utils import ani1x_iter_data_buckets, anidataloader
from rdkit import RDLogger
RDLogger.D... |
dc894920bd6fdf9600410f7770232b7fb6950394bcaf0d8194ed6d56c1756546 | Python | 6,601 | 195 | # 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... |
95720d4513eff04f749d159c1370f0c01281955c8de83876e88a0fdcac53d4f0 | Python | 6,603 | 165 | """
This scripts generates figure 5a : Cumulative histogram of auditory left/right selectivity
Internal notes:
from the notebook : naive-vs-proficient-mice-passive-prop-sig-neurons
"""
import pandas as pd
import pickle as pkl
import numpy as np
import os
import glob
import matplotlib.pyplot as plt
import matplotlib a... |
856937e5b95be3be7ad985ec49a7996564b9965ed2c9023a283a611d58604765 | Python | 6,605 | 198 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Tests for the backend-independent training-step schedule."""
import numpy as np
import pytest
from deepmd.dpmodel.train import (
resolve_step_schedule,
)
class FakeData:
"""Training-data stand-in reporting a system count."""
def __init__(self, nsystems: i... |
5075d7432cedb54303160fae1b630a1218899cfb314982957616c7ec748dc1e5 | Python | 6,610 | 138 | """Bounds checks for file-backed section and segment data."""
import unittest
import zlib
from contextlib import contextmanager
from io import BytesIO
from tempfile import TemporaryFile
from types import SimpleNamespace
from unittest.mock import Mock, call
from elftools.common.exceptions import ELFCompressionError, EL... |
0a43799641faf51d34e645a7d32b5c2291dc1fae5feb800b1fe689bb2c616494 | Python | 6,612 | 191 | # 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... |
8b4f37f15e2517c2e104f3a904958b2b5a5f15ae176579e731ab9a215e3bf6d7 | Python | 6,615 | 182 | # 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
class Scan(OpRun):
def __init__(self, onnx_node, run_params):
OpRun.__init__(self, onnx_node, run_params)
if not hasattr(... |
97ed958ce2847373350d1323633a636f7a62f531ddc381883b57d26345ae974d | Python | 6,615 | 178 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import os
import platform
import sys
from typing import Any
import numpy
import version_utils
import onnx.backend.base
import onnx.backend.test
from onnx import ModelProto
from onnx.backend.base import... |
54a248fb9fab499966d3041730bf8b9cf572ccc254436bb8905b045ac19b4a6b | Python | 6,616 | 179 | import pandas as pd
import matplotlib.pyplot as plt
from itertools import groupby
from operator import itemgetter
def flatten(list_of_lists):
return [item for sublist in list_of_lists for item in sublist]
df = pd.read_csv("/Users/darrin/Downloads/caps_and_rhopilema_info.tsv",
sep = "\t", i... |
e4faf41b5d0bfac9659892208eafdcc9bf1dc32c6497118f03c793947aa69773 | Python | 6,620 | 157 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from ..plotting import _npedges2dfedges, _get_nodes_from_nii
def get_frame_input(inputvar, axind, ri, fi, nrows, frames):
"""
Gets subplot variable.
The variable depends on whether the
input is a string, array or 2d array.
"""
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.