sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
608ececb4d09f4de1df657147e068904afe2660e3e11e4b13d0ea309a9c981e8
Python
36,399
1,023
# SPDX-License-Identifier: LGPL-3.0-or-later import logging from collections import ( defaultdict, ) from collections.abc import ( Callable, Sequence, ) from typing import ( Any, ) import numpy as np import torch from torch.utils.data import ( DataLoader, ) from deepmd.pt.utils import ( AtomEx...
afafe9857c03d87d56d2e65e7718267d72a7ee9338d12bd01cdd47e4d06dd567
Python
36,873
1,023
# SPDX-License-Identifier: LGPL-3.0-or-later """Graph-route regression tests for the dpmodel DPA4 descriptor.""" import dataclasses import numpy as np import pytest from deepmd.dpmodel.atomic_model import ( DPAtomicModel, ) from deepmd.dpmodel.descriptor.dpa4 import ( DescrptDPA4, _graph_from_padded_nlis...
0fffadb20024a43ac894be1d6755f8c45c2cb94dfc772bf11a7d084c1ee5f8c9
Python
36,946
918
r""" Definition of a NeuronNode, NeuronTree and SWCForest class for representing the internal contents \ of an \*.swc file. Basic functions for manipulating, examining, validating and \ filtering \*.swc files. A function for reading \*.swc files from memory. """ from __future__ import annotations import os imp...
45e10ae3a74683e68dc5b131dee62fd776f62242490512d9bc9003c3fc354504
Python
36,992
1,115
# 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 pytest from itertools import islice from ampligraph....
4d776d51df1c99d078685fdcbc386c2616ea50aa94b09367b5766495894ff74c
Python
37,001
920
r""" Definition of a NeuronNode, NeuronTree and SWCForest class for representing the internal contents \ of an \*.swc file. Basic functions for manipulating, examining, validating and \ filtering \*.swc files. A function for reading \*.swc files from memory. """ from __future__ import annotations import os i...
25d5b606fb2d137a01fe77dabc2c5c7c37ea80c43dd4fd6928f6dc252d720837
Python
37,079
927
# 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 # """Data loader for graphs (big and small). This module provides GraphDataLoade...
8ba60b08040c6fd14743a49fd95deb5823c940d317fe0eb8b20c3617acee8d28
Python
37,124
766
""" Script to build main file of analyzed data Intended file information: I Fit Neurons - only for neurons which were fit by the ann <Neuron ID> <is lm id> <ZBrain Coords> <Barcode> <Jacobian> <Jac-cluster> <Complexity> <is vglut> II Neuron list - where neurons come from and where they are for all neurons <Neuron I...
0636244b7ade574c3aa6f8dd7c37535ef094c44312b293ba3dc28333b6945985
Python
37,203
964
# -*- coding: utf-8 -*- """ various math utilities, notably `eig` and a collection of simple functions in `Mh` """ from __future__ import absolute_import, division, print_function #, unicode_literals # from future.builtins.disabled import * # don't use any function which could lead to different results in Python 2 vs...
b393f0a7039a425034fd7e5d2619f4e33a948d87d6a607605f4981d868e3cfe1
Python
37,203
921
# Copyright (c) OpenMMLab. All rights reserved. import copy import inspect import random from math import ceil from numbers import Number from typing import Sequence import mmcv import numpy as np from ..builder import PIPELINES from .compose import Compose # Default hyperparameters for all Ops _HPARAMS_DEFAULT = di...
47ab0f2ac93d3a45d09b8d91d4a829ee7d40838651d81707e2a94c05b9e05743
Python
37,213
840
# SPDX-License-Identifier: LGPL-3.0-or-later """PyTorch ``torch.compile`` support for the deepmd backend. The deepmd PyTorch backend traces selected compute functions with ``make_fx`` and lowers them through Inductor while preserving the second-order autograd graph that force training requires. This module gathers the...
2bfe62ad5f81253181137f943b18a718365c0f3920867265d788694ebd9c6454
Python
37,333
1,040
"""Plotting functions for linear models (broadly construed).""" from __future__ import division import copy from textwrap import dedent import warnings import numpy as np import pandas as pd from scipy.spatial import distance import matplotlib as mpl import matplotlib.pyplot as plt try: import statsmodels asse...
8db36790cef36b7c36dba177a34c07fd9bcfc7c9f0fd55701b354f4109fd92fe
Python
37,480
969
# SPDX-License-Identifier: LGPL-3.0-or-later """ Edge cache construction utilities for SeZM. This module defines the shared procedures that assemble per-edge geometry, radial features, rotation blocks, and normalization terms used by the SeZM descriptor. """ from __future__ import ( annotations, ) import math fr...
874ae59dd94f62ed54b2dca987678c3980b70bf87982772f7587f551d44dc1c7
Python
37,509
850
from __future__ import absolute_import from __future__ import division from __future__ import print_function from ray.rllib.env.multi_agent_env import MultiAgentEnv from ray.tune.registry import register_env from gym.spaces import Discrete, Box, Dict import copy import numpy as np import time from stratego_env.game.s...
e2fd3f88ffbb71dfa33bc694be24a6b7d84d79dbf85a53d51c84f94c21464715
Python
37,527
743
if __name__ == '__main__': import os import Path_Finder from PyQt5 import QtCore, QtGui, QtWidgets, Qt from PyQt5.QtWidgets import QMessageBox from gui.CustomWidgests import BlobDetectionParameter from ControlMainWindow import ControlMainWindow import GuiFunctions as guif from easysetti...
559e2177b5ebf96d59ce1e3566a44907a2f963c1502f067a026318b3722d4dd8
Python
37,551
986
# 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...
cd521909522a795f75fede116bde04c9826eb1c1b4b49d1f8dff02e0bbc4a4d3
Python
37,565
773
""" @file: trainer_agent_pytorch.py Created on 31.05.22 @project: CrazyAra @author: queensgambit Definition of the main training loop done in pytorch. Partially based on: https://gitlab.com/jweil/PommerLearn/-/blob/master/pommerlearn/training/train_cnn.py """ import random import os import logging import glob from pa...
cd538372ea3f9d6297f8a3af4f35750322b03bacd110b60ed6a0429fd5884118
Python
37,639
699
#!/usr/bin/env python3 ######################################################################## # ------CRISPRspec and CRISPRoff scores computation Pipeline---- # # Copyright (c) 2018, 2021 by the contributors (see AUTHORS file) # # This file is part of CRISPRoff # # This program is free software: you can redistr...
532f5aa78b7c60dbebc2b6a1cc52697e51d808a5cc9562aa087e8b7e09603a11
Python
37,652
1,033
#!/usr/bin/env python ##Copyright (c) 2002, Fedor Baart & Hans de Wit (Stichting Farmaceutische Kengetallen) ##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 mu...
43ce11de6a915ed4bd7a2c4c713d0d4b001bbc802376bec97d100061bd32e426
Python
37,682
868
#!/usr/bin/env python import os import asyncio import json import logging import websockets import datetime import threading import ctypes import pylsl import struct import sys import functools import time import numpy as np import mne import matplotlib as plt import random import math import suspect_selector import r...
4973019c0875f3e1f6611a45d32454e04dfebe8b7eccabb9f1c242dbc41618e3
Python
37,704
1,138
# SPDX-License-Identifier: LGPL-3.0-or-later import inspect import logging from abc import ( ABC, abstractmethod, ) from enum import ( Enum, ) from typing import ( TYPE_CHECKING, Any, NoReturn, ) if TYPE_CHECKING: from typing_extensions import ( Self, ) from deepmd.tf.utils...
9f113698372364f2a661d17732d3b52ad2ce7ada331a1713810f94dd811ce5db
Python
37,772
1,164
# 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...
d509da4cdacaca1c4581f44a5c71ea0573c88600367f35a9b7ca20d16afaf8a2
Python
37,822
916
from src.visualization.useSansMaths import use_sans_maths # use_sans_maths() import matplotlib.pyplot as plt import seaborn as sns from matplotlib_venn import venn3 import glob import os import pickle as pkl import numpy as np import pandas as pd import pdb # debugging FIG_DPI = 300 import itertools # Distribution ...
039137ee2b1b3e9c50d7007a2ef39523b646856a6cdc66d2f647b730db6553bc
Python
37,836
1,115
# 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...
08cf2840dee0cdf803c16d2c172c2c8885982008120922509340d64c617d8dab
Python
38,028
930
#!/usr/bin/env python3 #!/usr/bin/env pypy3 from pyontutils.config import auth __doc__ = f"""Common commands for ontology processes. Also old ontology refactors to run in the root ttl folder. Usage: ontutils set ontology-local-repo <path> ontutils set scigraph-api-key <key> ontutils devconfig [--write] [<f...
4000bfaa6891f35eaeebad75e2e3e1026bea183b4f09da0652ecce4e3cb1d0ee
Python
38,055
1,072
"""TDE classifiers. Dictionary based TDE classifiers based on SFA transform. Contains a single IndividualTDE and TDE. """ __author__ = ["MatthewMiddlehurst"] __all__ = ["TemporalDictionaryEnsemble", "IndividualTDE", "histogram_intersection"] import math import time from collections import defaultdict import numpy a...
bcfdd8b314bf34c527c86698a73c10287f40d4a5931b6442f9efcd0eacf1af13
Python
38,160
1,007
#!/usr/bin/env python3 -u # copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """Implements meta estimator for estimators composed of other estimators.""" __author__ = ["mloning", "fkiraly"] __all__ = ["_HeterogenousMetaEstimator", "_ColumnEstimator"] from inspect import isclass import numpy as n...
cd522190063d7a330fe28dba0df35747c0ccb6a15f55e724e377edac4df791c8
Python
38,424
887
#!/usr/bin/env python import os import asyncio import json import logging import websockets import datetime import threading import ctypes import pylsl import struct import sys import functools import time import numpy as np import mne import matplotlib as plt import random import math import re import janus import si...
d8dff9f816470dd252fa6565e87158431467d1ad56ba5d499d32e1210cbac654
Python
38,465
851
import re from numpy.random import shuffle from copy import deepcopy from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem.rdchem import ChiralType VERBOSE = False USE_STEREOCHEMISTRY = True MAXIMUM_NUMBER_UNMAPPED_PRODUCT_ATOMS = 5 INCLUDE_ALL_UNMAPPED_REACTANT_ATOMS = True def mols_from_smiles_list(...
8fa503df947adf5e2419ccb7a567406661482f001e9d38f037d5dc1a82c6cea0
Python
38,518
1,222
# 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...
d832043d1ce5ea73e1d38608030d325038439872d8f56b213ce6d0a94df65631
Python
38,640
1,067
""" Author: Junhong Shen (jhshen@g.ucla.edu) and Peidi Xu (peidi@di.ku.dk) Description: Implementation of GCO Forest, a modified version of Global Constructive Optimization (GCO) algorithm with multiple root nodes. References: Georg, Manfred; Preusser, Tobias; and Hahn, Horst K., "Global Constructive Opti...
fb79a26f2e1d6e48230e65e87e534fbec372ef256b8a95f1631f0f9ba18ba8aa
Python
38,689
766
import pandas as pd import json import os import logging from dendrogram_tools import dend_json_2_nodes_n_edges from template_generation_utils import get_synonyms_from_taxonomy, read_taxonomy_config, \ get_subtrees, generate_dendrogram_tree, read_taxonomy_details_yaml, read_csv_to_dict,\ read_csv, read_gene_da...
5b21c7a5558521e6c6edce0664b487c156ae70daf4823ce33dbbb11a7f38a55e
Python
38,720
1,171
# SPDX-License-Identifier: LGPL-3.0-or-later """The entry points for DeePMD-kit. If only printing the help message, this module does not call the main DeePMD-kit module to avoid the slow import of TensorFlow. """ import argparse import logging import os import textwrap import warnings from collections import ( de...
6a502b61bcfb844d86e322e479eb738e69c488ad3f3651f008459e82c386e5a3
Python
38,720
881
from __future__ import annotations from functools import lru_cache import json import math from typing import Any from typing import cast from typing import TYPE_CHECKING from typing import TypeVar import numpy as np from optuna import _deprecated from optuna._convert_positional_args import convert_positional_args f...
6b76dfdb09ad0d71b3bf51d02703fa2f8289406f4b67caff539e9a7f40ea1db1
Python
38,764
993
# 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 abc import glob import logging import os import shelve import shutil imp...
55205f32c1b15af5efe57c0949959f687bb7c88cb766d7ab860ac58e5d17f4a3
Python
38,784
1,055
# !/usr/bin/env python3 -u # copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """Implements functionality for specifying forecast horizons in sktime.""" __author__ = ["mloning", "fkiraly", "eenticott-shell", "khrapovs"] __all__ = ["ForecastingHorizon"] from functools import lru_cache import nump...
e3039823d67d86f85e6015d7262d3712c8a66468dda837462b3c051275108671
Python
38,790
1,006
import pytest import flair from flair.data import Sentence, Token, Relation from flair.splitter import ( NewlineSentenceSplitter, NoSentenceSplitter, SciSpacySentenceSplitter, SegtokSentenceSplitter, SpacySentenceSplitter, TagSentenceSplitter, ) from flair.tokenization import ( JapaneseToke...
d2cb4e5c2fa004567051db73f0244e0a5890a154a64412a325032c1a963c618c
Python
38,804
807
import logging import numpy as np import ase logger = logging.getLogger('DockOnSurf') def select_confs(conf_list: list, magns: list, num_sel: int): """Takes a list ase.Atoms and selects the most different magnitude-wise. Given a list of ase.Atoms objects and a list of magnitudes, it selects a number of ...
5b7119dfef68c69b047c877af96a0027a4a7f2624897562afb9b5ae40b3323d5
Python
38,854
1,023
# -*- coding: utf-8 -*- # Written (W) 2008-2012 Christian Widmer # Written (W) 2008-2010 Cheng Soon Ong # Written (W) 2012-2014 Daniel Blanchard, dblanchard@ets.org # Copyright (C) 2008-2012 Max-Planck-Society, 2012-2014 ETS # This file is part of GridMap. # GridMap is free software: you can redistribute it and/or m...
deaece93e9682e08a027d922664d354044dbb6723880ccbc84e8ab152b9cf986
Python
38,868
831
""" Networks store neuron and synapse types, and the pattern of connections between them. While not capable of being simulated directly, they are used as a template for compilation. """ """ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IMPORTS ...
639ab586911ecdc39f014ec92d94045c705a79a58c61a965769b7005ddd10f3b
Python
38,898
1,075
from timeit import default_timer as timer import tifffile import warnings import sys import numpy as np from math import ceil import cv2 import os from seas.rois import get_masked_region, insert_masked_region from seas.colormaps import DEFAULT_COLORMAP, save_colorbar from typing import Tuple, List def load(pathlist...
8ea6cb12d05ccc6ab10d31d6e111eeeaecd7eb4a10dedad41b75b22b3d6d6533
Python
39,101
1,141
""" Change detection module. Contains base classes for change detection task. """ import time import datetime import numpy as np import os import sys import ConfigParser import io import random import itertools import json import pickle import zipfile import string from collections import OrderedDict from psycho...
d9bee3298cc52704387fc93e8a30fde050f4a52daf85d7a23d03ae302ec030bc
Python
39,104
1,019
""" [Legacy] - This is a very old version of the simulation routine in simulation_utilities.py. """ import numpy as np import matplotlib.pyplot as plt from extended_ring_model import * from test_utilities import angular_difference, circ_scatter import sys #from scipy.stats import vonmises import copy class Agent(): ...
d920d0cf71f4783ea136b86d16bb0ac41da3f0a291481b042374d6bee40c8685
Python
39,140
892
''' This script (generate_reaction_templates) uses a MongoDB collection with atom-mapped reaction SMILES strings and parses them into a new collection containing the transforms. This is intended to be used with the Reaxys database. In the database, reagents can contribute atoms to the products. This means that those...
4d8e38ea33cde34fa77b052b975f5752bd8b92c34125493669bb39c477d420d2
Python
39,180
833
""" Module with data preparation classes and functions """ from __future__ import annotations import numpy as np import tensorflow as tf import model import h5py from typing import Union, List, Any, Optional, Tuple from scipy import signal as sig from scipy.stats import entropy from sklearn.neighbors import KDTree fr...
77dbca1e8276d3acf06378f198adbb04b50e0ce8da55d0f837447d8d040bc8f3
Python
39,217
1,216
""" Tools for generating auditory stimuli. """ from __future__ import division import numpy as np import scipy import scipy.io.wavfile import resampy def create(type, **kwds): """ Create a Sound instance using a key returned by Sound.key(). """ cls = globals()[type] return cls(**kwds) class Sound(ob...
94403f9898d517f19bd7713172e790b6c12dd9801d0a0e2f97430cab84536f1b
Python
39,361
1,275
# 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...
5033c2b0f3a3aa7852b59103a0feefce434382353340ae959634605409b03422
Python
39,371
946
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jun 11 14:12:04 2021 Multi-unit clustering model @author: robert.mok """ import numpy as np import torch import torch.nn as nn import torch.optim as optim import warnings from scipy.stats import norm class MultiUnitCluster(nn.Module): def __ini...
4be8d2d376a49a3c2d3e187473c97180c85478b0a2b7d82593b0dd1c51be2f4a
Python
39,421
832
import itertools import logging import typing from abc import ABC, abstractmethod from collections.abc import Iterator, Sequence from pathlib import Path from typing import ( Any, NamedTuple, Optional, Union, cast, ) import torch from torch.utils.data.dataset import Dataset import flair from flair...
87de2d5d971b1960fea3ac7cc95b3ba859c7318850ce83927b74fe0adcdfeefb
Python
39,529
1,111
# 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...
10b34181cd0615407471b7100a0d7e18054765e52d9a5d410f318ca4a7d849b7
Python
39,781
1,056
# SPDX-License-Identifier: LGPL-3.0-or-later import collections import logging import warnings from collections.abc import ( Callable, ) from functools import ( cached_property, ) from types import ( SimpleNamespace, ) from typing import ( Any, ) import numpy as np import deepmd.utils.random as dp_ran...
194e4cc1883fc4f9804c9515249cc33d1eb1b7088f67e5f7bdc496c9d9b8db58
Python
39,842
970
"""Tests for the input-validation helpers added to bcblib.tools.best_overlap. These tests cover: - _write_diagnostic - _check_image_space (shape / affine / orientation, error vs warn modes) - compute_cluster_features (shape guard, empty-overlap path) - compute_rope_classification (all three categories, edge cases) - g...
a2f62610dcac88ae570a588133b491ddaecce774e433bdcb72432ee1acdbcb1e
Python
39,958
1,091
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """Tests for ForecastingHorizon object.""" __author__ = ["mloning", "khrapovs"] from datetime import timedelta import numpy as np import pandas as pd import pytest from numpy.testing._private.utils import assert_array_equal from pytest import ra...
ccb3aa07e8b166c1a1462d82965f4a703d7a48bf7787bb908f603cc6786f85fd
Python
39,987
943
''' This script (generate_reaction_templates) uses a MongoDB collection with atom-mapped reaction SMILES strings and parses them into a new collection containing the transforms. This is intended to be used with the Reaxys database. In the database, reagents can contribute atoms to the products. This means that those a...
9a343475596064223cf3faca7a75e35aa5a3189f8ce1dc8dcea77b50869d8089
Python
40,128
73
from regionscode.regions_per_sections_p56 import regs_per_section, Regions_n_colors_List def create_regs_n_colors_per_sec_list(atlasnum): regs_per_sec_List = regs_per_section[int(atlasnum)] #list regs_n_colors_per_sec_List = [('root', 'not detected', '000000', (0, 0, 0))] for elem in Regions_n_colors_List...
c20062fcd713cd355905ab5d4564271338ae5f48721891f15f1103f588c5a92f
Python
40,130
1,293
# roifile.py # Copyright (c) 2020-2022, Christoph Gohlke # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this li...
b34aea040881804b646208ae34df7ab6ceedce84e627e528dde9020e69f170c5
Python
40,572
1,046
""" Make networks with all of the components, and make sure they all compile and perform the same. """ import numpy as np import matplotlib.pyplot as plt import torch import sns_toolbox from sns_toolbox.networks import Network from sns_toolbox.neurons import NonSpikingNeuron, SpikingNeuron, NonSpikingNeuronWithPersis...
e6985a1a7bcc262019856dd27e30ae443f315d5e08ee62c2b4d95ebee727134f
Python
40,582
1,038
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...
db8f66c29e54ef05a60eb093f27c6d39f94dabae58da7a1242876e9a8d58f66d
Python
40,653
939
import re from collections import defaultdict, Counter from ttlser import natsort from pyontutils.core import LabelsBase, Collector, Source, resSource, ParcOnt from pyontutils.core import makePrefixes from pyontutils.config import auth from pyontutils.namespaces import nsExact from pyontutils.namespaces import NIFRID, ...
6cdd7deac13ca3dc3b2e23b51115c9d7416011a670a92d17262710b87c22ed02
Python
40,753
1,171
import random import numpy as np from copy import deepcopy from dnnbrain.io import fileio as fio from dnnbrain.dnn.base import dnn_mask, dnn_fe, array_statistic from dnnbrain.dnn.base import UnivariateMapping, MultivariateMapping from dnnbrain.brain.algo import convolve_hrf class Stimulus: """ Store and hand...
b14d8a1e462dc4d3a3246ac0a770e86de7fb71b2834928e5e6069cebfce21b6d
Python
40,853
1,090
# SPDX-License-Identifier: LGPL-3.0-or-later """ Embedding layers for the SeZM descriptor. This module defines the type embedding, geometric initial embedding, and environment-seed embedding used to initialize SeZM node features. """ from __future__ import ( annotations, ) import math from typing import ( TY...
6637ef01cdfdc5b5fdc40ba860bcfc1218df0245632afae639230d2d01294a7d
Python
40,856
1,098
import itertools import tempfile import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import pandas as pd from scipy.spatial import distance from scipy.cluster import hierarchy import nose.tools as nt import numpy.testing as npt try: import pandas.testing as pdt except ImportError: impo...
1c00a56fab530a949ec4641d41868f62d0058e24c7a6519e20548f1c6ebeefb6
Python
40,904
941
''' This script (generate_reaction_templates) uses a MongoDB collection with atom-mapped reaction SMILES strings and parses them into a new collection containing the transforms. This is intended to be used with the Reaxys database. In the database, reagents can contribute atoms to the products. This means that t...
b73f253858f4e72f4d2b174b8731495742f3288598db76ce18bfd87639b7e07f
Python
41,072
1,162
import copy import shutil import pytest import flair import flair.datasets from flair.data import MultiCorpus, Sentence from flair.datasets import ColumnCorpus from flair.datasets.sequence_labeling import ( ONTONOTES, JsonlCorpus, JsonlDataset, MultiFileJsonlCorpus, ) from flair.tokenization import St...
0e7335221620222aa377e6a19ed2185c51bf6055dc88f042e0e1c0e31646829f
Python
41,135
700
import os import pickle import numpy as np import math from typing import Tuple import torch from torch import nn, Tensor import torch.nn.functional as F from torch.nn.modules import LayerNorm from torch.nn import TransformerEncoder, TransformerEncoderLayer, Transformer, TransformerDecoder, TransformerDecoderLayer fro...
4b07d050e1cdbefd71912e78ad4c0a6329a5bcb81f08452407a4b6bd0bbd1b0d
Python
41,159
944
# -*- coding: utf-8 -*- """Fitness surrogate model classes and handler for incremental evaluations. """ from __future__ import absolute_import, division, print_function #, unicode_literals, with_statement del absolute_import, division, print_function #, unicode_literals, with_statement ___author__ = "Nikolaus Hansen"...
4513c5b2fe70ddcbee60acb19ff516c7c49f8f5edf9c246df1fdedd7777af1e1
Python
41,260
786
""" Implementation of all available options """ from __future__ import print_function import configargparse from onmt.models.sru import CheckSRU def config_opts(parser): parser.add('-config', '--config', required=False, is_config_file_arg=True, help='config file path') parser.add('-save_config...
9c932a14a4f92d791c95f4b3b7ae88cf2b8d5414a68f643d2f32acfce740bed4
Python
41,351
953
import logging import tempfile from pathlib import Path from typing import Any, Optional, Union, cast import torch import torch.nn import torch.nn.functional as F from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence from tqdm import tqdm import flair.nn from flair.data import Dictionary, Label, Se...
dd3e7adbb9de6ca996f2c183973eae28c3d7f378ba1f708d2589213762245d59
Python
41,444
1,152
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from typing import TYPE_CHECKING import numpy as np import pytest from onnx import ( FunctionProto, GraphProto, ModelProto, NodeProto, SparseTensorProto, TensorProto, ValueI...
2570d3e06ff6f934ff7388b7a746b6c73358935b16406723fd9b8c82a5ad5e57
Python
41,692
1,062
""" Compute the cross-correlation between two spike trains For all of the spikes in st1, compute the time difference with each spike in st2, find where the difference is within a time window we are interested in, then get and return the indices for all of those spikes. We define 3 data structures first: RevCorrPars ar...
231e4c2acee3d6a202286885dfb7e409782638da06de0c215db0950c23919435
Python
41,737
984
import logging import typing from abc import ABC from collections import OrderedDict from pathlib import Path from typing import Any, Optional, Union import numpy as np import torch from sklearn.metrics.pairwise import cosine_similarity from sklearn.preprocessing import minmax_scale from tqdm import tqdm import flair...
b95620630a4fa341896671ce28480cbfd4c072cca5029cbcd262579827009ea4
Python
41,739
1,057
# SPDX-License-Identifier: LGPL-3.0-or-later from collections.abc import ( Callable, ) from typing import ( Any, ) import array_api_compat import numpy as np from deepmd.dpmodel.array_api import ( Array, ) from deepmd.dpmodel.utils.neighbor_graph import ( ALL_PAIRS, ) from deepmd.dpmodel.utils.nlist i...
741cf82f8c5b1390d0040de26654b07dcab5d064c89d732d9085c7293d1a11ab
Python
41,751
1,074
#!/usr/bin/env python3 # SPDX-License-Identifier: LGPL-3.0-or-later from __future__ import ( annotations, ) import logging import re import shutil import traceback from contextlib import ( nullcontext, ) from dataclasses import ( dataclass, replace, ) from pathlib import ( Path, ) from typing impo...
31bb3b07d290e6b3c27505c041eebe871768ec7109711d919bb79760fd841526
Python
41,760
860
import numpy as np import pandas as pd import argparse import os import re import random import multiprocessing from rdkit import Chem from tqdm import tqdm from rdkit import RDLogger RDLogger.DisableLog('rdApp.*') # Get the mapping numbers in a SMARTS. def get_idx(smarts_item): item = re.findall('(?<=:)\d+', ...
b8937722265dcc327a3c6c7d4d4860486549ebe85d8958229c01c445b4f2caa6
Python
41,815
727
""" Main script for training, evaluation, and running inference on object detection models. """ import os import numpy as np import cv2 import math import json import argparse import traceback from tqdm import tqdm import torch from torch.utils.data import ConcatDataset, DataLoader from torch.optim import SGD, Adam ...
6042163ecf36c336f75f8a5ba6ad2f1800792ef95d18fc37a0f7bc08680872f0
Python
41,953
1,282
# 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...
5829b38bae2c8d637ff455e53c369e12eeaf6caabcd3f7b62cf2746cfb3126b8
Python
42,074
1,022
# SPDX-License-Identifier: LGPL-3.0-or-later """Primitives of the long-range modules: pair topology, kernels and constraint.""" import itertools import pathlib import numpy as np import pytest from scipy.integrate import ( trapezoid, ) from scipy.special import ( erf, ) from deepmd.dpmodel.fitting.latent_cha...
6b68aac3fc0a269a4ca448e3c8f9f3f0ffc556d7e5397396b6fb65ba79170c4f
Python
42,387
879
from rdflib import Literal from pyontutils.core import OntId, OntTerm from pyontutils.core import simpleOnt from pyontutils.namespaces import OntCuries, partOf from pyontutils.namespaces import NIFRID, ilxtr, ilx, BFO from pyontutils.namespaces import definition, hasPart from pyontutils.combinators import unionOf, inte...
9e40da6e96a48eac200e3a0a1df9cb665a107e87549bd9bbd8098b7af2365c65
Python
42,439
1,144
from __future__ import annotations from typing import Iterable, Generator from warnings import warn import pandas as pd import numpy as np import os import warnings from joblib import Parallel, delayed import gc from scipy.sparse import csr_matrix, find, issparse, hstack from scipy.sparse.linalg import eigs from nump...
4e6089e951197e42fff40652ffefc337ea825e565a6e004009d97f3f43300f71
Python
42,543
1,053
# SPDX-License-Identifier: LGPL-3.0-or-later """dpmodel ZBL bridging as COMPOSITION (review 3638077323, redesigned). ``bridging_method: ZBL`` builds a ``LinearEnergyModel(LinearEnergyAtomicModel([dp, InnerPotentialAtomicModel], weights="sum"))`` -- the analytical term is its own atomic model summed with the learned on...
107479fbdd0e4eecae65874fbf0a8bbe197c4ada62bf655a1d0bd9ffbe264e84
Python
42,565
1,017
#!/usr/bin/env python3 import tempfile from pyontutils.config import auth __doc__ = f"""Use SciGraph to load an ontology from a loacal git repository. Remote imports are replaced with local imports. NIF -> http://ontology.neuinfo.org/NIF Usage: ontload graph [options] <repo> <remote_base> ontload config [optio...
0dd79e67126ac240764d6c39ebf65bedb3d31f70ea6a98c1925ad1251334e907
Python
42,806
1,023
#!/usr/bin/env python3 import tempfile from pyontutils.config import auth __doc__ = f"""Use SciGraph to load an ontology from a loacal git repository. Remote imports are replaced with local imports. NIF -> http://ontology.neuinfo.org/NIF Usage: ontload graph [options] <repo> <remote_base> ontload config [optio...
a27db1e59d73b76ca8e79237bf617e4e2e2ca1d09ad1b5e622af66042b578779
Python
43,102
1,113
# SPDX-License-Identifier: LGPL-3.0-or-later import functools from collections.abc import ( Callable, ) from copy import ( deepcopy, ) from typing import ( Any, ) import array_api_compat from deepmd.dpmodel.array_api import ( Array, xp_asarray_nodetach, ) from deepmd.dpmodel.atomic_model.dp_atomic...
fafb4ef10bbc2c28637b5e28e32a0d545b843e57df0daf62d11f5c4ae869872c
Python
43,171
1,156
"""Machine type checkers for Series scitype. Exports checkers for Series scitype: check_dict: dict indexed by pairs of str 1st element = mtype - str 2nd element = scitype - str elements are checker/validation functions for mtype Function signature of all elements check_dict[(mtype, scitype)] Parameters --------...
3058ed5ce88fa7c57ff659c4ba6bd783e5ff751bf81fe3d9d430604eac4902b5
Python
43,230
902
# -*- coding: utf-8 -*- """ Created on Fri Sep 1 16:36:50 2017 @author: daniel """ from neuron import h import experiment as e import parameters as p import time import random as rnd import numpy as np import sys import matplotlib.pyplot as plt import seaborn as sns class Spillover_Experiment(e.Experiment): ...
1e43fb83d06b47e3858459f76453dd0196949e45a1529687a6880185cdfb951f
Python
43,237
927
from __future__ import print_function import os import subprocess import vtk, qt, slicer from ElastixLib.utils import * from ElastixLib.manager import PresetManagerLogic from ElastixLib import web_launcher from slicer.ScriptedLoadableModule import * from slicer.util import VTKObservationMixin import logging # # Elas...
056887706b49beb99a2baf5eb1320543b7f7eb07fdbfec9efea2b0c231634172
Python
43,272
1,415
# -*- coding: utf-8 -*- """ Module: anlffr.spectral A collection of spectral analysis functions for FFR or other kinds of M/EEG data. Includes functions to estimate frequency content / phase locking of single-channel or individual data channels, as well as functions that produce estimates by combining across channels...
839c788754b1c7d5191b8e3d2f0d0b69b16e722e885e5ad9a7c5ce13b9ec359b
Python
43,445
1,139
# Copyright 2026 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...
dfdab5061bea31046360eb0d1bcf6330970ddbda7ada8e2287b501a5f5c37e4e
Python
43,619
899
# -*- coding: utf-8 -*- """ Created on Fri Aug 26 13:07:55 2016 @author: wanglab """ import os, sys, cv2, shutil import numpy as np, pandas as pd, SimpleITK as sitk import pickle import subprocess as sp from collections import Counter import tifffile from tools.imageprocessing.preprocessing import resample_par, color...
fbf3f4f837fecd1dafc175c78237f067edad627eea6352c7631ffca4da95d393
Python
43,634
1,195
# -*- coding: utf-8 -*- ''' py-iCSD toolbox! Translation of the core functionality of the CSDplotter MATLAB package to python. The methods were originally developed by Klas H. Pettersen, as described in: Klas H. Pettersen, Anna Devor, Istvan Ulbert, Anders M. Dale, Gaute T. Einevoll, Current-source density estimation ...
33f572fb92b89b8eab2a1e2addcea35f8c02341275c70dc8ffafa5cbd7f21ca3
Python
43,663
1,081
# 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.utils.neighbor_graph import ( NeighborGraph, ) import array_api_compat from deepmd.dpmodel.array_api import ( Array, ...
141dda6a0656a890beaba388afb638fd0b496ac5b2e88c35bdd5acec6235700c
Python
43,801
1,179
# SPDX-License-Identifier: LGPL-3.0-or-later import copy import dataclasses from typing import ( Any, ) import torch from torch.fx.experimental.proxy_tensor import ( make_fx, ) from deepmd.dpmodel.atomic_model import ( DPEnergyAtomicModel, ) from deepmd.dpmodel.model.dp_model import ( DPModelCommon, )...
70b875c0b0fb35374f22d3904da3a696ab70e9a67873561d3f2d6064a93038d6
Python
43,835
1,121
# Copyright [2020] Luis Alberto Pineda Cortés, Gibrán Fuentes Pineda, # Rafael Morales Gamboa. # # 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....
babb44686eae89dcb8523b9d9b30abf29314bbaa0fb4653d31878935a4dc5267
Python
43,854
797
from tqdm import tqdm import re import numpy as np import torch from torch.utils.data import Dataset, DataLoader import random import pickle import pandas as pd import os from Bio import SeqIO from sp_data.bert_tuning import ProtBertClassifier, parse_arguments_and_retrieve_logger from sp_data.sp6_data.read_extract_sp6_...
cff97fc7acac72315c8e1231595812b56116292110bb83178fcb9a6f92d401a0
Python
43,862
899
""" Networks store neuron and synapse types, and the pattern of connections between them. While not capable of being simulated directly, they are used as a template for compilation. """ """ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IMPORTS ...
de5114de74ad4bb97a20bfcd5babaac7c32fe55df8433487cd06d38c35fa0f84
Python
43,874
1,151
#!/usr/bin/env python3 """Render a tree from a predicate root pair. Normally run as a web service. Usage: ontree server [options] ontree [options] <predicate-curie> <root-curie> ontree --test Options: -a --api=API Full url to SciGraph api endpoint --data-api=DAPI Full url to Sci...
d37e858dc9351fac064ae6c9a268c41d437523e5cc3d23eac77ffbf0c1186c6f
Python
44,108
1,232
# 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...
8ff58d87dc1b438e84c3ae572d785fb21c00eb9e45e3302945f14fd9629b4081
Python
44,186
899
"""step-size adaptation classes, currently tightly linked to CMA, because `hsig` is computed in the base class """ from __future__ import absolute_import, division, print_function #, unicode_literals, with_statement import warnings as _warnings import numpy as np from numpy import square as _square, sqrt as _sqrt from...
1008231a49d30f5e9b2b99a53e512d99a2c3a24f4e8afc9e0e7b16dafdd7780c
Python
44,225
1,234
# 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...
e5b9329f6640f71ba29f5afff47093273297814e77c890385f59eaa7df22c825
Python
44,250
1,164
# SPDX-License-Identifier: LGPL-3.0-or-later """DPA4 / SeZM → AOTInductor ``.pt2`` freeze path for the pt backend. SeZM relies on a nested ``autograd.grad(create_graph=True)`` inside ``fit_output_to_model_output``; TorchScript cannot represent that graph, so DPA4 / SeZM checkpoints are routed through AOTInductor inste...
3650f45448f61b0d192f11e6b628f74883ed8bdb4942a42deca801af892c8a6b
Python
44,338
1,160
""" This program provides a graphical interface to help access model results for the SBEM reconstruction project. The display appears as 3 panels: One on the left with controls, one on the top right that is tabbed, showing either the current table, or the traces, and one on the bottom for text output. The left panel p...