sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
07ef75fb098db92c61223538d1da0b1887339f96209ecae297bc001d5de52ff2 | Python | 5,324 | 142 | # 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... |
40d96b02cee90cc3c2fb775eabca8c5347539c6a53f52197a9b55f0c9b8577e2 | Python | 5,325 | 144 | # Read colors and generate the scores
import os
import os.path as osp
import torch
import dill
import numpy as np
import pandas as pd
from molucn.evaluation.explain_color import get_scores
from molucn.evaluation.explain_direction_global import get_global_directions
from molucn.evaluation.explain_direction_local import ... |
bc5295113f38ff66e92d7c73feeb18e58a0edb94c64956e53f65142728c27837 | Python | 5,328 | 183 | __author__ = ["chrisholder", "TonyBagnall"]
from collections.abc import Callable
import numpy as np
from sktime.dists_kernels._numba_distances.base import DistanceCallable
from sktime.utils.numba.njit import njit
@njit(cache=True)
def _make_3d_series(x: np.ndarray) -> np.ndarray:
"""Check a series being passed... |
290b483fd1e00d367e63b5d5d5834702924d098b6575640d652b34d5e1fe3f86 | Python | 5,331 | 168 | import errno
import json
import os
import shutil
import subprocess
DEFAULT_RUNTIME = "python"
MANIFEST_FILE = "MAR-INF/MANIFEST.json"
def create_file_path(path):
try:
os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
... |
79ed07c00c92657abba4f41deaa7843197b67b82a9a9953bf4278c062e9772fc | Python | 5,331 | 169 | # 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... |
774bb2a66d42f42433452b9d8d9f6d43605b067ab829f2ed17919060c3c0b3d9 | Python | 5,333 | 141 | # 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... |
ad3e18278d04bba3a35bb56392e77bf303482d0ba37eadf63ea288aaca2b7dd3 | Python | 5,337 | 140 | import numpy as np
import pandas as pd
import os
import torch
import random
import math
import scipy.spatial
from atom3d.util.transforms import prot_graph_transform, PairedGraphTransform
from atom3d.datasets import LMDBDataset
from torch_geometric.data import Data, Dataset, Batch
from torch.utils.data import IterableD... |
b9da84f9aa85616ddd17df47801c93ccd3476b81430b10de351afb5bc1a48bc3 | Python | 5,338 | 183 | import numpy as np
""" EXTREMELY IMPORTANT CROPPING FUNCTION:
given center point (x, y, z), will crop a FOV of size crop_size x crop_size x z_size around input_im
"""
def crop_around_centroid(input_im, y, x, z, crop_size, z_size, height, width, depth):
""" ADDING + 1 shifts it to ... |
0a8ec2372ec27b962bdbe8d9d060b46617c60f02a282a5ffc158af0b57409eef | Python | 5,339 | 151 | # 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
#
import tensorflow as tf
from .AbstractScoringLayer import register_layer, Abstr... |
713197e6878acc58aed3e57388d404c8c8f06aa0f9b1a646097f904960a9380f | Python | 5,339 | 158 | # 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... |
06b867826d6c4b5d54d32b1c85bc12d6ce03e5e8fad8508c573c8befbcbd174e | Python | 5,343 | 160 | # 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 SpaceToDepth(Base):
@staticmethod
def export() -> None:
... |
47d2aa39ae08558f1fb630ddce13b29348ca8a5f1eb7370f0afc4402c2cd85e3 | Python | 5,343 | 130 | # 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
#
import ampligraph
# Benchmark datasets are under ampligraph.datasets module
fr... |
a175a6edf48fb0930667c16473781b47ea591a82e0a2154b725d843902e44547 | Python | 5,343 | 157 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 3 08:18:52 2018
@author: tpisano
sudo apt-get install python-vtk
conda create --name mayavi python=3 scikit-learn pandas numpy scikit-image
pip install mayavi
pip install PyQt5
source activate mayavi
"""
import plotly
import plotly.plotly as py
i... |
69c7abf40b30c3b8372a29aa44dbd90f510ad3821ab1e6f7e4dff5b56c9e991f | Python | 5,348 | 153 | """
Tool for making sure that the VCN cells are properly populated
with hoc files, and to list the simulations in the cell directories
Also see make_shared_datasets.py in the util subdirectory.
This module is part of *vcnmodel*.
Support::
NIH grants:
DC R01 DC015901 (Spirou, Manis, Ellisman),
DC R01 DC0... |
11b4133a9ce055e47c152fdae91e11a21be6eb90cf99facdc296de9d314c7990 | Python | 5,349 | 167 | # 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_concat_from_sequence import _concat_from_sequence
from onnx.reference.ops.op_dft import _cfft as _dft
from onnx.refe... |
4bf1bff59cab47ed5c73abb17a45e4328c60027fec6728cd73e784aa4ed5fad6 | Python | 5,349 | 172 | """TEASER test code."""
import numpy as np
import pytest
# from numpy import testing
from sklearn.ensemble import IsolationForest
from sktime.classification.early_classification._teaser import TEASER
from sktime.classification.interval_based import TimeSeriesForestClassifier
from sktime.datasets import load_unit_tes... |
8b625cdcb1755a09adbe3ce8237297d95eb25f5fe0f5141346aea4ab72fc5514 | Python | 5,352 | 155 | """Generate colored noise."""
from typing import Union, Iterable, Optional
from numpy import sqrt, newaxis, integer
from numpy.fft import irfft, rfftfreq
from numpy.random import default_rng, Generator, RandomState
from numpy import sum as npsum
def powerlaw_psd_gaussian(
exponent: float,
size: Unio... |
f28ffac739e098b471bab3c51c42c522f3e6731d46ac60cab96f098b61f3002d | Python | 5,353 | 132 | #!/usr/bin/env python
"""
Script: run_best_overlap.py
Description: Command-line tool to run the preserved-connectivity analysis.
For each patient disconnectome and cluster disconnectome combination,
computes preserved connections (cluster_prob × (1 - patient_prob)),
extracts size-... |
69b77dd35e93ece77c60a099eab1956de9eda6f89fc5674b525d3fcf343db03d | Python | 5,354 | 125 | # SAFE TEAM
#
#
# distributed under license: CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) #
#
import tensorflow as tf
class Network:
def __init__(self,
features_size,
embedding_size,
max_lv,
T_iterations,
learning_rate,
l2_reg_l... |
6c77d32e4c6fe61079e283921321051026d7c4f007aa93a9896abd4901f543e6 | Python | 5,354 | 198 | #%%
import datetime
import os
import time
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from giskard.plot import adjplot, matched_stripplot, matrixplot
from pkg.io import OUT_PATH
from pkg.io import glue as default_glue
from pkg.io import savefig... |
6d8e093340d5e8b30d6f66622b3e92ef8e5ef0b25b19b0838f46221fbbc49f86 | Python | 5,361 | 180 | # 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... |
c3813e4049c9fcfd0cd1f46314f63fbd60f398cb7b02ec16e564cf1ab008a510 | Python | 5,361 | 153 | # 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... |
39bbd8a227e3dd7c749f2f3df7819fb236906948371efe8543e470dac3cab2af | Python | 5,365 | 151 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
# Ported from skchange (BSD-3-Clause), original authors: johannvk
"""Linear regression cost function."""
__author__ = ["johannvk"]
import numpy as np
from sktime.detection.costs._base import BaseCost
def _linear_regression_cost(X_features, y_r... |
6426faa604ea7897e20dd443bb970cb360dc77eabffe49136c0b744786b80b23 | Python | 5,365 | 95 | # -------------------------------------------------------------------------------
# elftools: tests
#
# LeadroyaL (leadroyal@qq.com)
# This code is in the public domain
# -------------------------------------------------------------------------------
import unittest
from elftools.ehabi.decoder import EHABIBytecodeDec... |
4e7922d5879af995fe3fc217fb7026e59cbaf18a2e68ad45fa84bad925bc5b2a | Python | 5,366 | 169 | # 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... |
6495d7fd5ba3bfd0fb9e297ccb75f930ec5c553a5c622f0ab5d72c693b32196f | Python | 5,368 | 146 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import unittest
import pytest
import onnx.backend.test.runner as runner_module
from onnx import checker
from onnx.backend.base import Backend, BackendRep
from onnx.backend.test.case import node
from o... |
7ce3d3f4e40e946c6a35b4ca8cd566a15af550d1fe8c5fd3c85aa89b77506027 | Python | 5,368 | 161 | # 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 DeformConv(Base):
@staticmethod
def export() -> None:
... |
a215c40771ab99e75157b2a8804328c5546b0d9ac6d3a878407a5212337e50a2 | Python | 5,368 | 175 | # -*-coding:utf-8-*-
# from __future__ import absolute_import
import torch.nn as nn
import torch.nn.functional as F
import math
def conv1x1 (in_planes, out_planes, stride=1):
return nn.Conv1d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False)
def conv1x3 (in_planes, out_planes, stride=1):
re... |
9fa99a24d1f056ccff347e3c92334405f9523375e8eb8ae3ce02a96cc9abec84 | Python | 5,373 | 163 | # 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... |
d7bbfe6b150723ea3842b981f4ed7a7efddd0df47555c53b164dde01d3df471c | Python | 5,373 | 135 | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
0adb6b8527ecc455bf2825444425abd24364f67c6e8f774817235aa77beda188 | Python | 5,377 | 176 | # 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... |
aa6b780470a383bfb4922c5a2ebe887bfbce8a8cee8dcb1c6ac78e96a6abf9c5 | Python | 5,379 | 164 | # 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... |
21b20da4bc7d0e34aee2059912f1824c1006da3a57426f6fc70d56c39fdf47a9 | Python | 5,381 | 164 | # 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... |
24d9f6fe73fadc38bcf08ddd0b7ecdf4f026ebf00e5a55a5ee320f576901364f | Python | 5,381 | 144 | import logging
from sklearn.preprocessing import MinMaxScaler, LabelEncoder, OneHotEncoder, StandardScaler
from sklearn.model_selection import GroupKFold, ShuffleSplit, StratifiedKFold, GroupShuffleSplit, KFold
import numpy as np
import pandas as pd
import sys
import importlib
import random
config_path = ".".join(["mo... |
d05382daff5ef2496a1fedfb55fc346cd18ea163f61cd0e1d8472f5021b52e7f | Python | 5,381 | 168 | # 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
#
# ... |
f72e349732dd78efd34045823560d7e8f776ca6d2a7485abc78005f3def01915 | Python | 5,382 | 122 | 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... |
890d6b3b9782cbc4ea64caf77fb7e099d0cdfcd449b73a71b821b6c25ac20bc8 | Python | 5,383 | 197 | """
Various containers.
"""
from __future__ import annotations
from collections.abc import MutableMapping
from functools import wraps
from pprint import pformat
from typing import IO, TYPE_CHECKING, Any, Literal, overload
if TYPE_CHECKING:
from collections.abc import Callable, Iterator
from typing import Conc... |
3b41773a12d731e8b527a5d61e781a08a0e1c165cbbe6c4745ca1160f160df1f | Python | 5,384 | 148 | import math
from collections import defaultdict
import random
from scipy.special import gamma
from tqdm import tqdm
import numpy as np
from tqdm import tqdm
from bcblib.tools.general_utils import open_json
from scipy.stats import kruskal
# NOTE: This is the original implementation used in [paper citation].
# It is... |
724a9596238e014147a1fe4c6afb32bbe1c1f47e57349a4911c9fa2904f4561a | Python | 5,384 | 187 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Implements ARCH and GARCH models."""
__author__ = ["eyjo"]
__all__ = [
"StatsForecastARCH",
"StatsForecastGARCH",
]
from sktime.forecasting.base.adapters._generalised_statsforecast import (
_GeneralisedStatsForecastAdapter,
)
c... |
661d9cf55e062f12abeedd286272241fed1591b0d366e6a4addd68d703026295 | Python | 5,389 | 165 | import os
import os.path
from neuron import h
import pylibrary.Utility as U
from ..util import PlotHelpers as PH
import numpy as np
import scipy
import scipy.integrate
import scipy.stats
try:
import pyqtgraph as pg
HAVE_PG = True
except ImportError:
HAVE_PG = False
from ..util.stim import make_pulse
#imp... |
384d97bd0c62ec4ac839bbc55de8e0c7eb6e68693d146dcd854debe03026c6fd | Python | 5,391 | 164 | # Mocapy: A parallelized Dynamic Bayesian Network toolkit
#
# Copyright (C) 2004 Thomas Hamelryck
#
# This library 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... |
856bfa4b2807c1c7cd62f7ae00a42ec72e284a6ce96c2e67b9b357daf12f3344 | Python | 5,394 | 148 | """Functions to compute features across epoched data."""
from importlib import import_module
import numpy as np
###################################################################################################
###################################################################################################
def p... |
f3e7b454095c15be172ca063894e99d242f2036fd2a06fc6a75efcbc73002e77 | Python | 5,399 | 161 | # 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... |
12e4c94ada4c2f2027d67630da434a5d0862b7722b2110260c84d1e3f5651451 | Python | 5,400 | 208 |
"""`ModelService` defines an API for base model service.
"""
# pylint: disable=W0223
import ast
import json
import logging
import os
import time
from abc import ABCMeta, abstractmethod
class ModelService(object):
"""
ModelService wraps up all preprocessing, inference and postprocessing
functions used b... |
4ca43ca28bd6fc5c1f6eb921f482f9ef0fde26956bdc4f3445c47de5e2079db4 | Python | 5,400 | 113 | import numpy as np
from matplotlib import transforms
from matplotlib.collections import LineCollection
import pandas as pd
def _plot_connectivitymatrix(ax, edges, nodes=None, node_color=None, node_colorby=None, **kwargs):
"""Plot connectivity matrix
Args:
ax (matplotlib ax)
edges (pandas dataf... |
78536de00b1f5e90e20c3a3acf1b486131a9f844aa28784bf98b8e20e5c2cfc3 | Python | 5,400 | 106 | """Source-catalogue terminal descriptors without expression or held-out labels."""
from collections import defaultdict
from functools import lru_cache
from pathlib import Path
import numpy as np
from .model import splice_structure_tensors
from .structure import _attribute, _open_text
ANNOTATIONS = {
"cross_dono... |
34bb31b3a3275f0f04a972d25c5e8ea81a4b5dec0761c255dbe941c9e5179165 | Python | 5,402 | 151 | # 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... |
3d638eb346b5bcf6128e9839145f662df40cf70b66448fafffd0e09ef8d49109 | Python | 5,402 | 184 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# gumpy documentation build configuration file, created by
# sphinx-quickstart on Mon Jan 29 16:56:59 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# auto... |
8c5b0aa100dd68292796f5dedd60aeb358eb8048b8bc03f1ff31e893eeaa029f | Python | 5,404 | 134 | #-------------------------------------------------------------------------------
# elftools tests
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
import os
import unittest
from io import BytesIO
from elftools.comm... |
db6453e7a50fefe19550bd2c4364ba5b77f9a9d1bb7a35723dc1f717b9c94e1b | Python | 5,406 | 131 | """
Compare the simulation speed of the different backends
William Nourse
September 9 2021
The correct term is Babes, sir
"""
import numpy as np
import torch
import time
import pickle
from sns_toolbox.neurons import SpikingNeuron
from sns_toolbox.connections import SpikingSynapse
from sns_toolbox.networks import Netw... |
29ba26356b928041d05766f2730d178b4c884870a706de75451807b82e384d7b | Python | 5,408 | 119 | # -*- coding: utf-8 -*-
"""
Created on Thu December 10 11:41:02 2022
@author: Pawan Panwar, Quanpeng Yang, Ashlie Martini
PyL3dMD: Python LAMMPS 3D Molecular Dynamics/Descriptors
Copyright (C) 2022 Pawan Panwar, Quanpeng Yang, Ashlie Martini
This file is part of PyL3dMD.
PyL3dMD is free software: you ... |
a356a4708c96efaa016d6310363918b1aa94a66a32942d2b2493fb47c4a13d89 | Python | 5,409 | 144 | # 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... |
b999966eea5351c645b10695aa53557de183554e68d7609f3e851f131af801df | Python | 5,410 | 139 | # 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... |
f8b7d29893f3221eb3b704ac3bf0a46cd5aa4151b016567f4993a9079ad65d62 | Python | 5,410 | 157 | # coding=utf-8
"""
On The Fly Codec tester
"""
from collections import namedtuple
import pytest
import ts.protocol.otf_message_handler as codec
from builtins import bytes
@pytest.fixture()
def socket_patches(mocker):
Patches = namedtuple('Patches', ['socket'])
mock_patch = Patches(mocker.patch('socket.... |
24ee72fb52df01cba7ff63b1dfa59bf37680f84af93c057bf1cd0dd1ec29fde7 | Python | 5,413 | 171 | # 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... |
3a5f3f1e977751dc4d16fad6c93f869e2397042f3cb7f1d461d75f56a401b90f | Python | 5,417 | 169 | from __future__ import division, absolute_import, print_function
import sys
if sys.version_info[0] >= 3:
from io import StringIO
else:
from io import StringIO
import compiler
import inspect
import textwrap
import tokenize
from .compiler_unparse import unparse
class Comment(object):
""" A comment block.... |
6a0079c6ddba213cf5424e02a2288eeee126c0d3a537f72f58bdb11e5562654c | Python | 5,417 | 103 | """
Regional surface data generated from the Destrieux atlas. The label files are generated using Freesurfer.
From label files, the vertices the belong to each spcific region are extracted. And from that information
the surface files for each region are saved.
Parameters:
---------
{h}.{l}.label: Label files of e... |
a427affab982792f61bd27459b73d7d754286c84ecb5b18b708a4cb73b6c8c28 | Python | 5,425 | 181 | # Copyright 2021 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... |
dc63d40d017716de11e1053f092c6c2c4f886e982cd754b8f17aa5f92d60f9c7 | Python | 5,425 | 145 | """
By: Cameron on 1/10/2024
Parameters:
---------
H: Mean curvature at each vertex read from {h}.pial.H.asc file
K: Gaussian curvature at each vertex read from {h}.pial.K.asc file
Returns:
-------
k1: 1st principal curvature at each vertex saved to {h}.pial.k1.asc file
k2: 2nd principal curvature at eac... |
60199ae4550a05f9cd153539edafb718b1eab26dc09175081bd48a8cd3809916 | Python | 5,426 | 178 | from matplotlib.colors import to_rgba, to_rgba_array
import pytest
from numpy.testing import assert_array_equal
from seaborn.palettes import color_palette
from seaborn._core.plot import Plot
from seaborn._marks.dot import Dot, Dots
@pytest.fixture(autouse=True)
def default_palette():
with color_palette("deep"):... |
077a996fd9c341054c0a0aaa13104a14f7a75b374c904da9903b1af1758516f4 | Python | 5,431 | 137 | """
plot_modality_transfer.py
Load and plot data generated by modality_transfer.py.
"""
import json
import numpy as np
import itertools
import matplotlib.pyplot as plt
import pandas as pd
import dict_key_definitions as keydefs
from dict_key_definitions import statskeys, simkeys
from dict_key_definitions import modali... |
55e2bca56ab7c5ea2e3042b61e01417140388b3a7561b614e11305489e597542 | Python | 5,432 | 163 | # -*- coding: utf-8 -*-
"""
Created on Thu December 10 11:41:02 2022
@author: Pawan Panwar, Quanpeng Yang, Ashlie Martini
PyL3dMD: Python LAMMPS 3D Molecular Dynamics/Descriptors
Copyright (C) 2022 Pawan Panwar, Quanpeng Yang, Ashlie Martini
This file is part of PyL3dMD.
PyL3dMD is free software: you ... |
10fa4008558f53942ee0a151ef121a146ab32ef63eef5bedcf1e36ddd3262420 | Python | 5,433 | 154 | # 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... |
2ad29041fd26b86b4746b2cf8e0c5c5cf05464bed0d8672cf69fec109ff3f8de | Python | 5,433 | 151 | """
@file: Colorer.py
Script which allows are colored logging output multi-platform.
The script is based on this post and was slightly adjusted:
# https://stackoverflow.com/questions/384076/how-can-i-color-python-logging-output
'Here is a solution that should work on any platform. If it doesn't just tell me and I wil... |
26a7bc6777f58d3bf62e8d75b0ad25fc83901ffb174529a1e26419f32eec1f5a | Python | 5,434 | 151 | """
@file: Colorer.py
Script which allows are colored logging output multi-platform.
The script is based on this post and was slightly adjusted:
# https://stackoverflow.com/questions/384076/how-can-i-color-python-logging-output
'Here is a solution that should work on any platform. If it doesn't just tell me and I wil... |
ee1a74dba92ac415b0fdfeed13dded810844f3daf4356067c6c9ea8cb58c791d | Python | 5,434 | 150 | import math
from typing import Tuple, Union
import jetnet
import torch
from torch import nn
from utils.const import DEFAULT_DEVICE
EPS = 1e-16
class EMDLoss(nn.Module):
"""EMDLoss Wrapper for jetnet.losses.EMDLoss"""
def __init__(
self,
num_particles: int,
polar_coord: bool = False,... |
4d3f1b91db6be60e19d82388c74c254ec008d662bd70c73b25430fe32f2a7b40 | Python | 5,435 | 149 | import io
import logging
import json
import numpy as np
import os
import torch
from PIL import Image
from torch.autograd import Variable
from torchvision import transforms
logger = logging.getLogger(__name__)
class MaskRCNNInstanceSegmenterHandler(object):
"""
MaskRCNN handler class for instance segmentation... |
9b733b6aa9a546d9ddece5ff052598426b1a1817f637d4cdcc0db790eb359c31 | Python | 5,436 | 156 | """
translator.py
Translates new-style trials into old ones.
Useful for backwards compatibility with old behavior code.
"""
import datetime
import pickle
import numpy as np
class TrialTranslator(object):
"""
"""
def __init__(self, task=None):
self._task = task
def translate_trial(self, n... |
aa6333c67bb61dd01487663a4ac55d13ac25b708c56e2508340f1d75e0f5422a | Python | 5,436 | 116 | # Copyright 2007 Zachary Pincus
# This file is part of CellTool.
#
# CellTool is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
import bisect, numpy
from . import utility_tools
def pca(data):
... |
bc436c20dbd6527855b37c0a9e47751ac9bf0fe9fc534db7bb238d1bd0fe0ba6 | Python | 5,436 | 169 | from typing import Dict, Iterable, Optional, Tuple, Union
import torch
def parse_tau_latent_spec(
tokens: Union[str, Iterable[str]]
) -> Dict[Tuple[int, int], int]:
"""
Parse a latent-irrep specification into a ``{(k, n): multiplicity}`` dict.
Each token describes one irrep as ``"k,n:mult"`` (surrou... |
de11439709e5982afc1285f578bd2c7b85a73189b59f9544fd1fc620be52d380 | Python | 5,437 | 126 | #!/usr/bin/python
"""
Run one gbc... but know about them all
call: all_gbc_AN.py BC_number
"""
from __future__ import print_function
import os
import sys
import pickle
from pathlib import Path
import vcnmodel.model_run as mrun
class OneANRun(object):
def __init__(self, gbc_name, modelName, modelType, protocol, S... |
3f29bedef4825a9e342bc09b3c13bcb16ede96700b903a4fa59df2e5b10e2437 | Python | 5,440 | 155 | from typing import Optional
import ants
import numpy as np
from ants.core import ANTsImage
from ._cache import handle_cache
from .location import crop, get_coords
from .registration import get_roi
from .template import get_atlas, get_mni, get_roi_indices
class RoiLocator:
"""Crop an MRI image to a ROI.
Arg... |
499133be968191aa5df95c16c3922d751f509d4c3f447cc9a4b990013dc94ea5 | Python | 5,441 | 159 | import os
import cv2
import numpy as np
import torch
import torch.utils.data
from PIL import Image
import torchvision.transforms as transforms
class Dataset(torch.utils.data.Dataset):
def __init__(self, img_ids, img_dir, labels, img_ext, num_tasks, transform=None):
self.num_tasks = num_tasks
self.i... |
90f7e1256291dc0669b0b784a8fb0815de3b0e4f0e30421d98924ba25c789a2d | Python | 5,442 | 149 | from torch.utils.data import Subset
class VPDatasetWrapper:
r"""
A class that wraps VPDataset instances to handle training and testing data in the same way.
"""
ALLOWED_SPLITS = ["train", "test"] #: On creation, the wrapper must be initialized with one of these split values.
def __init__(self, ... |
211ac610cbea6fea8e53851a6a58421ddfccfa3ec0697aadc4fd04fea4452010 | Python | 5,444 | 187 | # 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 CommonGRU(OpRun):
def __init__(self, onnx_node, run_params):
OpRun.__init__(self, onnx_node, run_params)
self.n_out... |
74ec1fc2e746ba6356fd38c88906aca9a0cb33183168a2d6b88946425a485e78 | Python | 5,445 | 148 | #!/usr/bin/env python3 -u
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Implements meta forecaster for forecasters composed of other estimators."""
__author__ = ["mloning"]
__all__ = ["_HeterogenousEnsembleForecaster"]
from sktime.base import _HeterogenousMetaEstimator
from sktime.forecas... |
25421ecbdf2ed2afcb75f431606ba4b252f3911e0e88610a8d87ed6347794830 | Python | 5,447 | 149 | import os
import torch
from torchtext.data import Field
from onmt.inputters.datareader_base import DataReaderBase
try:
import numpy as np
except ImportError:
np = None
class VecDataReader(DataReaderBase):
"""Read feature vector data from disk.
Raises:
onmt.inputters.datareader_base.MissingD... |
2195769e83fe6632f5ba3c35ddcf3a23abd1c75ed313e201a0d72c82618082f4 | Python | 5,451 | 140 | """
conflict_weight.py
Simulates different weight/reliability combinations to demonstrate the
requirement for differences in cue weight (amplitude) using the current learning
rule. Noise is not enough to create a weighting effect in the snapshot.
"""
import json
import numpy as np
import dict_key_definitions as keyde... |
81d71e3c75ae870ba96289f3807c3824a9ff7ca96311691ec86a228b19343d65 | Python | 5,451 | 140 | """
conflict_weight.py
Simulates different weight/reliability combinations to demonstrate the
requirement for differences in cue weight (amplitude) using the current learning
rule. Noise is not enough to create a weighting effect in the snapshot.
"""
import json
import numpy as np
import dict_key_definitions as keyde... |
59a3f9394b833102b486972c1cc084e5b86265c85a9e720c4056a36ba21a6e71 | Python | 5,453 | 139 | # 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... |
620eabe52e2639555b6d30b96cdfc5909b3fccd80899591bbf208cf65bb41ab1 | Python | 5,453 | 140 | # Copyright (c) OpenMMLab. All rights reserved.
from abc import ABCMeta, abstractmethod
import numpy as np
import torch
import torch.nn.functional as F
from .builder import AUGMENT
class BaseCutMixLayer(object, metaclass=ABCMeta):
"""Base class for CutMixLayer.
Args:
alpha (float): Parameters for B... |
d5e4b3796bb9d989fea97090c95188114291965c5e370ac8cf8d1d88b1e1ebe9 | Python | 5,453 | 133 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Utilities for serializing and deserializing objects.
IMPORTANT CAVEAT FOR DEVELOPERS:
Do not add estimator specific functionality to the `load` utility.
All estimator specific functionality should be in
the class methods `load_from_serial` and ... |
6f53e65593382e32a499a96e5748218decea3e8a4b1a02d93b46e86babca5bfd | Python | 5,456 | 163 | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Dict, Sequence
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import build_activation_layer, build_norm_layer
from mmcv.runner import BaseModule, ModuleList
from ..builder import HEADS
from .cls_head import ClsHead
class LinearB... |
d251fbd23d6c92eda8dce0bca7904423ad9fd8786d189028495a68090b4380d8 | Python | 5,459 | 128 | import sys
import numpy as np
import torch
import time
import pickle
from sns_toolbox.neurons import NonSpikingNeuron
from sns_toolbox.connections import NonSpikingSynapse
from sns_toolbox.networks import Network
# Personal stuff to send an email once data collection is finished
#sys.path.extend(['/home/sns'])
#from ... |
7da65cc756bfe66fc6e83879d24f09b8ad999cd03d97ee1daf7f24ee8b105594 | Python | 5,471 | 158 | import io
import logging
import json
import numpy as np
import os
import torch
from PIL import Image
from torch.autograd import Variable
from torchvision import transforms
import torch.nn.functional as F
logger = logging.getLogger(__name__)
class ClassifierHandler(object):
"""
Metalearning Classifier handle... |
f08456d17e646cd6c40195c992887f6bde8cc8a1a72dfd6b0f91856a55ece4ca | Python | 5,472 | 163 | import sys
import yaml
import argparse
def load_yaml_config(path, skip_lines=0):
with open(path, 'r') as infile:
for i in range(skip_lines):
# Skip some lines (e.g., namespace at the first line)
_ = infile.readline()
return yaml.safe_load(infile)
def save_yaml_config(con... |
b5bf08d85e784dfdd7488016c440c270e6a257fed51bd58e32017b0594d036ad | Python | 5,474 | 179 | # 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... |
8068f4cf7bf56250ee26a7e188d513b37d2093d27f1aff99a6bfb813f3700297 | Python | 5,475 | 162 |
#=======================================================================================================================
# Copyright (C) 2021 Matvey Safroshkin, Grigory Arutyunov, Patrick Mueller
# Computer Vision Studio
# Friedrich Miescher Laboratory of the Max Planck Society
# Systems Biology of Development, Univer... |
d38d9bda42537a89855f3d3282612f8ae29a9dcc90a1dad631efd4750d6a5810 | Python | 5,475 | 156 | # A dependency-free version of networkx's implementation of Johnson's cycle finding algorithm
# Original implementation: https://github.com/networkx/networkx/blob/master/networkx/algorithms/cycles.py#L109
# Original paper: Donald B Johnson. "Finding all the elementary circuits of a directed graph." SIAM Journal on Comp... |
e6606b5fd05f56e83cec992159716955465d2e2d8883f30020ae8b389155c9e9 | Python | 5,475 | 160 | import numpy as np
import tensorflow as tf
import scipy.integrate
import scipy.interpolate
from IPython.core.debugger import set_trace
tf.keras.backend.set_floatx('float32')
class ddeVar:
"""
The instances of this class are special function-like
variables which store their past values in an interpolator a... |
4489da729def802d99320f9ec85131d1eb16a9afc06831923e1085ed0791e98e | Python | 5,477 | 91 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import argparse
import os
import pickle as cp
cmd_opt = argparse.ArgumentParser(description='Argparser for retrosyn_graph')
cmd_opt.add_argument('-save_dir', default='.', help='result output root')
cmd_opt.add... |
ec72036b4f7c334fa1eb4a18a6de800bd65e6b57c4368619efe0d916548e9d9e | Python | 5,477 | 131 | from bcblib.tools.growth import evolve_blobs
from bcblib.tools.blob_robot_core import initialize_blobs_with_mask, cell_array_to_state_array
from bcblib.tools.shapes import create_spherical_shape
from nilearn import datasets
from nilearn.plotting import plot_stat_map
import numpy as np
import nibabel as nib
from scipy i... |
1ab9cad979d564dddea594833a2cb9190fd39090dbd0b84f9d293bf2aa1cb83a | Python | 5,478 | 192 | # 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... |
bd5be1b01031b970ee157a75caca0983a3e47f26159314f4ecac5f1575c99983 | Python | 5,478 | 154 | import sentencepiece
from pathlib import Path
import shutil
DIVIDED_BY_THREE_DOTS = False
if DIVIDED_BY_THREE_DOTS == True:
BASE_DIR = Path("../NMT_input")
else:
BASE_DIR = Path("../NMT_input") / Path("not_divided_by_three_dots")
TOKEN_DIR = BASE_DIR / Path("tokenization")
TRAIN_AK = Path("train.ak")
TRAIN_... |
472e5698383f61e148dba603a398ec1ccad5d4669b5c460c586f07d05111e31f | Python | 5,484 | 146 | """
Create a network of spiking neurons and populations, and record activity with spike monitors
William Nourse
December 2nd 2021
"""
"""Imports"""
# Import packages and modules for designing the network
from sns_toolbox.networks import Network
from sns_toolbox.connections import SpikingSynapse
from sns_toolbox.neuron... |
608ea6c8f48c72607ffcf374aae6da35859ce8cd84c453f922c476a9324fa76c | Python | 5,484 | 161 | from neuron import h
from neuron.units import ms, mV
from multiprocessing import Pool
from functools import partial
import numpy as np
import functions
import time
import os
def initialize(filename):
"""
initialize NEURON simulation environment and Hallermann et al. 2012 model
:param filename: name of .h... |
695a5c6aa119723a88c93ce9e5e69f7b16a017ac92c5ba187b167eae20da0dab | Python | 5,484 | 167 | # 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:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or module... |
41bef9198e5834e47fd343e05d09ef24ab4cdfc99d2cc2d0b0baef5dcd98d7bc | Python | 5,486 | 152 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Normal/Gaussian probability distribution - silent in case skpro is not present."""
__author__ = ["fkiraly"]
import numpy as np
import pandas as pd
from scipy.special import erf, erfinv
from sktime.base._proba._base import BaseDistribution
c... |
75b74f8f146305a1b219782786976cc859c219ffa5ca5cc97e4af62035e7069f | Python | 5,491 | 163 | import numpy as np
import pandas as pd
import sys, os
from random import shuffle
import torch
import torch.nn as nn
from models.gat import GATNet
from models.gat_gcn import GAT_GCN
from models.gcn import GCNNet
from models.ginconv import GINConvNet
#from read_smi_protein import *
from torch_geometric.data import InMem... |
8b64e19d89bd91c7858b93a181a5885650eca1de22d3bb4feb4ab03da8ffaf21 | Python | 5,491 | 162 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 28 14:46:46 2017
@author: tpisano
"""
from matplotlib import markers
from matplotlib.path import Path
def align_marker(marker, halign='center', valign='middle',):
""" FROM https://stackoverflow.com/questions/26686722/align-matplotlib-scatter-ma... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.