sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
d2be815bcf3f880f78d903bc51258e8fb797536edff775ec5143e06402eb90cd | Python | 44,377 | 925 | import numpy as np
import pandas as pd
import os
import skimage as ski
import matplotlib.pyplot as plt
from tqdm import tqdm
import pickle
import copy
from scipy.spatial.distance import cdist, pdist, squareform
from multiprocessing import Pool, cpu_count
import itertools as it
import ot
import warnings
import copy
fro... |
b15ac57eaeb35fcab6f98421f072fd09e041622444d7cacc3dc2c2ed56225467 | Python | 44,510 | 894 | import rdflib
from pyontutils import combinators as cmb
from pyontutils.core import simpleOnt, OntId, OntGraph
from pyontutils.namespaces import OntCuries, makeNamespaces
from pyontutils.namespaces import NIFTTL, NIFRID, ilxtr, BFO
from pyontutils.namespaces import partOf, definition, editorNote, replacedBy
from pyontu... |
7332de783cb548796b476769b28a7c2090b6e8f7eab1934383b344cb812b3093 | Python | 44,563 | 1,056 | from matplotlib import colors, cm as mpl_cm
_rocket_lut = [
[ 0.01060815, 0.01808215, 0.10018654],
[ 0.01428972, 0.02048237, 0.10374486],
[ 0.01831941, 0.0229766 , 0.10738511],
[ 0.02275049, 0.02554464, 0.11108639],
[ 0.02759119, 0.02818316, 0.11483751],
[ 0.03285175, 0.03088792, 0.11863035],
... |
375e35a8c27217a24224a08cb2710c6a94c8cc3eea32cc6b7bea607643e81e08 | Python | 44,640 | 1,003 | from __future__ import annotations
import math
import numpy as np
from scipy import sparse, special, stats
from scipy.spatial import cKDTree
from sklearn.metrics import average_precision_score, matthews_corrcoef
def _safe_spearman(a: np.ndarray, b: np.ndarray) -> float:
keep = np.isfinite(a) & np.isfinite(b)
... |
1f837799cedce96846bc08ca586963f31c0120d69f450295ff4e9fb9a849080e | Python | 44,704 | 1,117 | """Functions to deal with DockOnSurf input files.
List of functions:
Auxiliary functions
-------------------
str2lst: Converts a string of integers, and groups of them, to a list of lists.
check_expect_val: Checks whether the value of an option has an adequate value.
check_inp_files: Checks if the CP2K/VASP input f... |
256dae80dbf209408ccf2bf21f5e0b6785e620ed0f8827663430435840acdf6d | Python | 44,769 | 1,205 | #!/usr/bin/env python3
import tempfile
from pyontutils.config import auth
from augpathlib import RepoPath as Path
temp_path = Path(tempfile.tempdir)
_resources = auth.get_path('resources')
_ddconf = _resources / 'doc-config.yaml'
_ddinit = _resources / 'docs-init.el'
_ddpath = temp_path / 'build-ont-docs' / 'docs'
_glb... |
4304b7cbf2150298e915b62afd5a84fc2caf8677e8205d6dfafda9cff89d41ba | Python | 44,785 | 1,205 | #!/usr/bin/env python3
import tempfile
from pyontutils.config import auth
from augpathlib import RepoPath as Path
temp_path = Path(tempfile.tempdir)
_resources = auth.get_path('resources')
_ddconf = _resources / 'doc-config.yaml'
_ddinit = _resources / 'docs-init.el'
_ddpath = temp_path / 'build-ont-docs' / 'docs'
_glb... |
fe21f3052c5727a896c55974b9a16bf03422d79c65f9fe7b2bce3c89d5a6d163 | Python | 44,804 | 1,158 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Unit tests for SeZM's AOTInductor ``.pt2`` freeze pipeline.
Layout mirrors ``source/tests/pt_expt/model/test_export_pipeline.py``:
a tiny fp64 SeZM model is built on the fly, so the tests are fully
self-contained and have no external-artefact dependency.
"""
from __futu... |
f35c3790dead510ac19df1273fd0b9adfbf485c38f80d360574ca392cb37b77d | Python | 44,839 | 1,043 |
import ntpath
from scipy import io as sio
from os import listdir
from os.path import isfile, join, isdir
import json
import re
import math
import os
import sys
import re
import resource
import inspect
import subprocess
import math
import argparse #https://docs.python.org/2/library/argparse.html
import time
import date... |
11295c930d7781249fd63af3b34543440d3f4f9f54b5f85a2c4226d9316da8e1 | Python | 44,846 | 1,040 | # Copyright 2019-2021 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 logging
import numpy as np
from sklearn.cluster import DBSCAN
from sklea... |
ddd69641f9c2cc6940673d944510ca084ebe3f20aa9300867bed4fe8e72d986c | Python | 44,873 | 1,141 | # Copyright (c) OpenMMLab. All rights reserved.
import inspect
import math
import random
from numbers import Number
from typing import Sequence
import mmcv
import numpy as np
from ..builder import PIPELINES
from .compose import Compose
try:
import albumentations
except ImportError:
albumentations = None
@P... |
e98454c80862d409588de84791e0f48c8e633eda073c6a301672afeeda12b1f3 | Python | 44,946 | 1,208 | """
Author: Junhong Shen (jhshen@g.ucla.edu) and Peidi Xu (peidi@di.ku.dk)
Description: Using a directed graph for speedup.
"""
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
import scipy
import pyvista
import warnings
# import functools
# import nibabel as nib
# from scipy.ndimage import la... |
445e3f7dce3fb1225d3be27a3eb1cd7f7efec5b7fc86bafa60b579252b04cb99 | Python | 45,075 | 1,125 | # SPDX-License-Identifier: LGPL-3.0-or-later
import logging
from abc import (
abstractmethod,
)
from collections.abc import (
Callable,
)
from typing import (
Any,
Optional,
)
import numpy as np
import torch
from typing_extensions import (
Self,
)
from deepmd.dpmodel.utils.seed import (
child_... |
41b7b1cee4781e873aafd735cff8eb36cf143610686a24ef022b798848b9efd3 | Python | 45,383 | 1,145 | # Authors: Christian Kothe & the Intheon pyxdf team
# Chadwick Boulay
# Tristan Stenner
# Clemens Brunner
#
# License: BSD (2-clause)
"""Defines the function load_xdf, which imports XDF files.
This function is closely following the load_xdf reference implementation.
"""
import functools
im... |
cb2fe9532a51bbc1e895efd1fb4e7d7f1de870521eb330b93d4d99c04591a8c5 | Python | 45,518 | 1,116 | """
Module: best_overlap
Description: Provides functions to process disconnectome maps by computing preserved
connections (cluster_prob × (1 − patient_prob)), extracting size-normalised
connectivity features per parcellation region, fitting a robust Bayesian
regression model (Stud... |
e7e6a99b8bb112d7de2d8b8395d5a7a4d997235f89e5bbead2d36f00dd490f81 | Python | 45,633 | 1,207 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import inspect
import math
import random
import warnings
from typing import Any
import ml_dtypes
import numpy as np
import pytest
from onnx import (
AttributeProto,
GraphProto,
ModelProto,
... |
c9105d7b8a8189801592f393669bfc11165c3340b900b8fde85d4b95c21e2a3a | Python | 45,718 | 1,449 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Native DP model format for multiple backends.
See issue #2982 for more information.
"""
import itertools
from collections.abc import (
Callable,
)
from typing import (
Any,
ClassVar,
)
import array_api_compat
import numpy as np
from deepmd.dpmodel import (... |
d5e06d8f8d7fad34896c249c7b978c3126df055dd954d05772f3a3162f7a2218 | Python | 45,975 | 1,054 | """Tests for bcblib.tools.lesion_features."""
import re
from pathlib import Path
from unittest.mock import MagicMock, patch
import nibabel as nib
import numpy as np
import pytest
# ---------------------------------------------------------------------------
# Helpers
# -----------------------------------------------... |
704d2db75b9a6f6c64963a9a391ac5d0d822124a6150d5d4a344fc1a8140535b | Python | 46,003 | 1,001 | #-------------------------------------------------------------------------------
# elftools: elf/elffile.py
#
# ELFFile - main class for accessing ELF files
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
from __fu... |
ab099e169f7af0d1221aeec426ae9866026178587a14cf2259f3309f0bfae2c9 | Python | 46,077 | 1,525 | # SPDX-License-Identifier: LGPL-3.0-or-later
# ruff: noqa: ANN001, ANN202
"""Fused grid pair product for training, on tensor cores.
Every grid operator of the model evaluates
``out = from_grid(to_grid(left) * to_grid(right))`` on coefficient operands
(``GridProduct`` directly, ``GridBranch`` at a single branch through... |
6b8fbaabe765a3e8239b5af296c7aa65f514205acfec59d59cc3cfb278aec2c5 | Python | 46,259 | 992 | """Util functions for reading and writing .ts files."""
__author__ = ["Emiliathewolf", "TonyBagnall", "jasonlines", "achieveordie"]
__all__ = [
"load_from_tsfile_to_dataframe",
"load_from_tsfile",
"write_dataframe_to_tsfile",
"write_ndarray_to_tsfile",
"write_panel_to_tsfile",
]
import itertools
... |
5d5e89d0f62ffcbf86a7a3c56f50e41cc322d6bb56ea891edce064faf40a0ee3 | Python | 46,692 | 1,405 | """
sweepstim.py 2: Sweep Harder
@author: derricw
Experimental rewrite of old SweepStim.
Takes N stimuli, builds N sweep tables and runs all simultaneously.
Experiment length is determined by the longest display sequence.
This should eventually replace SweepStim in the old stimulus module.
"""
import random
im... |
b871d7f3c0b0f604b3054cf7a5b6ed994887f724287c7052e0dbbf6c0447a6ff | Python | 46,811 | 1,097 | import importlib.util
import inspect
import logging
import re
import string
from abc import ABC, abstractmethod
from collections.abc import Sequence
from enum import Enum, auto
from pathlib import Path
from typing import Any, Optional, Union, cast
import numpy as np
import torch
from scipy import sparse
from torch.uti... |
0a10b2d5589d4bbec0a2154806605201bb498f141f5da68c716842e3b7949053 | Python | 47,042 | 1,387 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import collections.abc
import functools
import math
import numbers
import typing
from typing import TYPE_CHECKING, Any, TypeVar
import google.protobuf.message
import numpy as np
import onnx
from onnx ... |
4b12dab567a07d408833c5d67f182d649793b593e961a8c6509c502324814381 | Python | 47,118 | 1,303 | from __future__ import print_function
# encoding: utf-8
"""
pyqtgraphPlotHelpers.py
Routines to help use pyqtgraph and make cleaner plots
as well as get plots read for publication.
Intially copied from PlotHelpers.py for matplotlib.
Modified to allow us to use a list of axes, and operate on all of those,
or to use j... |
84dc20d2c07d3f0757e186eee4895c9cd03ff750c78f2e9c03c401f1e21774c1 | Python | 47,133 | 1,301 | """Functions to visualize matrices of data."""
from __future__ import division
import itertools
import matplotlib as mpl
from matplotlib.collections import LineCollection
import matplotlib.pyplot as plt
from matplotlib import gridspec
import numpy as np
import pandas as pd
from scipy.cluster import hierarchy
from . i... |
bd8a90159a60d09845c34bd5f4c87c315237e0be89469b64d43979f14c9f2666 | Python | 47,201 | 1,247 | #!/usr/bin/env python
# encoding: utf-8
"""
PlotHelpers.py
Routines to help use matplotlib and make cleaner plots
as well as get plots ready for publication.
Modified to allow us to use a list of axes, and operate on all of those,
or to use just one axis if that's all that is passed.
Therefore, the first argument t... |
090b389ab7dea1c22588587ac0899c8c311a978a2c310cca4f3a0f6d34e4767f | Python | 47,310 | 912 | import numpy as np
import numpy.ma as ma
from scipy.stats import norm
import pandas as pd
from sklearn.linear_model import LinearRegression
from scipy import stats
import matplotlib.pyplot as plt
import os
import networkx as nx
import pickle
import sys
from PIL import Image
from itertools import compress
sys.path.inse... |
b50d30040a5b145baa6cc81bffdf38fcb666134fb2fc6e8ce571acfcabd8e2f1 | Python | 47,326 | 1,241 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import random
import mmcv
import numpy as np
import pytest
from mmcv.utils import build_from_cfg
from mmcls.datasets.builder import PIPELINES
def construct_toy_data():
img = np.array([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]],
dty... |
843c7a918220f046cc20673245061b70a51c5b7573e208bc52b0bc7f0f43fed3 | Python | 47,381 | 1,254 | # -*- coding: utf-8 -*-
"""various utilities not related to optimization"""
from __future__ import (absolute_import, division, print_function,
) #unicode_literals, with_statement)
import os, sys, time
import warnings
import ast # ast.literal_eval is safe eval
import numpy as np
import collecti... |
2d3389adbadf0544775e544d0f5e7c1d3ca2e6be3275e822362c39fde82b2308 | Python | 47,382 | 1,262 | """Functions to visualize matrices of data."""
import warnings
import matplotlib as mpl
from matplotlib.collections import LineCollection
import matplotlib.pyplot as plt
from matplotlib import gridspec
import numpy as np
import pandas as pd
try:
from scipy.cluster import hierarchy
_no_scipy = False
except Impo... |
3cafc660355c8d249f28132105650cf116be3eb27e582118299e320ff9517600 | Python | 47,674 | 1,214 | import re
import sys
from decimal import Decimal
from datetime import datetime
from rdflib import RDF, RDFS, OWL, XSD, BNode, URIRef, Literal
from rdflib.graph import QuotedGraph
from rdflib.namespace import SKOS, DC, Namespace
from rdflib.plugins.serializers.turtle import TurtleSerializer
from ttlser.utils import subc... |
54ce3c283eddeaa5b51eb11f1c444794305ffb20e4f26c7563444ed8dcf18fc5 | Python | 47,697 | 958 | prediction_length = 100
import sys, os, datetime
import json
import torch
import random
import glob
from tqdm.notebook import tqdm
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, Seq2SeqTrainer, Seq2SeqTrainingArguments, DataCollatorForSeq2Seq
from datasets import DatasetDict, Dataset
import accelerate
... |
e9091d04c0a3cac6972b2db5b2766a239c7d34abab1559013cbca3adda80b472 | Python | 47,724 | 1,036 | import contextlib
import inspect
import logging
import os
import random
import time
import warnings
from inspect import signature
from pathlib import Path
from typing import Optional, Union
import numpy as np
import torch
from torch.nn.parallel import DistributedDataParallel
from torch.optim.sgd import SGD
from torch.... |
6032b094b139341a9c9a556066731e8ee083b20ad154ac838d56a49b3ede49fc | Python | 48,241 | 1,352 | # 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... |
61acda681fe0ccc2697c2618d3e2ad5ef60701c6be9222a99eca315a6714425d | Python | 48,390 | 1,509 | # 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... |
1023b09ce87dbb99636ed76dfce9fb9b4b4c5fef952a165ae471e3199361dead | Python | 48,635 | 1,289 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import os.path as osp
import random
import mmcv
import numpy as np
import pytest
import torch
import torchvision
from mmcv.utils import build_from_cfg
from numpy.testing import assert_array_almost_equal, assert_array_equal
from PIL import Image
from torchvisi... |
f33a66c6bde9d6c6ae80cc82c31181eef8e6c2186f14c3c9444c8ae205738357 | Python | 48,788 | 1,013 | import numpy as np
import xarray as xr
import pandas as pd
import os
import glob
import matplotlib.pyplot as plt
import matplotlib as mpl
import sciplotlib.style as splstyle
import src.data.analyse_spikes as anaspikes
import src.data.process_ephys_data as pephys
import src.models.network_model as nmodel
import src.d... |
c9f6d245a884da6e89aa1f50cc4e006815273c22f3365bc6113f0b69e5a62916 | Python | 48,942 | 1,365 | import tempfile
import copy
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import pandas as pd
try:
from scipy.spatial import distance
from scipy.cluster import hierarchy
_no_scipy = False
except ImportError:
_no_scipy = True
try:
import fastcluster
assert fastclu... |
e1c166a379b56d53258974a6bc75f80c1f8453097747fa389f7618ae888eba52 | Python | 49,019 | 1,244 | # 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 logging
import networkx as nx
import numpy as np
from scipy import opt... |
3da483b4b93e28e5f7eaa1529e7a0fa6a738a1f17c3bea012540d0c955cf3591 | Python | 49,285 | 1,352 | """Test load functions from different files format."""
__author__ = [
"TonyBagnall",
"AidenRushbrooke",
"SebasKoel",
"Emiliathewolf",
"jasonlines",
"achieveordie",
]
__all__ = []
import os
import tempfile
import numpy as np
import pandas as pd
import pytest
from pandas._testing import assert_... |
cbd372227ff7197d784c4f7dc808a3f7ce707ee1cf9a6fde064b8686bb5465c5 | Python | 49,530 | 1,241 | # SPDX-License-Identifier: LGPL-3.0-or-later
import functools
import math
from collections.abc import (
Callable,
)
from typing import (
TYPE_CHECKING,
Any,
)
if TYPE_CHECKING:
from deepmd.dpmodel.utils.neighbor_graph import (
NeighborGraph,
)
import array_api_compat
import numpy as np
fr... |
d2869eea19288b6dbc7f92fd7ee5b866a6ae06dd86be85bccc6ff516ecd8c474 | Python | 49,550 | 1,555 | # 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... |
3624f1e9bd98989a90d5e9ca52886102e1c7c7500b6e3a7e56b925cd2a17d7a9 | Python | 49,608 | 1,306 | #!/usr/bin/env python
"""A minimalistic implemention of CMA-ES without using `numpy`.
The Covariance Matrix Adaptation Evolution Strategy, CMA-ES, serves for
numerical nonlinear function minimization.
The **main functionality** is implemented in
1. class `CMAES`, and
2. function `fmin` which is a small single-line-... |
87c4f0fd89b00aa02dd88e86ecdebeba29ca22135d174c3c5a25ac3d1dc1932e | Python | 49,610 | 1,380 | from __future__ import annotations
from io import BytesIO
from struct import Struct as Packer
from typing import IO, TYPE_CHECKING, Any, Final, Generic, Literal, NoReturn, TypeVar
from .lib import Container, LazyContainer, ListContainer
if TYPE_CHECKING:
from collections.abc import Callable, Iterable, Mapping
... |
d9fdd011f195bb7575273d0447e5801a0fb9a2df9833cf93e1b4ba910bd82de1 | Python | 49,648 | 1,005 | # 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 itertools
import bisect
import numpy
from scipy.stats import kd... |
ba64a517b6c8c107f004dd80825f9e9b6756ab30689078017df6dcce1568bbc7 | Python | 49,649 | 1,205 | # 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... |
c0609e62f34b567e85591b0598f8f893d6bb15a778abea2cd0834abd7a132f8e | Python | 49,835 | 1,094 | """
Data pipeline for prompt tuning on the GIFT-Eval training split.
Two properties are worth calling out because they are easy to get wrong:
1. VAL SAMPLING. A single global min_past (the minimum over all tasks' val
slice lengths) lets one ultra-short dataset drag min_past toward 0 for every
dataset, so ... |
22911f7226d28551aea726d4615bd86142c0604c87a3c1d20eb30653fe4e65be | Python | 50,050 | 1,284 | # 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... |
cdab34ca665995e71ef9a8b1f0e233176577a6dfa2d40a381193844dfad2016f | Python | 50,135 | 1,046 | #!/usr/bin/python
# New matplotlib colormaps by Nathaniel J. Smith, Stefan van der Walt,
# and (in the case of viridis) Eric Firing.
#
# This file and the colormaps in it are released under the CC0 license /
# public domain dedication. We would appreciate credit if you use or
# redistribute these colormaps, but do not... |
87dc434d868923b7bb3c8e5e5dcf894429d033862fbb921ecc7c62996221cebe | Python | 50,183 | 1,391 | # Copyright 2017 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... |
b382d229ee811ee5528237f66dc0e9e693f54a5ce2cc9b5304179cc98dd42974 | Python | 50,192 | 1,005 | """
@file: MCTSAgent.py
Created on 10.10.18
@project: crazy_ara_refactor
@author: queensgambit
The MCTSAgent runs playouts/simulations in the search tree and updates the node statistics.
The final move is chosen according to the visit count of each direct child node.
One playout is defined as expanding one new node in... |
db7d588da0df455031386d9b9e730fd91122ddf32db023fd2a0b7ea58cf34db3 | Python | 50,192 | 1,005 | """
@file: MCTSAgent.py
Created on 10.10.18
@project: crazy_ara_refactor
@author: queensgambit
The MCTSAgent runs playouts/simulations in the search tree and updates the node statistics.
The final move is chosen according to the visit count of each direct child node.
One playout is defined as expanding one new node in... |
b81a13e829041c06eb4c859afdea0c67ca409330732975e30e012fd5f2ea239d | Python | 50,279 | 1,085 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# GNU LESSER GENERAL PUBLIC LICENSE
# Version 3, 29 June 2007
#
# Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
# Everyone is permitted to copy and distribute verbatim copies
# of this license document, b... |
da87a8128bdd81cebe132b27e6b7efa323bd8a252fc68225c4923f1e795ff10e | Python | 50,330 | 1,530 |
import copy
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import grad
from torch.optim import Optimizer
import sys
import glob
import os
import numpy as np
def loadnpz(name, allow_pickle=False):
#This simple function more easily load... |
9d91e9c9430f5b236cd286d99af94201eb17c582f4779a9ade9c033a5241539f | Python | 50,646 | 1,404 | # Copyright 2018-2026
# 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... |
5e87de8b04e09ff4813c76f8cde7a24ba022fb3f11873cdd2cac111a42c19a3a | Python | 50,746 | 1,247 | # SPDX-License-Identifier: LGPL-3.0-or-later
from abc import (
abstractmethod,
)
from collections.abc import (
Callable,
)
from typing import (
Any,
)
import array_api_compat
import numpy as np
from deepmd.dpmodel import (
DEFAULT_PRECISION,
PRECISION_DICT,
NativeOP,
)
from deepmd.dpmodel.arra... |
3d17e21571161c93bf0b16bcb2bcf4d6b14be036a7bec3b17ffbf62eb0dd1693 | Python | 50,780 | 1,660 | # 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... |
d8dd2bbe089b7ecde497a8c36799f81011443c6c1e8910b8cd5ff0a971853464 | Python | 50,870 | 1,559 | #!/usr/bin/env python3
"""python .obo file parser and writer
Usage:
obo-io [options] <obofile> [<output-name>]
obo-io --help
Options:
-h --help show this
-d --debug break after parsing
-t --out-format=FMT output to this format
options are obo or t... |
0ab2fcc6c3abaa8c4d6d0e8fa94e4d6413c88f9f18d033a9ccfac3e30a6d4f73 | Python | 51,333 | 981 | """
This was taken out of the odp script.
"""
import os
from matplotlib import font_manager # https://github.com/conchoecia/odp/issues/34#issuecomment-1636475654
from matplotlib.patches import Patch
from matplotlib.lines import Line2D
from matplotlib.font_manager import FontProperties
import s... |
335646116674a300dc3f93bdcabb19afc1e5a106b59276736c8f60fafe2b718a | Python | 51,430 | 1,315 | # 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... |
f471eaab8683a2bc08abdb52e669fc6fcb2227ccdd7d3488485a1f1baf16e60f | Python | 51,507 | 1,300 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""
Embedding layers for the DPA4/SeZM descriptor.
This module defines the type embedding, geometric initial embedding, and
environment-seed embedding used to initialize SeZM node features.
This module is the dpmodel (array-API) port of
``deepmd.pt.model.descriptor.sezm_nn... |
10aa28ba6d905167c204d88b07f58f18e998cf583b1898f2a3a88a227ac4b68e | Python | 51,597 | 1,714 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
from onnx.reference.ops.op_resize import _cubic_coeffs as cubic_coeffs
from on... |
c41eb2bb6ca04450f48e7c41fc7bd4051ecadc37225227358322e14405b98866 | Python | 51,598 | 1,522 | import warnings
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib as mpl
import matplotlib.pyplot as plt
from distutils.version import LooseVersion
import pytest
import nose.tools as nt
import numpy.testing as npt
from numpy.testing.decorators import skipif
try:
import pandas.testin... |
4cca03f67f4643a9b8894a32637a6874fc5fad81255198786d1e87c919dea8d8 | Python | 51,696 | 1,241 | from __future__ import annotations
from collections import defaultdict
from collections.abc import Callable
from collections.abc import Container
from collections.abc import Generator
from collections.abc import Iterable
from collections.abc import Sequence
from contextlib import contextmanager
import copy
from dateti... |
a9a06f6ad84a41adf550ee085c0a35b627af2cf816bb7468c40624c0fdd3ecbd | Python | 52,029 | 1,040 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import random
from sklearn.model_selection import train_test_split
from sklearn.metrics import r2_score, f1_score, mean_squared_error
from scipy.stats import gmean, kde
import scipy.stats as st
from sklearn.model_selection import KFold
import smote_... |
f5840128c6763073d17214548d06aea9884017cf4e266e2e3fa63d56c9eabd2a | Python | 52,033 | 1,321 | # SPDX-License-Identifier: LGPL-3.0-or-later
from collections.abc import (
Callable,
)
from typing import (
TYPE_CHECKING,
Any,
)
if TYPE_CHECKING:
from deepmd.dpmodel.atomic_model.dp_atomic_model import (
DPAtomicModel,
)
from deepmd.dpmodel.utils.exclude_mask import (
PairExcl... |
0d5e1824699ff03c085fc00b60b1fad60ef3e60c6296d867a5e0824d76ab7b01 | Python | 52,037 | 1,402 | #!/usr/bin/env python
#
# Copyright 2007, 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... |
50085df1c9844c3d72ed53dc47f9980ebfb64a0f6961f3be8f3b57f12e236b1a | Python | 52,108 | 1,155 | # Copyright 2019-2021 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 numpy as np
#import tensorflow as tf
import tensorflow.compat.v1 as tf
i... |
3adee5c5acea5eaad56ec01faa4dcc1697c4768263bbbbdf210ef43fdbb4d28c | Python | 52,170 | 1,043 | # 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.
from celltool.utility.terminal_tools import progress_list, Indetermin... |
8f881cdaf5a906cf9b9756fa80ab1e236e9f56ee22a65cfd353956c87a2a3969 | Python | 52,173 | 1,099 | from pathlib import Path
import subprocess
from typing import Collection, Union, List
import os
import re
import shutil
from pprint import pprint
import random
import numpy as np
import pandas as pd
import nibabel as nib
from matplotlib import pyplot as plt
import seaborn as sns
from matplotlib.cm import ScalarMappabl... |
9fdcb1f5dc2ebb4e1f72c7715eca0588afc2bfb07f216eca75502752132a1383 | Python | 52,416 | 1,554 | # Copyright 2022 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... |
930b57bde30db6124a841c3e3ddc7aa72f74a69983f3ed6c28bfe73e0bcdd480 | Python | 52,527 | 1,414 | #!/usr/bin/env python3 -u
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Base class template for detector base type for time series streams.
class name: BaseDetector
Scitype defining methods:
pretraining - pretrain(self, X, y=None)
fitting - fit(self, X, y... |
8c6d82b4bfc16ab559c2d47e7c1ea5a303f97ddd7bd4d8d99c9476e7e1d45305 | Python | 52,648 | 1,589 | # Copyright 2023 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... |
5a8d088831b45d0088f4de9330af2577121c1c22b19660203041fa90c72e44e3 | Python | 52,725 | 1,760 | #-------------------------------------------------------------------------------
# elftools: elf/enums.py
#
# Mappings of enum names to values
#
# Enums with _default_=Pass decode recognized values to names (str) and
# preserve unrecognized values as integers. This lets callers inspect files
# containing newer or vendo... |
5eed5689c1fab562c96d619bc7c9ba4ab864fd0f17f61b5dba962797d3446d7f | Python | 52,775 | 1,032 | # -*- coding: utf-8 -*-
"""
Created on Thu Jun 30 10:56:43 2016
@author: wanglab
"""
import networkx as nx
import matplotlib.pyplot as plt
import pandas as pd
#import pygraphviz as pg
from networkx.drawing.nx_agraph import graphviz_layout #from networkx.drawing.nx_agraph import write_dot()
from itertools impo... |
4e0fb737b175e1fa0a7a702e79a6c316729f4c3de2df3783a174fffa8833255b | Python | 53,033 | 1,225 | """
These are functions that are shared by odp, odp_trio, and other scripts
"""
# this is all needed to load our custom fasta parser
import os
import sys
snakefile_path = os.path.dirname(os.path.abspath(__file__))
dependencies_path = os.path.join(snakefile_path, "../dependencies/fasta-parser")
sys.path.insert(1, depen... |
ecb990101150244d26eb640994329aa2ff4e933dfbc15c0f67d711218aa129e7 | Python | 53,486 | 998 | import numpy as np
from copy import deepcopy
import slideio
import pandas as pd
import os,sys
from AMBIA_M1_CellDetection import pool_cell_detection,MoG_detection,calculate_colocalized_blobs,calc_new_coords,cfos_detection
from multiprocessing import Pool
import cv2 as cv
import multiprocessing
from collections import C... |
467b0f5e239a3699cd7c563de2b3dd0af876807f59c546ce7fd02bbdc39f4e32 | Python | 54,486 | 1,696 | #
# Copyright (c) 2010 Mikhail Gusarov
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, d... |
f0b8940134f1290ede9b56f5f656b339390f3db393958a1133e0e9225cfae804 | Python | 54,495 | 1,397 | # Copyright (c) OpenMMLab. All rights reserved.
import math
import warnings
from typing import Sequence
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import (build_activation_layer, build_conv_layer,
build_norm_layer, xavier_init)
from mmcv.cnn.bricks.registry i... |
9e028a4e32b49b25aabbaff8f415441723d6be747e72c88e549271c15994f4bf | Python | 54,547 | 1,497 | import ast
import copy
import pickle
import itertools
from pathlib import Path
from numbers import Number
from urllib.parse import urlparse
import idlib
import htmlfn as hfn
from terminaltables import AsciiTable
from pyontutils.utils import byCol, log as _log
from pyontutils.config import auth
from pyontutils.clifun im... |
a0e32867168b7bd8b99002fc339d3e5c519450adb5aab0ef9193875e1a323cdd | Python | 54,572 | 1,616 | import itertools
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import pytest
from numpy.testing import assert_array_equal, assert_array_almost_equal
from pandas.testing import assert_frame_equal
from seaborn.axisgrid import FacetGrid
from seaborn._compat import get_co... |
e2871e92f26b30202dd3a2d4ca3ee1cb5d83e118611737887688396a4272e4be | Python | 55,007 | 1,421 | import logging
import os
from pathlib import Path
from typing import Optional, Union
import flair
from flair.data import (
Corpus,
DataPair,
DataTriple,
FlairDataset,
Sentence,
TextPair,
TextTriple,
_iter_dataset,
)
from flair.datasets.base import find_train_dev_test_files
from flair.fi... |
09871dda1d8429262b473909bfeef354f55b6335e16d5120e631d0eafdb3f665 | Python | 55,093 | 1,280 | """Tests for bcblib.tools.damage_profile."""
import os
import textwrap
from pathlib import Path
from unittest.mock import MagicMock, patch
import numpy as np
import nibabel as nib
import pandas as pd
import pytest
# ---------------------------------------------------------------------------
# Helpers
# -------------... |
be6e674dc69111cfba72325b2211eb4ba947bad0545d53bfdf0cd61a123106d7 | Python | 55,161 | 1,647 | """
Plot the efficacy data into an axis
data_original is an old efficacy measurement data set plots appeared in some
posters. In the original table, cells 2 and 5 have their original reconstructed
axons. From runs done in 2020.
This is superseeded by the dataFull and dataNoDend tables below, from later sets
of runs w... |
4291cfadcb4ece8f8028a5c3fb5012090908e5c514d3151d436417816161ecb8 | Python | 55,432 | 1,517 | import ast
import copy
import pickle
import itertools
from pathlib import Path
from numbers import Number
from urllib.parse import urlparse
import idlib
import htmlfn as hfn
from terminaltables3 import AsciiTable
from pyontutils.utils_fast import byCol, chunk_list, log as _log
from pyontutils.config import auth
from py... |
c51fa67ae34f959768fac3a24aed266ccd594a020da72d2645cdb04489c1ac4f | Python | 55,535 | 1,224 | import inspect
import itertools
import logging
import typing
from abc import ABC, abstractmethod
from collections import Counter
from pathlib import Path
from typing import Any, Optional, Union
import torch.nn
from torch import Tensor
from torch.nn.modules.loss import _Loss
from torch.utils.data.dataset import Dataset... |
f427d0739dabfcd095d4f2b4a66630d74314326633f566670814a3c91a561ade | Python | 55,576 | 1,434 | import os
import cv2
import copy
import time
import torch
import numpy as np
from PIL import Image
from os.path import join as pjoin
from copy import deepcopy
from sklearn.decomposition import PCA
from sklearn.linear_model import LinearRegression, LogisticRegression, Lasso
from sklearn.svm import SVC
from sklearn.mode... |
28c713072092172c5348c7f95c6422be133b870e2ea7ad4d1018f471c115118b | Python | 55,697 | 1,493 | # Copyright 2019-2021 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 pandas as pd
import os
import numpy as np
import logging
import urllib
i... |
01e579a0e89ea056e15725b36de6bc39cf2c6c2ceac6c65c856fbb65853a8298 | Python | 55,712 | 1,171 | #!/usr/bin/env python
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
from matplotlib.lines import Line2D
from matplotlib.font_manager import FontProperties
import networkx as nx
import numpy as np
import os
import pandas as pd
import seaborn as sns
import scipy.stats as stat... |
aa1e5ea7c0485fc136f761f15fc6a7e7f3371b1eaa18b0edadfe91478d72efdb | Python | 56,057 | 1,347 | """Utility classes and functionalities loosely related to optimization
"""
from __future__ import absolute_import, division, print_function #, unicode_literals
import sys
import warnings
import math
import numpy as np
from multiprocessing import Pool as ProcessingPool
# from pathos.multiprocessing import ProcessingPoo... |
2f51a0423b1028503d859a6ecc2aca22bbe542c86eb0e4c60106a45b1413a795 | Python | 56,426 | 1,429 | # Copyright 2023 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
02097560037096e56d5f2a5536e7d0b03facb34d90a09a6c67421541a5c02c7a | Python | 56,658 | 1,542 | # SPDX-License-Identifier: LGPL-3.0-or-later
import io
import json
import logging
from collections.abc import (
Callable,
)
from typing import (
TYPE_CHECKING,
Any,
Optional,
)
import numpy as np
import torch
from deepmd.dpmodel.common import PRECISION_DICT as NP_PRECISION_DICT
from deepmd.dpmodel.out... |
2f58db665edc39ccb1fb2b282de5e7571867636a19654af5aac302c131b19c30 | Python | 56,721 | 1,132 | # -*- coding: utf-8 -*-
"""A collection of (nonlinear) constraints handling classes and helper functions.
"""
from __future__ import absolute_import, division, print_function #, unicode_literals
import warnings as _warnings
import collections as _collections
import functools as _functools
import numpy as np
from numpy... |
5b0970bad022a308d42a70c1c43c0837518cb9f157fb3f9c59233604a1f9c805 | Python | 56,978 | 1,772 | #!/usr/bin/env python
#
# Copyright 2007 Neal Norwitz
# Portions Copyright 2007 Google Inc.
#
# 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... |
a5e3c8d1377caa9093e28978db04e9adbc6271a208a21f75616a5c2ca18ff5bb | Python | 57,541 | 1,180 | # -*- coding: utf-8 -*-
"""Parameters and Options for CMA-ES.
"""
import math
from math import inf # used to eval options
import warnings as _warnings
import numpy as np
from . import boundary_handler
from . import utilities
from .utilities import utils
from .logger import CMADataLogger
from .recombination_weights imp... |
d55b589bf1edde4a29b9047e05fe98cc2cd3f1d8945995b943e773c75b6bf679 | Python | 57,698 | 1,629 | from __future__ import division
from itertools import product
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import pytest
from .. import relational as rel
from ..palettes import color_palette
from ..utils import categorical_order, sort_df
class TestRelationalPlotter(o... |
01a53f423abb7fa82c1ac389c2e9a6fda28e0b65f4cf5b3f57eb9c92663bcf5c | Python | 57,909 | 1,562 | """Main module of ParaDime.
The :mod:`paradime.dr` module implements the main functionality of ParaDime.
This includes the :class:`paradime.dr.ParametricDR` class, as well as
:class:`paradime.dr.Dataset` and :class:`paradime.dr.TrainingPhase`.
"""
import copy
from typing import (
Any,
Callable,
... |
8231735493f4c3c5f5e29006ba4f845e3bd5ed9e70184264faef236c1f16c47e | Python | 59,054 | 1,812 | """Proximity Forest time series classifier.
A decision tree forest which uses distance measures to partition data. B. Lucas and A.
Shifaz, C. Pelletier, L. O'Neill, N. Zaidi, B. Goethals, F. Petitjean and G. Webb
Proximity Forest: an effective and scalable distance-based classifier for time series,
Data Mining and Kno... |
220a43848a309ec2fb4d90307dc2b53b4ad226a095ef40ea2f2a1d3f79b8cb88 | Python | 59,382 | 1,428 | """
Plot responses to SAM stimuli and the vector strengths
Assumes that the analysis has already been done, and that the
location of that data is given in the 'wheres_my_data.toml' file
This module is part of *vcnmodel*.
Support::
NIH grants:
DC R01 DC015901 (Spirou, Manis, Ellisman),
DC R01 DC004551 (Ma... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.