sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
46182d763d8702ec95f1502bdec7e351e7a462b96ba952801a8d271fa7a091b0 | Python | 2,496 | 71 | import torch
def apply_lorentz_transformation(mat: torch.Tensor, p4: torch.Tensor) -> torch.Tensor:
"""
Applies a Lorentz transformation to a 4-vector.
:param mat: The Lorentz transformation matrix. Shape: (4, 4).
:param p4: The 4-vector to transform.
Supported formats:
- batched jets... |
4bc39cce514e971ac87607d4586fcf4764298ac333580d351f8b2985e9178381 | Python | 2,496 | 75 | # 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... |
8a90444218624d3a50956ce6734219e2eaaf2a3488c86fba6a23773ed1bdaf98 | Python | 2,497 | 86 | # 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... |
07f51c2dd96581f3aad39b1cbd385e3eadd3c1d3bf769beb8eacabff73c8ba85 | Python | 2,498 | 58 | # Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
e66f25126039705bfebf9f11283dc11f09333e32331dd1b39173039e79e90ff2 | Python | 2,498 | 78 | # 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
# Group normalization's reference implementation
def _group_normalization(x,... |
50bc8f4417fb32f52facff81d2bbb7311c31eccdc33b231a9c524e9d941dafd4 | Python | 2,500 | 81 | import json
import numpy as np
from scipy.integrate import solve_ivp
from Historia.cellcontr.model import Land2012
from Historia.shared.constants import RESOURCES_PARAMETERS_DIR, posix_path
class CONTRSolution:
"""
This class implements the solution of the Land et al. (2012) cellular contraction model*.
... |
99b7aa5560aef8e68ec2ed20bb7538d151b2cc2991aa5874746915037902b6f0 | Python | 2,500 | 92 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Unittests for the gaapi modules
Tests
- crossovers
- generators
- Inidividual
- mutators
- replacers
- selectors
'''
import unittest
import openbabel
#from openbabel import openbabel
from src import JobConfig
from src.gaapi import operator_types
from src.gaapi im... |
cac85879638a2d2a77e7015c6cd3c407b5cf2f3c878a0db11de1e5fd0ffdd99c | Python | 2,500 | 73 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import subprocess
import time
CODE_DIR = os.path.dirname(os.path.abspath(__file__))
def retry_ssh(sshcmd, cmd, flush=False, connection_retries=30, connection_retrysleep=5):
num_ssh_layers = sshcmd.count('ssh ')
cmd = cmd.replace('"', '\"')
... |
4fdc3feee3f8ee91f3fcaabd6c69e4c34d10cbe5f65e76abeef1ca6afccfa800 | Python | 2,504 | 76 | # 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 And(Base):
@staticmethod
def export() -> None:
node = ... |
f7b0686ad724c470bd16268bb3be3b1ca40916c68dceb420633667f31c5f1b5f | Python | 2,504 | 76 | # 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 Xor(Base):
@staticmethod
def export() -> None:
node = ... |
a4e17de5ad6f4c94ba5cebd3ba64334e89076028fc51a1346e097d8125f2973e | Python | 2,506 | 90 | # 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... |
b692fa7a7a469790f7245b45fa43fbbf095b5d988c29777016951014a960c017 | Python | 2,506 | 77 | from flair.data import Sentence, Span, Token
from flair.embeddings import FlairEmbeddings
from flair.visual import Highlighter
from flair.visual.ner_html import HTML_PAGE, PARAGRAPH, TAGGED_ENTITY, render_ner_html
from flair.visual.training_curves import Plotter
def test_highlighter(resources_path):
with (resourc... |
de73728bef8e72914e07a18a6f0d2fa174ba408499cd4115695266ecb890af3a | Python | 2,507 | 83 | # -*- coding: utf-8 -*-
"""
linkcode
~~~~~~~~
Add external links to module code in Python object descriptions.
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import division, absolute_import, print_function
import warn... |
c26511f46947c8a3d7b1ec0ca0f94eac502951f2cf5b31908577fae44f381300 | Python | 2,508 | 83 | import logging
import tempfile
from unittest.mock import MagicMock
import mmcv.runner as mmcv_runner
import pytest
import torch
from mmcv.runner import obj_from_dict
from torch.utils.data import DataLoader, Dataset
from mmcls.core.hook import ClassNumCheckHook
from mmcls.models.heads.base_head import BaseHead
class... |
993fc9152ad16109f1f530ea7882af629a37213a7f2dac5ab3aa4aac6394e439 | Python | 2,509 | 59 | # -*- 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 ca... |
bfc1fb96ee6389b20b6813bc6d5c67eb61707684edfa8bb100f110a64664691b | Python | 2,510 | 82 | # 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... |
d72a560f9b152d7acb7c5afac4fcef662ab11b583addf0c4559f915fe3b6bdbc | Python | 2,511 | 79 | # 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... |
f83fcf348b7c31f42fac2df72c8a1583cf05fa1af66abe58df42e5ebee8f2a27 | Python | 2,511 | 59 | # -*- 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 ca... |
800ca248d455ffae4bb290922ae4955cc0a039ae23bd6e8152c68bb4b0a46b1e | Python | 2,512 | 70 | import copy
import random
import numpy as np
def perturb(config, hyperparam_space, min_perturb=0.002, clip=False, unbiased=True):
"""Perturbs a configuration based on the HPs specified.
Parameters
----------
config : dict
The configuration to perturb.
hyperparam_space : dict of tune_tf2.... |
b84c60162e37be4c3d0c997e6ba1e7f77215746cde7b506a4fc29f373f355792 | Python | 2,512 | 65 | #!/usr/bin/env python3
"""Print "true" if a release is the newest stable one and gets the `latest` tag.
packaging/is_latest_release.py VERSION [--prerelease] [--repo OWNER/REPO]
Same rule as the docs site's `latest` alias (.github/workflows/docs.yml): the
release is not a pre-release and VERSION is >= the version... |
f261990829cb6d09c477e86323bffc83e815ff9d51372d2247ed74fca2d2f3e7 | Python | 2,513 | 108 | import pytest
import pandas as pd
import scanpy as sc
from anndata import AnnData
import numpy as np
from scipy.sparse import csr_matrix
from anndata import AnnData
@pytest.fixture
def example_dataframe():
# Create an example dataframe for testing
return pd.DataFrame(
[[1, 2, 0, 4], [0, 0, 0, 0], [3, ... |
0db489ef33dab823e9a00508f88dc4f4f33f0a6c40cc169941f270c9e95b4819 | Python | 2,515 | 68 | # 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 LessOrEqual(Base):
@staticmethod
def export() -> None:
... |
1da0f70128efdae5de7c1c7d59b17ae20cd29543ef1ebdc29fb1e71792bba7a5 | Python | 2,515 | 70 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Fine-tuning rule helpers for the PyTorch backend."""
from typing import (
Any,
)
import torch
from deepmd.pt.utils import (
env,
)
from deepmd.utils.finetune import (
FinetuneRuleItem,
)
from deepmd.utils.finetune import get_finetune_rule_single as get_fine... |
a5b76f88458142cfb38378b8b362f09581e7baa7be16bf5054bcd15fc642e122 | Python | 2,516 | 78 | # 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 QLinearConv(OpRun):
def _run(
self,
x,
x_scale,... |
5b36675b6d44b7cfc9bf2513810189f55db71dd4f383ce76c81d958bf04e273f | Python | 2,518 | 80 | """Tests for the 2D tif volume provider."""
import numpy as np
import pytest
import tifffile
from siibra.locations.boundingbox import BoundingBox
from siibra.retrieval import requests
from siibra.volumes.providers.nifti import Tif2DNiftiProvider
from siibra.volumes.volume import Volume
# 0.5 mm pixels, 2 mm thick sl... |
e83cdc635ad077b3d5fc2d70afa38a3d63302b1462ef060b58bcb570642121da | Python | 2,518 | 78 | ###############################################################################
# Two AFC Task Example
###############################################################################
# Imports are subject to change
from camstim.foraging import AFCForaging, AFCStimulus
from camstim import Window, Experiment, Timetrials... |
eefa9134a8857eb0370f088f1c6edb98cfd72409cb72691ccfd5e0dafb381c67 | Python | 2,519 | 83 | # -*- coding: utf-8 -*-
"""
Helper module for analysis looking at the spectra of eigen values between SFA and
PCA. Main use now is just single helper function for SFA_Func - PCA_eigens
2023-03-13
Code by RW DiTullio
"""
import numpy as np
import matplotlib.pyplot as plt
import soundfile as sf
import pyfilterban... |
aa6d80196dc77c59c6245a6c79e247c322825880707a7f4fc2abd391b7698e8d | Python | 2,520 | 80 | # 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... |
01bc69c964de40413d5dc930a3dddc6f65694e345d536ac2c7a57b83f69da5ba | Python | 2,525 | 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... |
85e5b61ee2632b9f6f532c49b9ed905a498ceead988d22c911c8f6fd5b156f63 | Python | 2,525 | 74 | from collections import defaultdict
import pandas as pd
import pickle
from sqlalchemy import create_engine, inspect, Table, Column
from sqlalchemy.engine.url import make_url
from sys import exit
class DatabaseClient:
""" Takes care of the database pass opening to find the url and can query
the respected ... |
f8b57bdb125747725cb50581814300578a18a9c19c8ab62eda3d924c796596ce | Python | 2,527 | 57 | #
# # Specifying node colours
#
# [Open interactive notebook in Binder](https://mybinder.org/v2/gh/wiheto/netplotbrain/main?filepath=docs/gallery/specifying_node_color.ipynb)
#
# There are three different ways to specify different colours of nodes.
# Both are done by setting node_color keyword argument.
# If this col... |
9bfa8d377e9277c17b48716ab585bdd8b4bc0325f76e8ca633a91416e59a3991 | Python | 2,530 | 74 | import os
import dotenv as de
import numpy as np
import pandas as pd
from atom3d.datasets import LMDBDataset
from atom3d.util.voxelize import dotdict, get_center, gen_rot_matrix, get_grid
from torch.utils.data import DataLoader
de.load_dotenv(de.find_dotenv(usecwd=True))
class CNN3D_TransformRSR(object):
def ... |
df77d8f17749283d6167c0466991b2fb31765f2ab7cd6d67f39b308857193af8 | Python | 2,530 | 84 | import torch
import torch.nn as nn
class ConvLayer(nn.Module):
def __init__(self, n_in: int, n_out: int, ks: int = 3, stride: int = 1):
super().__init__()
self.layers = nn.Sequential(
nn.Conv2d(n_in, n_out, ks, padding=(ks - 1) // 2, stride=stride),
nn.SiLU(),
... |
6eec944d5288510622c33747ebc70520c8bfa1aa2761065c365674a04d8b5bf7 | Python | 2,533 | 89 | # 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... |
a0e5542765d51b14ceb771ea8e336ac17705f341c308926bff47d492180da358 | Python | 2,533 | 54 | """
@file: RawNetAgent.py
Created on 14.10.18
@project: crazy_ara_refactor
@author: queensgambit
The raw network uses the the single network prediction for its evaluation.
No mcts search is being done.
"""
from time import time
from DeepCrazyhouse.src.domain.abstract_cls.abs_game_state import AbsGameState
from DeepCra... |
6766a5b48230cdda1508977193408824ba2a161478df0f8ce140e2bdabb2451b | Python | 2,534 | 96 | # 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... |
89380a83b61695746e857f81316a1cc9cdc0c0c1785f4337ad3c68e174f867ff | Python | 2,534 | 54 | """
@file: RawNetAgent.py
Created on 14.10.18
@project: crazy_ara_refactor
@author: queensgambit
The raw network uses the the single network prediction for it's evaluation.
No mcts search is being done.
"""
from time import time
from DeepCrazyhouse.src.domain.abstract_cls.abs_game_state import AbsGameState
from DeepCr... |
50d1d20f1be6e807a53bf76d147b4b9294a7673545fe15784ed743fdf0a145fa | Python | 2,537 | 79 | # Train multiple images per person
# Find and recognize faces in an image using a SVC with scikit-learn
"""
Structure:
<test_image>.jpg
<train_dir>/
<person_1>/
<person_1_face-1>.jpg
<person_1_face-2>.jpg
.
.
<p... |
0a0d79162d636485ca269b24cacd51e22d970cf24023e341cf1076b4f4c7af35 | Python | 2,538 | 72 | # 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... |
d1e74d00d809aaf6dd4f20a4d6b06b4570a3405d8b577026f034e0d1d3ddf511 | Python | 2,538 | 75 | # 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... |
86fa7e703db9a90e35fc49ca713c7dfb4ddae237a9177a9ddaf2b03e96ca9680 | Python | 2,539 | 94 | # 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... |
5ede3f1c5ff81ecab06765fe97520398b47374912202dc08fcaf32a6becb50b2 | Python | 2,541 | 74 | import os
import dotenv as de
import numpy as np
import pandas as pd
from atom3d.datasets import LMDBDataset
from atom3d.util.voxelize import dotdict, get_center, gen_rot_matrix, get_grid
from torch.utils.data import DataLoader
de.load_dotenv(de.find_dotenv(usecwd=True))
class CNN3D_TransformPSR(object):
def ... |
cc0fc6488273789802958e4aaec7c0260add8dc33937667f9b3e38d9447fd6f7 | Python | 2,544 | 90 | # 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... |
6a9768e1c5dd0fc3a176ffafdb3a7d437321b9253bd645795000333d29bda8ae | Python | 2,545 | 92 | # coding=utf-8
# 2021.03 deleted (1) count_accuracy, plot_solution;
# (2) checkpoint_after_training
# Huawei Technologies Co., Ltd.
#
# Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved.
#
# Copyright (c) Ignavier Ng (https://github.com/ignavier/golem)
#
# Licensed under the Ap... |
a6409bf46deaa9113019326bc71db275791793ce95cea811e3af3812585fe535 | Python | 2,545 | 76 | # 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... |
2c387e0d19022f694aba5828a48a2749bd74fe9d4a4d894b0885426274f957d7 | Python | 2,546 | 80 | """
Cortical thickness distribution profile and average cortical thickness of all subjects
"""
def CT(input_txt, subjects_name, output_folder, max_t, min_t):
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import os
from scipy.stats import skew
path = os.path.j... |
3c27ea30945535346b18507a51360618502349298b1edd5636d2c9bdfee5d738 | Python | 2,546 | 73 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 19 11:17:45 2022
@author: nagehan
"""
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
x = np.linspace(0,3,10)
y = x
plt.plot(x, y, '--', color='lightgray', zorder=1)
plt.ylim(0.5,3)
plt.xlim(0.5,3)
#######################... |
5227d632b176bf846c2353a7c411b4c351f88f4f3cabc91d40ff408c18b5909c | Python | 2,546 | 80 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import Any
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
def optional_get_element_reference_implementation(op... |
9ff4076ac0142356d0bf8882dce7e5e687dd736e0d6d217248f8d16c23ca35b1 | Python | 2,547 | 74 | # 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... |
e4cae44cfc7a9b0bd4a482069435fb2c8589910f76ef3e2c0b346869624f1852 | Python | 2,547 | 53 | import warnings
import torch
from vp_suite.measure import LOSS_CLASSES
class PredictionLossProvider:
r"""
This class provides bundled access to multiple losses. With this class's :meth:`get_losses()` method,
all specified loss values are calculated on the same input prediction and target tensor.
... |
4e41afe2162d19afb71a49950790710b5fdf32b6fc18d3bc1ea0c36ca7c79857 | Python | 2,548 | 70 | # 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... |
9081cbcf0ac302874c7019b9ad9a154919bf807b012c4c86d36c1feebae69eb2 | Python | 2,550 | 72 | import re
from setuptools import setup
def find_version(filename):
_version_re = re.compile(r"__version__ = '(.*)'")
for line in open(filename):
version_match = _version_re.match(line)
if version_match:
return version_match.group(1)
__version__ = find_version('ttlser/__init__.py'... |
41c6395b57733d7537f77aa80fbfd4a1b8cea0e1e298da0df5b6d35dbd73f226 | Python | 2,551 | 67 | #-------------------------------------------------------------------------------
# elftools example: dwarf_type_references.py
#
# Follow DW_AT_type references from variables and typedefs to their underlying
# types. Show each reference's form and value alongside the resolved DIE offset.
#
# This code is in the public d... |
b8875226ca275e872835e5de66bbcbcee49eef350d8bc567bcc30fd22dbd2964 | Python | 2,553 | 70 | from copy import deepcopy
import torch
import torch.nn as nn
import numpy as np
REFERENCE_GIT_URL = "https://github.com/ndrplz/ConvLSTM_pytorch.git"
REPO_DIR = "ConvLSTM_pytorch"
from vp_suite.model_blocks import ConvLSTM_ndrplz as OurConvLSTM
from vp_suite.utils.models import state_dicts_equal
# noinspection PyUn... |
05ed1e9979579999595273f6f28a27decb9bf24e49cb761b24dfd34e5834e9ed | Python | 2,554 | 58 | import os
import numpy as np
import nibabel as nib
from os.path import join as pjoin
from had_utils import save2cifti
from scipy.stats import pearsonr
from sklearn.preprocessing import StandardScaler
# define path
# make sure the dataset_path are modified based on your personal dataset downloading directory
dataset_pa... |
4e7ed85ca27c30b7222c25ec2f3412096a2cb7dddc84feed741cb78faf50550c | Python | 2,555 | 84 | # 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... |
c2ee18f3c32e17cc9bf323dc89fd1c5218576fcdac970c44ecef2cc8a8e9a939 | Python | 2,556 | 66 | import logging
from typing import Tuple
import torch
EPS = 1e-16
METHODS = ("component_max", "overall_max", "jet_E")
def normalize_p4(
p4: torch.Tensor, method: str = "overall_max"
) -> Tuple[torch.Tensor, torch.Tensor]:
if method.lower().replace(" ", "_").replace("-", "_") == "component_max":
return... |
210a97ed7864da8832013bbb9a8677a5e7c7881b591ec5ac7e82c4911fe7242e | Python | 2,557 | 87 | """
plot_simple_conflict.py
[Legacy] - This was the precursor to plot_conflict_weight.py
"""
import json
import numpy as np
import itertools
import matplotlib.pyplot as plt
import test_utilities as testutils
import dict_key_definitions as keydefs
from dict_key_definitions import statskeys, simkeys
from dict_key_defi... |
94c5d4800d4572c405fb73f585bfa035f56405febda366196adfed3eae5df160 | Python | 2,557 | 71 | # 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... |
934b235f2f711c60efcf919a3723a0819eb43c99c51caebbe9d2ded2a0bfb41f | Python | 2,558 | 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... |
d9192619a1cae08aee13fd9a531516381b1011e7899936b16c87ff9580ba5b5e | Python | 2,559 | 72 | import numpy as np
import gym
from collections import OrderedDict
import logging
from ray.rllib.utils.annotations import override
from ray.rllib.models.preprocessors import Preprocessor, DictFlatteningPreprocessor, NoPreprocessor
from ray.rllib.models import ModelCatalog
STRATEGO_PREPROCESSOR = "stratego_preprocessor... |
fa98217c542f8f65b82a60ae0455f284f2a13f3cc9f629ac47bf667473ce0843 | Python | 2,559 | 65 | import logging
import time
import traceback
from ray.tune.error import AbortTrialExecution
from ray.tune.ray_trial_executor import RayTrialExecutor
from ray.tune.trial import Trial
logger = logging.getLogger("ray.tune.ray_trial_executor")
class SoftPauseExecutor(RayTrialExecutor):
"""Pauses and restartstrials w... |
614e4266ee9e223cffbf592f1c93ff9fd18812ad126b69704873827e573e38d6 | Python | 2,560 | 82 | # 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... |
64ff79b69442405c56e209a9b074c605371bc5c086165a76528486a5d2ca4f5d | Python | 2,560 | 77 | """
@author: Nagehan
Title: Mesh connectivity and vertex coordinates
First, the code reads the input mesh file (lh.pial.asc), and
the coordinates of the vertices, vertex ID, and connectivity of the mesh is obtained.
Current working directory must be set to the subjects directory.
Input mesh file can be .asc or .txt... |
57ebf50f3282cd8011f0d67c79fa882a02962ad54f82624516042ab3651c9325 | Python | 2,561 | 116 | import unittest
from nifstd_tools.simplify import simplify
def mkt(*t):
return [{'sub': str(s),
'pred': p,
'obj': str(o),} for s, p, o in t]
t1 = mkt(
(1, 'start', 2),
(2, 'skip1>', 3),
(3, 'end', 4),
), mkt(
(1, 'start', 2),
(2, 'skip1>-end', 4),
)
t2 = mkt(
... |
ad6ffaa94c11a5c4bcec94360c8ab18df8487974ea589598a6b576dc9af64b48 | Python | 2,561 | 80 | """
List all of the data in the directories of the SBEM cells This mostly is to test
the integrity of the data. Note that a number of file 'types' are also handled,
based on the data structure. Some of these are quite old formats. Early simulation
files had "params" structures embedded. These are skipped. The data
stru... |
69aec5e5ad61e93b4412e9f6ddc3c7a85f03a009c1b5ef1e5a9b177102ecb7c2 | Python | 2,564 | 57 | # 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... |
0cc7cf9cc28dc2e004154bb3f73dca8de6119c1eb19cb012a5d73defc5375fdd | Python | 2,569 | 65 | from __future__ import division
import numpy as np
from scipy.special import sph_harm
import SPHARM.lib.transformation as tr
from SPHARM.classes.surface import Surface
class Orbital(Surface):
"""
Class for a surface of generated from spherical harmonics.
"""
def __init__(self, grid_shape, m, n, ampl... |
dea847479b21d4b15133ea18bdf84cb65c243b3a8c9437c7bcf76aeedc21b474 | Python | 2,569 | 74 | #!/usr/bin/env python
# bcftools_merge 0.0.1
# Generated by dx-app-wizard.
#
# Basic execution pattern: Your app will run on a single machine from
# beginning to end.
#
# See https://wiki.dnanexus.com/Developer-Portal for documentation and
# tutorials on how to modify this file.
#
# DNAnexus Python Bindings (dxpy) docu... |
ae61f94a4c089661d617c133e0e736d83457f4ed1bb60dfd9592d2fd16fc660c | Python | 2,570 | 82 | import numpy as np
import pandas as pd
import pytest
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.detection.plotting.utils import (
plot_time_series_with_change_points,
plot_time_series_with_profiles,
)
@pytest.fixture
def time_series_data():
ts_data = np.random.rand(100)
... |
70c968ef58cbd51696bba0ba7c47c55867db8615e5477a30eb93d4bbbebe75e7 | Python | 2,571 | 73 | """
@file: rl_config.py
Created on 01.04.2021
@project: CrazyAra
@author: queensgambit, maxalexger
Configuration file for Reinforcement Learning
"""
from dataclasses import dataclass
@dataclass
class RLConfig:
"""Dataclass storing the options (except UCI options) for executing reinforcement learning."""
# Ho... |
194927e32621f6d73e426c8183d12d38d6cbd9b9d5b89607a25760f4e9ffc131 | Python | 2,573 | 78 | # -*- 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 ... |
cfdeadbe81c6d105e3792874e3f42c07dea50fee9aa03d7f93dd16f9902ba898 | Python | 2,574 | 59 | import tensorflow as tf
from tensorflow.contrib import distributions as distr
class BilinearDecoder(object):
def __init__(self, config, is_train):
self.batch_size = config.batch_size # batch size
self.max_length = config.max_length # input sequence length (number of cities)
self.inp... |
93d442daf9616f5f4d2c80bdf9175f4a9dcf435a8f98078caa5928d55af4c19b | Python | 2,575 | 73 | # 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 Mul(Base):
@staticmethod
def export() -> None:
node = ... |
16af0683c818dff7a99283f2c82230c587023a26abeba3dce3ea119a16d74de8 | Python | 2,576 | 65 | """Delegator mixin that delegates all methods to wrapped transformer.
Useful for building estimators where all but one or a few methods are delegated.
For that purpose, inherit from this estimator and then override only the methods that
are not delegated.
"""
# copyright: sktime developers, BSD-3-Clause License (see ... |
1ac6a11b56f8fdc54056dc406b6ce6159f17b2aa2ade9537598ac6435f6b68ef | Python | 2,577 | 83 | # -*- coding:utf-8 -*-
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import keras
from keras.initializers import RandomUniform
from keras.layers import multiply
from keras.layers.core import Reshape, Permute
from keras.layers import BatchNormalization
from keras.layers.core import Dense, Dropout, Lambd... |
dd75a76403ccce4846fba34f9cd93518d8673a3f1efd265f93a2555c38b47314 | Python | 2,577 | 64 | # Copyright 2015 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... |
cf0a36b87be71f8db901f4ee051fcb25395ee1f80313c6a036774c6e7ad20a5b | Python | 2,578 | 70 | # 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... |
068b439dada4046d87ba8743482f4e09779662fe85a3a18890f04b1f1a1a7ba2 | Python | 2,579 | 80 | # 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
#
# ... |
5aeca5d3af4266b6dc07ce0ea69142dd420d2824bc4532892533abb1016f4892 | Python | 2,580 | 72 | import os
import dotenv as de
import numpy as np
import pandas as pd
from atom3d.datasets import LMDBDataset
from atom3d.util.voxelize import dotdict, get_center, gen_rot_matrix, get_grid
from torch.utils.data import DataLoader
de.load_dotenv(de.find_dotenv(usecwd=True))
class CNN3D_TransformLBA(object):
def ... |
52be6a20b35d3529490512bddcd926fa4745fb9615c0d55d4877ccfa463f16dd | Python | 2,581 | 70 | '''
architecture for segmentation
'''
import torch.nn as nn
from . import block as B
class Res131(nn.Module):
def __init__(self, in_nc, mid_nc, out_nc, dilation=1, stride=1):
super(Res131, self).__init__()
conv0 = B.conv_block(in_nc, mid_nc, 1, 1, 1, 1, False, 'zero', 'batch')
conv1 = B.co... |
af7a4ec9ea34180541d80a6c755b2ee2376bc01704a517744383efaae215a86a | Python | 2,581 | 68 | # 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 GreaterOrEqual(Base):
@staticmethod
def export() -> None:
... |
f11997460f92359bde8097eefd8e4009aa8bc258c702fd1906fdecb534d91634 | Python | 2,581 | 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... |
d14954176e75d656a8573b382e0b6f6436ea82f93b2e45ad6c42917633349d09 | Python | 2,582 | 100 | import logging.config
import os
from pathlib import Path
import torch
from transformers import set_seed as hf_set_seed
# global variable: cache_root
from .file_utils import set_proxies
cache_root = Path(os.getenv("FLAIR_CACHE_ROOT", Path(Path.home(), ".flair")))
"""The path to the cache folder Flair is using.
This ... |
ea845d231afe654dbcd63c1eeb9afbf73aa9f76f5c27fa661c22786a70b14a1b | Python | 2,583 | 76 | #!/usr/bin/python3
# Copyright 2024 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... |
f0249a352d0f88213619406aab06cc304ed9d05f12b491430ea7967530458d91 | Python | 2,583 | 70 | # -*- coding: utf-8 -*-
#/usr/bin/python2
import tensorflow as tf
def attn_head(seq, out_sz, activation, in_drop=0.0, coef_drop=0.0, residual=False):
with tf.name_scope('my_attn'):
if in_drop != 0.0:
seq = tf.nn.dropout(seq, 1.0 - in_drop)
seq_fts = tf.layers.conv1d(seq, out_sz, 1, u... |
3bdeea2afcd921e4c551c485437cc49010680b247c286b7f6dc437a567ca4e6a | Python | 2,584 | 72 | # The key string (i.e. 'euclidean') must be the same as the name in _registry
_expected_distance_results = {
# Result structure:
# [single value series, univariate series, multivariate series]
"euclidean": [5.0, 2.6329864895136623, 7.093596608755006],
"erp": [5.0, 5.037672883414786, 20.724482073800456]... |
f006776934ade81601b7dbbcce897681ce22ad2c1f99905367ecc1f2104b4092 | Python | 2,584 | 83 | #!/usr/bin/env python
from __future__ import print_function
import sys,os
import re
import argparse
import logging
import gzip
from functools import partial
import pandas as pd
desc = 'Renaming genome fasta files'
epi = """DESCRIPTION:
Renaming genome fasta files based on taxon name.
Renamed genome fasta files will b... |
97922b2d6ed992f4bcdebf966c14dadbc585df12b93250165c5d9f56bfb6a5ce | Python | 2,585 | 72 | # 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... |
d3e3a680bff8f98cdc5178df99adafb8d13a5196c8900d5341943d176bbf1241 | Python | 2,585 | 77 | """Temporal importance curve diagram generators for interval forests."""
__author__ = ["MatthewMiddlehurst"]
import numpy as np
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.classification.interval_based import CanonicalIntervalForest
from sktime.transformations import catch22
_check_so... |
24e1790ffa60a1cf7ae04986723954f52bb6395514e6e6e696d1dc2337bbb3f8 | Python | 2,586 | 74 | """Isolated numba imports for _erp."""
__author__ = ["chrisholder", "TonyBagnall"]
import warnings
import numpy as np
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.utils.numba.njit import njit
if _check_soft_dependencies("numba", severity="none"):
from numba.core.errors import Numb... |
953f63817b9fb7defd8b1a160ae71b9bb8dfd3d4ee50263f01d35ea8718e16d5 | Python | 2,587 | 72 | import logging
import os
from typing import Any
from flair.trainers.plugins.base import TrainerPlugin
from flair.training_utils import log_line
log = logging.getLogger("flair")
class TensorboardLogger(TrainerPlugin):
"""Plugin that takes care of tensorboard logging."""
def __init__(self, log_dir=None, comm... |
c6459f058a78387f473db11d0080bd2d52c15758f96fe6615fe4fb594cc3ba1a | Python | 2,587 | 74 | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmcls.models.backbones import SEResNeXt
from mmcls.models.backbones.seresnext import SEBottleneck as SEBottleneckX
def test_bottleneck():
with pytest.raises(AssertionError):
# Style must be in ['pytorch', 'caffe']
SEB... |
85db300e627b87cc92fae6392defa4eb6b3618773085481c6d0ade45bf5c5091 | Python | 2,589 | 75 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import Any
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
def sequence_insert_reference_implementation(
se... |
c4d661b627ddd458c03c941ac4a1db0f4efada99feee3104f747a775bc46f237 | Python | 2,589 | 64 | from __future__ import print_function
from freqAnalysisTools import band
import json
class ParameterSetupForNetwork(ParameterSetup):
def __init__(self, paramDir='', paramFileName='', outputDir=''):
self.paramSetupType = 'network'
pathFilePath = open('path.json')
p = json.load(pathFilePath... |
d19ebe796ea606b7de6b8446f9837694004e26da01416203112cae5eca8ec312 | Python | 2,591 | 70 | # 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... |
66a481a43d392dc57db54e90e793348d706f91daed6e00fdfa60553d9c3f05fa | Python | 2,592 | 89 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 4 11:05:58 2023
@author: daniel
"""
from neuron import h
import d1msn as msn
import pickle
import json
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
import parameters as p
def mg_block(mg, alpha, v, e... |
603e31fb72cd5d12fa6b7153a5a0d3364d84189df9f67bb59c4c8a3b8a8cbef9 | Python | 2,597 | 68 | # 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... |
8d9998caa70cf1faf42c444ee442e67bc282564086c6edf7664feff0b9e4ff63 | Python | 2,598 | 68 | import numpy as np
import pandas as pd
import atom3d.datasets as da
import atom3d.filters.filters as filters
dataset = da.load_dataset('tests/test_data/lmdb', 'lmdb')
standard_amino_acids = ['THR', 'TYR', 'ARG', 'GLN', 'ILE',
'GLY', 'ALA', 'LYS', 'ASN', 'LEU',
'GLU',... |
c995ca35bb7fc874fc20e50055018bae1eaa0e2ad44583d6c73eb89b2164ce49 | Python | 2,598 | 73 | # 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 _layer_normalization(
X: np.ndarray,
W: np.ndarray,
B: np.ndarray,
axis: int = -1,
epsilon: float = 1e-5,
) -> tuple[... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.