sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ccf6d57fb2c962b1083a02dcdb12407485ed0417cc31d018c36f8e1654194d8f
Python
14,541
392
# -*- coding: utf-8 -*- """ Created on Fri Nov 22 10:46:47 2019 @author: Amelie Aussel """ from brian2 import * defaultclock.dt = 0.01*ms prefs.codegen.target = 'numpy' eq_HTC_buffer_mdPul=''' dV/dt=(-INa-IK-IL-IKL-IH-ITLT-ITHT-IAHP-IGJ-Iapp-Iapp2-J-Isyn-Itheta)/Cm_HTC : volt J : amp * meter ** -2 ...
7d37513d941d451432c81e3aa2796faa67740f15553285e4d41eb44a5326655c
Python
14,555
273
# Copyright (c) MONAI Consortium # 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 agreed to in writing, so...
7e7be2719951cdadf8fba3d303afe213d80a14780692cebdc8ae4601276ab956
Python
14,590
412
from __future__ import annotations import copy import functools import traceback from typing import Any import torch from spikingjelly.logger import logger from .triton_runtime import ( is_fp8_dtype, normalize_cuda_device, normalize_triton_compute_dtype_name, normalize_triton_storage_dtype, reso...
025a35ab8bd3c5dc3624476e903bc320092d482040122dd76314883e2061580b
Python
14,597
423
from typing import Optional import torch from .. import functional, surrogate from .base_node import BaseNode __all__ = ["QIFNode", "EIFNode"] class QIFNode(BaseNode): def __init__( self, tau: float = 2.0, v_c: float = 0.8, a0: float = 1.0, v_threshold: float = 1.0, ...
c57f1b852e70f06b30a2d24e5d7882aebf9a307b74fe6831d969085ee62eba96
Python
14,612
407
"""Flow based node and edge disjoint paths.""" from itertools import filterfalse as _filterfalse import networkx as nx # Define the default maximum flow function to use for the underlying # maximum flow computations from networkx.algorithms.flow import ( edmonds_karp, preflow_push, shortest_augmenting_pa...
0c56e29d5f3413c5ae85b17d11aaa230602799e3ed3b6f72b6a1ebc0fde9ee96
Python
14,623
391
# -*- coding: utf-8 -*- """ MeasurePointList ================ Measurements on a subset of points in large arrays. Paralllel measuremnts at specified points of the data only. Useful to speed up processing in large arrays and only a smaller number of measurement points. See also -------- :mod:`ClearMap.Analysis.Measu...
2f7836b3b35b91f5d7e9c05bc48f8ab3d137aba05ebecbcfb2f7a85fc4c3b5e7
Python
14,635
357
from spikingjelly.logger import logger import os from pathlib import Path import time from typing import Callable, Optional, Tuple, Union import numpy as np from . import utils from .base import ( EventBuilder, FrameCustomIntegrateBuilder, FrameFixedDurationBuilder, FrameFixedNumberBuilder, Neurom...
e7f22b33efc7e5713b9f74fa8c215243adc6187e9c1445afa16de2d914842b61
Python
14,635
415
import random from copy import copy import pytest import networkx as nx from networkx.utils import ( PythonRandomInterface, PythonRandomViaNumpyBits, arbitrary_element, create_py_random_state, create_random_state, dict_to_numpy_array, discrete_sequence, edges_equal, flatten, gr...
727bfa830c9193fc0b12076c200831448844194e4c3bdd8e5c30dae2cf6156b0
Python
14,640
438
""" Dot-commands of the interactive REPL. Commands are registered in :data:`COMMANDS` with the :func:`command` decorator, which records the handler together with its usage and help text. A handler is called with the REPL application and the text that follows the command name. """ import difflib import re from typing ...
c83a7fd4330527c298fb403a4cc58582354a736ae219c5c650d144f40171def0
Python
14,643
406
import sys import numpy as np import tensorflow as tf import tensorflow.keras.layers as KL import tensorflow.keras.backend as K class NCC: """ Local (over window) normalized cross correlation loss. """ def __init__(self, win=None, eps=1e-5): self.win = win self.eps = eps def ncc(...
c75d396045587a8757d0dd7878c6632826638769f0cfdc18f2566cf94bf91475
Python
14,664
412
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Feb 7 00:25:29 2023 @author: wirrbel """ #load modules import nrrd import pandas as pd import numpy as np import os from PIL import Image import tifffile output_dir = os.path.join("/home/wirrbel/2022-11-09_cortical_flatmap_test/","2023-02-06_colo...
40077d25f16b2a857c097bb045d74a0d64cfc02714508ca1587f48b975010bbb
Python
14,673
340
import tensorflow as tf import numpy as np from evoten.backend_tf import BackendTF from evoten.expm_gtr import expm_gtr, precompute_gtr, expm_gtr_from_decomp backend = BackendTF() class SubstitutionModel(tf.keras.layers.Layer): """ A utility class for handling parametrization of substitution models for ...
7d8518f25cae3a4140d45d2f484e645e9d0b3df11f87ad1aaa6fde0b5cbb2739
Python
14,685
430
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 12 16:23:57 2020 @author: amelie """ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Mar 11 13:56:08 2020 @author: amelie """ from brian2 import * from scipy import signal from FEF_full import * from LIP_full import * from mdP...
d18e88c3c95d72cbc4058f6909838465d2045340ba11a68e7d1cc1760e9c1af9
Python
14,690
281
#!/usr/bin/python # conc_effect.py by Patrick D Roberts (2022) # Calculate concentrations and effects on Wilson-Cowan model parameters from dose # import neural_mech.dose_to_model as dose2model # d2m = dose2model.Dose_Conversion() import numpy as np import pandas as pd def seperate_clinical_pre_post(clinical_data): ...
e3efde8fad4093bcd8c81e8f0e7193e21669b0b8ffdacda86e822076b3aed3e5
Python
14,690
452
""" Module containing custom layers Code taken from -> https://github.com/akanimax/BMSG-GAN """ import torch as th # ========================================================== # Equalized learning rate blocks: # extending Conv2D and Deconv2D layers for equalized learning rate logic # ================================...
b26c70dd0f20c0c1e5d90921503dedbbacf392fa246460ed2256df01f5898d29
Python
14,697
418
from __future__ import annotations from contextlib import contextmanager from functools import partial, singledispatch from pathlib import Path from typing import TYPE_CHECKING, overload import h5py import numpy as np import pandas as pd import zarr from scipy import sparse import anndata as ad from anndata._core.fi...
b8bbab67a6eb2e4691f68d5967bfee7ec6dc6237d02ccc40f9ec3c34483d5227
Python
14,697
480
from cogdl.data import Graph import scipy.sparse as sp import torch import numpy as np import scipy def getGRBGraph(graph: Graph): features = graph.x if hasattr(graph, "grb_adj") and graph.grb_adj is not None: adj = graph.grb_adj else: edge_index = graph.edge_index edge_attr = gra...
9b964b077033bdc0a6600f101ad14cb914484c322693798bb07261cbe5d88876
Python
14,699
401
""" This contains some utility functions for reading files, searching for entities, and other basic tasks. The functions to_conll_iob, read_conll and get_NER_tagcounts were modified from http://nlpforhackers.io/named-entity-extraction/ """ import codecs import os from collections import Counter try: import Config...
564232c453f0eda58e6624f7d8106cd64fcb16d97c1e360b5724bf1f6f12afcd
Python
14,701
404
"""Functions for generating grid graphs and lattices The :func:`grid_2d_graph`, :func:`triangular_lattice_graph`, and :func:`hexagonal_lattice_graph` functions correspond to the three `regular tilings of the plane`_, the square, triangular, and hexagonal tilings, respectively. :func:`grid_graph` and :func:`hypercube_g...
9f491f38330019b26d47cc2f0d50d179598132b51e94acf42a8911eae5004eac
Python
14,713
415
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
06c0b92a9ddb0c3ff517820f5eca3822868919cb939ba2060bd7eeea09d3faca
Python
14,720
455
import abc import os from collections.abc import MutableMapping from string import ascii_letters, digits from typing import Any, List, Mapping, Optional, Union from zarr.meta import Metadata2, Metadata3 from zarr.util import normalize_storage_path # v2 store keys array_meta_key = '.zarray' group_meta_key = '.zgroup' ...
2bda7c7730851b5a2f563e2ae313060a0c0e3c017d382140b113bf37613cf0b2
Python
14,732
358
"""Tests for bipartite community detection and quality functions.""" import pytest import networkx as nx from networkx.algorithms import bipartite from networkx.algorithms.bipartite.community import ( _bipartite_modularity_merge_delta, ) from networkx.algorithms.community.quality import NotAPartition class Test...
a5f4458f6ca19a35cf519c9d9fd74b981e6467f4f1d06cd0d6c4c18b2efe7964
Python
14,738
345
# -*- coding: utf-8 -*- """ Created on Wed Dec 4 11:35:36 2019 @author: aaussel """ from cells.RE_mdPul import * from cells.TC_mdPul import * from cells.HTC_buffer_mdPul_Destxhe_tests import * from mdPul_one_column_v3 import * from scipy import signal prefs.codegen.target = 'numpy' defaultclock.dt = 0.01*ms run...
3b11ea7de7f46416d864a29bd545aca2a7b034e173aae3bb5e0f4341eb2d0494
Python
14,741
466
""" This module includes the main class that handles the detection of the aromatic rings. """ # Python import(s). from collections import namedtuple import numpy as np # Private import(s). from src.chemical_shifts.auxiliaries import ACCEPTED_RES, RES_3_TO_1 # Add documentation to the NamedTuple. __pdoc__ = {} # Mod...
e528988bf5ef833df8ca89fe39056bfa923cbe39f45ffd4237c504634e2a330d
Python
14,743
496
# ----------------------------------------------------------------------------- # download_AMBA.py # Authors: Antoine Beauchamp, Yohan Yee """ Download in-situ hybridization data sets from the Allen Mouse Brain Atlas """ # Packages -------------------------------------------------------------------- import os import...
35564c9a59e4771830c0dc39183adcf3068d11171d0aee76c9d1dc05d380fe1c
Python
14,744
406
"""Swap edges in a graph.""" import math import networkx as nx from networkx.utils import py_random_state __all__ = ["double_edge_swap", "connected_double_edge_swap", "directed_edge_swap"] @nx.utils.not_implemented_for("undirected") @py_random_state(3) @nx._dispatchable(mutates_input=True, returns_graph=True) def ...
bd7837977b8a408d6bf68c3e1e51bde4b4c7c82e77cd71db82d13c7d3d31a9f5
Python
14,747
371
import multiprocessing import os from functools import partial from shutil import move, rmtree from typing import Any, Callable, Tuple import feather from alpineer import io_utils, misc_utils from pyarrow.lib import ArrowInvalid from ark.phenotyping import cluster_helpers, pixel_cluster_utils multiprocessing.set_sta...
b434dee822bd7a16c00ca52628d1862319d0afa166d209c727d58595965f44f0
Python
14,764
403
import enum from typing import Sequence import sys if sys.version_info >= (3, 12): from typing import override else: from typing_extensions import override import numpy as np import tensorflow as tf from hidten.tf.prior.dirichlet import T_TFTensor, TFDirichletPrior, TFPrior from hidten.tf.util import epsilon, ...
6d989e71b728a9c6af43ff8eed8ed8dc39de8bf34107a49f099b263899fd2787
Python
14,769
516
from __future__ import annotations import pickle import sys import warnings from abc import ABC, ABCMeta from collections.abc import Callable, Mapping, Sequence from functools import wraps from itertools import product from pathlib import Path import anndata as ad import geopandas as gpd import matplotlib import matp...
ab70df09de3931b57c53c7cb993297aaeebc7c8c914687cccfbb0e4c368f5cd3
Python
14,769
450
import unittest as ut import six from pysbm import additional_types as at class TestSetDict(ut.TestCase): """ Test Class SetDict """ # noinspection PyPep8Naming def __init__(self, methodName='runTest'): super(TestSetDict, self).__init__(methodName) def setUp(self): self.list = at.S...
21a3209f0388b2bf563d40c7efa7e861741cf7c01d906a93d482002fd1982907
Python
14,772
419
""" Error formatting and reporting for NeuroLang frontend. Provides readable error messages for Datalog and SQUALL parse and semantic errors, with source context, location pointers and actionable suggestions. """ import difflib import os import re import sys from functools import partial from typing import Callable, ...
170e30260384b9387de4b08967254d5738ee44591d0fd016891e19431d396982
Python
14,781
396
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # pyre-strict import time from asyncio import iscoroutinefunction from functools import partial from logging import ...
292f2b321ab88cb25fd8cc006c2a31c5e056ce0b3b6557efc936aec52d636be6
Python
14,782
364
""" Utilities for encrypting sensitive headers using Galaxy's Vault system. This module provides functionality to: 1. Identify sensitive headers that should be encrypted based on configuration 2. Encrypt/decrypt headers using the vault 3. Transform data structures to use vault references for sensitive headers This ca...
c97b6d76550552e11a28a50b3717084273b298992136bfb31ed8de204aad5a60
Python
14,784
458
import re from collections import namedtuple, OrderedDict, defaultdict from copy import deepcopy import numpy as np import pandas as pd HMMER_PREFIX_WARNING = "# WARNING: seq names have been made unique by adding a prefix of" class DefaultOrderedDict(OrderedDict): """ Source: http://stackoverflow.com/que...
f2dc17bb666e250f392980045073ef1c25531cad51a9db13ca2d6f6d06db59fc
Python
14,788
326
# Copyright (c) MONAI Consortium # 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 agreed to in writing, so...
b5f6e04b666232a38901e46322b97900e753c902a565a521a0a3f631fef63817
Python
14,791
534
import os import pathlib import random import tempfile import pytest import networkx as nx from networkx.utils.decorators import ( argmap, not_implemented_for, np_random_state, open_file, py_random_state, ) from networkx.utils.misc import PythonRandomInterface, PythonRandomViaNumpyBits def test_...
40a3064ee587332c39cda821db086b0c170434beede29be9b7fb9cd3f754f7af
Python
14,794
387
"""Opt-in Nsight Systems ranges for SNN training and inference scripts.""" from contextlib import ExitStack, contextmanager import json from pathlib import Path from typing import Iterator, Optional, Sequence import torch from torch import nn from spikingjelly.activation_based.base import StepModule __all__ = ["cap...
38817577cd8b7322d98703e38b60d968021dd99cc53d36f40dd0068cf52f0b1e
Python
14,804
385
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # pyre-strict from collections.abc import Iterable, Sequence from typing import Any, Self from ax.core.arm import A...
e830edc8802ac9f7374d81b84b60cdc48c6c5f6405db8b879edaedb0cdcd911f
Python
14,812
378
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # pyre-strict import math from itertools import product from unittest.mock import Mock import numpy as np import pandas as pd from ax.benc...
d474db8ba20fdff74179618fbbbd0594a47109f6828f474dec2189791def8442
Python
14,824
393
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # pyre-strict from ax.core.metric import Metric from ax.exceptions.core import OptimizationNotConfiguredError, UserI...
b680658cc16dc4e5acd63ea7b1bb5025181c4c68b62332aae2fda9c7c5e78db7
Python
14,845
441
# Test for Moody and White k-components algorithm import pytest import networkx as nx from networkx.algorithms import flow from networkx.algorithms.connectivity.kcomponents import ( _consolidate, _generate_partition, _reconstruct_k_components, build_k_number_dict, ) FLOW_FUNCS = ( flow.boykov_kolm...
5e584ff458c2f58ad818c17658a983e1372b504d51918e4d80aca8e852d6fcaa
Python
14,851
446
import logging from abc import ( ABC, abstractmethod, ) from collections.abc import Sequence from contextlib import contextmanager from typing import ( Any, Optional, ) import sqlalchemy as sa from alembic import ( context, op, ) from sqlalchemy.exc import OperationalError log = logging.getLog...
fec36d3e2bf81a9259d517e3444d362dd642c91cb3e3b38f1a0a852c85f4af9e
Python
14,855
386
import warnings import numpy as np import pandas as pd from copy import deepcopy from src.utility import get_reconstruct_coords, read_thunderstorm_drift_json import os import json try: from third_party.dme.dme import dme_estimate from third_party.dme.rcc import rcc3D except: print("unable to load dme drift ...
bf7f09ef32097fc40888bea0b915673516895af611d00b6de5a075ed7843a055
Python
14,871
350
import numpy as np from brian2 import get_device from brian2.synapses.synapses import SynapticPathway, Synapses from brian2lava.utils.math import check_convert_to_int32 from brian2lava.utils.const import LOIHI2_SPECS, EPSILON from brian2 import get_logger class LavaParameters: """ This class holds essential, static...
514a9761f4f2074e0d5b495b1aa701f5023cb3dae7e8254f2d8466ac1f3e9233
Python
14,874
478
""" This module contains the classes required to construct options. """ import argparse import contextlib import copy import functools import os import pathlib import tempfile import toml from .exceptions import OptionError from .reporting import warn class OptionDescriptor: """ Base option property descri...
8b254a9691cb5a5857e925a2a23be7b017ac1335662f5e0b75b8ccd9307bdfca
Python
14,893
289
# Copyright (c) MONAI Consortium # 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 agreed to in writing, so...
628a10ad92ad659f89489f57c4bc9bd90b3fb3a7332e19a636c1d5cee595f273
Python
14,917
513
from collections import Counter import numpy as np from scipy import ndimage from scipy import sparse from . import _seg_utils from .. import bbox def relabel_data(d, mapping, copy=True): """ Relabel data according to a mapping dict. Modify the entries of :param:d according to a :param:mapping dictiona...
187a8a8346c86cf9af670e0d592beb075b4f1297dfdd405ddaa8f2259d0deb8a
Python
14,922
332
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # pyre-strict from __future__ import annotations from copy import deepcopy import numpy as np from ax.adapter.base...
8b185c8cc6317cc86fdec015501bf8ef1d648412c0100fa79352e93227f50cf5
Python
14,936
393
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # pyre-strict from collections.abc import Sequence from typing import final import pandas as pd from ax.adapter.base import Adapter from a...
0a05f388ee7a258b661f0690e395e66f2793893cb06bb250b92706dd1a5ac3cf
Python
14,944
343
# Copyright 2020 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
558ac431642cc7484acb4d38fcc253e347ca5393e70eaf9338e8d83ee3f5432a
Python
14,960
327
# -*- coding: utf-8 -*- """ Created on 2020.05.19 @author: Jiahua Rao, Weiming Li, Hui Yang, Jiancong Xie Code based on: Errica, Federico, et al. "A fair comparison of graph neural networks for graph classification." (ICLR 2020). -> https://github.com/diningphil/gnn-comparison """ import time from datetime import ti...
f7934aebee9a0336a782a4a68f10881d53743f984200b8da3825d43e7513ffd9
Python
14,963
415
# -*- coding: utf-8 -*- """Useful functions for the pke module.""" from __future__ import division from __future__ import absolute_import from __future__ import print_function import os import sys import csv import pickle import gzip import json import codecs import logging from collections import defaultdict from...
fcd1aeb9779450c45919458bc709b3dd5ee350834c3ce26a92a6f1703e5a3fdb
Python
14,971
346
# -*- coding: utf-8 -*- """ Created on 2020.05.19 @author: Jiahua Rao, Weiming Li, Hui Yang, Jiancong Xie Code based on: Yang et al "Analyzing Learned Molecular Representations for Property Prediction" & "A Deep Learning Approach to Antibiotic Discovery" -> https://github.com/chemprop/chemprop """ from argparse impo...
7e4bd233d895b94f0aa75028e62281e0bf4c212f2da8907e286d950a10a9ab8a
Python
14,985
364
"""Detecting communities based on the Louvain Community Detection algorithm""" import itertools from collections import defaultdict, deque import networkx as nx from networkx.algorithms.community import modularity from networkx.utils import py_random_state __all__ = ["louvain_communities", "louvain_partitions"] @p...
48d7fed3b9b4d0d9c272af88e00474764edb8dc418b9f1c384d7e9430757e07a
Python
14,986
401
"""Borrowed from: https://github.com/AllenYolk/flash-snn/tree/main/flashsnn/utils https://github.com/fla-org/flash-linear-attention/blob/main/fla/utils.py """ import functools import torch from spikingjelly import configure from spikingjelly.logger import logger from . import triton_missing as dummy triton_op = to...
a397e458bac5929d9fb7eddab78f2c140cf13375fbac42c161ac70ed1711dd1f
Python
14,990
390
"""This module contains a linting functions for tool outputs.""" import ast from typing import TYPE_CHECKING from packaging.version import Version from galaxy.tool_util.lint import Linter from ._util import is_valid_cheetah_placeholder from ..parser.output_collection_def import NAMED_PATTERNS if TYPE_CHECKING: ...
7bbe3680bc54ffd8636cf9f90a04103c8fe18a7d9865062806444f7291ba0a47
Python
15,001
358
import pytest import networkx as nx from networkx.generators.classic import empty_graph from networkx.utils import edges_equal, nodes_equal class TestRelabel: def test_convert_node_labels_to_integers(self): # test that empty graph converts fine for all options G = empty_graph() H = nx.con...
882d018e78c78b2e635da295401d57f797d4e7940a4c7b919cf54ddbb8bc1e4b
Python
15,002
410
"""Tests related to awkward arrays""" from __future__ import annotations import warnings import numpy as np import numpy.testing as npt import pandas as pd import pytest from awkward.operations import str as ak_str import anndata from anndata import AnnData, ImplicitModificationWarning, read_h5ad from anndata.compa...
39859fa612bb6a9095789e1b36eddd66a2d2fadc5c9636aff45a28f0463c9e23
Python
15,014
389
import json import logging from unittest.mock import patch import projects.api import pytest from django.test import TestCase from django.urls import reverse from projects.tests.factories import ProjectFactory from rest_framework.test import APIClient @pytest.mark.django_db class TestProjectSampleTask(TestCase): ...
a5833897e90617e5485f80f11ec016d3d314798c1780ef6f348c15df3c9fcd53
Python
15,016
348
#!/usr/bin/env python # Copyright Michael Fonder 2021. All rights reserved. # ============================================================================== from __future__ import absolute_import from __future__ import division from __future__ import print_function from utils.custom_layers import * from m4depth_model...
b9c533d2af7a14d09ee20a8cd5d6d4c6743070b9a135042501ad08187dc34630
Python
15,032
356
#!/usr/bin/env python3 import sys import os import numpy as np # -expand module search path to parent directory sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) # -custom-written code import main from params.param_stamp import get_param_stamp_from_args from params.param_values import chec...
c099077982855a1ab51bb12ca8715f8f95d6b8c4e1effa8b9f2b43cc3bfd7645
Python
15,036
436
""" ######################################################################################################### Author: Álvaro Fernández García Date: 24 - Marzo - 2019 Description: Validación cruzada del clasficador encargado de detectar las Glándulas. #####################################################################...
010216a85bd23d59ee75f81c3fce2eb6b4504850dbe29132211232bead74f6c7
Python
15,037
377
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Classes and functions for training and saving models Created on Wed May 19 09:54:16 2021 @author: townesf """ import numpy as np import tensorflow as tf from time import time,process_time from contextlib import suppress from tempfile import TemporaryDirectory from o...
a1beff411ef264435782fd4dd3fd7467111d3dbddf5ffff2062ed1eea502db54
Python
15,038
417
import copy from typing import Callable, Tuple import torch import torch.nn as nn import torch.nn.functional as F from .. import base from ..functional.net_config import detach_net __all__ = [ "fptt_online_training_init_w_ra", "fptt_online_training", "ottt_online_training", ] def fptt_online_training_...
d25bafaaab7751351e3d75a8dca8326db1901c150dc2ed4ded594985b2f2a5a7
Python
15,046
481
# gapped_kmer.py # Authors: Jacob Schreiber <jmschreiber91@gmail.com> # adapted from code written by Avanti Shrikumar import scipy import numpy as np from concurrent.futures import ThreadPoolExecutor from numba import njit from numba import uint64 import numba from . import precompile _FIBONACCI = np.uint64(11400...
3f90c2a9797c505877ab1acc63fa1464abdc8bb31cdf8ab7ea589da7bf087efe
Python
15,050
339
import copy import functools import warnings import numpy as np import pandas as pd import spatial_lda.featurization as ft from sklearn.cluster import KMeans, MiniBatchKMeans from sklearn.metrics import silhouette_score from sklearn.model_selection import train_test_split from tqdm.notebook import tqdm import ark.uti...
15842d89a982f2daa15e948c21da1585474f0d39c47846a34d5c9a7222fb29b6
Python
15,055
415
import os import pathlib from glob import glob import numpy as np import torch import torch.nn.functional as F from torch.utils.data import Dataset from ..utils import import_attr from . import norms class FieldDataset(Dataset): """Dataset of lists of fields. `in_patterns` is a list of glob patterns for the...
e4c91ee097552b88c931a580ed64a375574e6375b0cac274f2d58985948a60a9
Python
15,058
491
import pytest import numpy as np from ..sFIR import smooth_fir def test_regress(): val1 = np.random.randint(1, 10) val2 = np.random.randint(11, 200) y = np.random.random((val2)) X = np.random.random((val2, val1)) out = smooth_fir.regress(y, X) assert type(out) == type(np.asarray([])) asser...
12cee3b966ef7ea81b42ea1ea1170ed83a832cfdd4b14ceb37ddfb964e7415fc
Python
15,066
375
"""Tests for tiling segmentation QC metrics.""" from __future__ import annotations import dask.array as da import numpy as np import pytest import xarray as xr import squidpy as sq from squidpy.experimental.im._tiling import compute_cell_info, compute_cell_info_tiled from tests.conftest import PlotTester, PlotTester...
d9bbc645fc40dafcdfb8af626c479ba4d331b2765275cb7e20d6f01d04bb99d7
Python
15,074
427
"""Qwen2.5 dense versus public-recipe SNN inference efficiency runner.""" from __future__ import annotations import argparse import gc import hashlib import math import os import statistics import subprocess import sys import time from pathlib import Path from typing import Dict, List, Mapping, Optional import torch...
cb0752a1015a62ae4efbb84f44be963c4488e2b7b369619ce83307ac07d47178
Python
15,075
509
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
e47bed5f6da169d35971276666a5268ecea6fd330da51f0bf895c4bc1252e021
Python
15,079
390
"""Offline CUDA implementation calibration; production never runs this search.""" import argparse import csv import hashlib import importlib import json import math import os from pathlib import Path import statistics import subprocess import time import torch FAMILIES = ( "if", "lif", "plif", "qif"...
d84cf6bbdd0ff6459a3a97a592eb64ef094c47cdbeec8d7bebaaebf8f5dec85b
Python
15,087
404
import os import time import numpy as np import tensorflow as tf import pickle import librosa from tensorflow.python.keras import backend as K from .dataset import DataSet from tqdm import tqdm # ---------------------------------------------------------------------------- default_opt = {'alg': 'adam', 'lr': 1e-4, '...
ec65dc0d9b0f3da8df00eeecc0c7ec1f971600d445ec72361ad74a1bf2d19326
Python
15,096
444
import matplotlib.pyplot as plt # To plot from scipy.optimize import curve_fit from pylab import * import numpy as np import random import math import time import os import glob import copy plottest = False # True Nrms = 10 # Number of averages DR_estimates = np.zeros(Nrms) Dz_es...
78f42bb53675bb8260b629d87383992e2c7cb3640a3a00a6b02aa04405f87cec
Python
15,098
312
import numpy as np import torch from torch.nn import functional as F from models.fc.layers import fc_layer, fc_multihead_layer from models.fc.nets import MLP, MLP_gates from models.conv.nets import ConvLayers from models.cl.memory_buffer_stream import MemoryBuffer from models.cl.continual_learner import ContinualLearne...
3e00e39e4f1495d3b4f9436f3b278b43a2a1aebf52f8df23582eee3cb457c21c
Python
15,101
418
import warnings import itertools import numpy as np from ..utils import compute_lipschitz_constants from ..progress_bar import bar, ProgressBar from ..backend import get_backend from ..scoring import r2_score from ..validation import check_cv def solve_sparse_group_lasso_cv(X, Y, groups=None, l21_regs=[0.05], ...
9054137ac362c0fa7a65e428f551de50eedbf2a03efe5dc19c4ac200e10fa384
Python
15,105
411
from __future__ import absolute_import import time import logging from collections import namedtuple from itertools import takewhile import email import re from ..exceptions import ( ConnectTimeoutError, MaxRetryError, ProtocolError, ReadTimeoutError, ResponseError, InvalidHeader, ) from ..pack...
fcc013783ade78141f5c9b711aa0417944cfa04ee9830aec821b10c1485a2798
Python
15,117
490
import pytest from clpipe.config.options import ProjectOptions, ScrubColumn, ScrubTimepoints from clpipe.postprocutils.image_workflows import * from clpipe.postprocutils.global_workflows import * def test_build_postprocessing_wf( artifact_dir, request, sample_raw_image, sample_raw_image_mask, sam...
b119d52108d7741ba3253e25f5de6a13c2621cf52118532125e87d3b786a4876
Python
15,121
447
from __future__ import annotations import importlib import importlib.resources import json from collections.abc import Callable, Sequence from typing import TYPE_CHECKING import jsonschema import pandas as pd import pytest from referencing import Registry, Resource from anndata import AnnData from anndata.acc import...
a8cd50a874b67e876da0feff1a8ad0efcb0cd3d4c459fb53f1068775769e2a1c
Python
15,124
380
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Classes and functions for training and saving models Created on Wed May 19 09:54:16 2021 @author: townesf """ import numpy as np import tensorflow as tf from time import time,process_time from contextlib import suppress #from shutil import rmtree from tempfile impor...
f7587ae286e6b4b783da742d5cf022fb6a401f29f6cc1188c8e672b1459cfda9
Python
15,138
398
#!/usr/bin/env python # Identification of potential RNA G-quadruplexes by G4RNA screener. # Copyright (C) 2018 Jean-Michel Garant # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundatio...
b22effd5102f9579e53debe81021697e8380fa43e83cf8fc55d16506507b7c54
Python
15,140
408
from typing import Optional import torch import torch.nn as nn import torch.nn.functional as F from .. import functional, surrogate from .base_node import BaseNode __all__ = ["MPBNBaseNode", "MPBNLIFNode"] class MPBNBaseNode(BaseNode): def __init__( self, v_threshold: float = 1.0, v_res...
fd40e7a798e4e85c69c24e319c80aa013291cadcbe34b5e15382390a12eebc3d
Python
15,140
418
from typing import Any, Callable, Dict, Optional import torch import torch.nn as nn from .. import functional, layer, neuron from ..layer.attention import QKAttention, SpikingSelfAttention from .._neuron import _make_multi_step_neuron __all__ = ["QKFormer", "qkformer_10_384"] class _PatchEmbedInit(nn.Module): ...
3233e990114d6d1703345828b5a85c6b0e41ee68909efd5f0ed3e6d211334d39
Python
15,146
380
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Classes and functions for training and saving models Created on Wed May 19 09:54:16 2021 @author: townesf """ import numpy as np import tensorflow as tf from time import time,process_time from contextlib import suppress #from shutil import rmtree from tempfile impor...
a659d10d33fecb103e28430fd441ce75bbbe7e60e5528d22637acf9a781986e5
Python
15,147
352
""" Manager and Serializer for libraries. """ import logging from typing import ( Optional, ) from sqlalchemy.exc import ( MultipleResultsFound, NoResultFound, ) from sqlalchemy.orm import Query from galaxy import exceptions from galaxy.managers.folders import FolderManager from galaxy.model import ( ...
8b8a416f9038366682b25951d578b3ca1513a1a40532e2d9f89af2c2440575b5
Python
15,155
491
import pytest import networkx as nx from networkx.utils import edges_equal def test_tensor_product_raises(): with pytest.raises(nx.NetworkXError): P = nx.tensor_product(nx.DiGraph(), nx.Graph()) def test_tensor_product_null(): null = nx.null_graph() empty10 = nx.empty_graph(10) K3 = nx.comp...
dd9dbef83ed820b98f36dbc40ce393afce55ecd621fce9f94fed1a9f6fc5d451
Python
15,159
428
import warnings import pytest from ..context import EngineContext from ..examples import Example from ..validation import ( _undefined_predicates, arity_errors, check_query, run_preview, ) def symbols(nl): """Return the names of the symbols of the engine.""" return {getattr(s, "name", s) for...
00fc5415c86bec88f0df3c184345b2a362b8e8e69dc8f260f301df8d760edeca
Python
15,168
336
# -*- coding: utf-8 -*- """ Created on 2020.05.19 @author: Jiahua Rao, Weiming Li, Hui Yang, Jiancong Xie Code based on: Errica, Federico, et al. "A fair comparison of graph neural networks for graph classification." (ICLR 2020). -> https://github.com/diningphil/gnn-comparison """ import time from datetime import ti...
e1b2114e026623dcb6b92b84e18ac12a9101041f235dfb0ca493a1c08db48f33
Python
15,179
447
import matplotlib.pyplot as plt # To plot from scipy.optimize import curve_fit from pylab import * import numpy as np import random import math import time import os import glob import copy plottest = False # True Nrms = 10 # Number of averages DR_estimates = np.zeros(Nrms) Dz_es...
2c34b97f8ea1f0e6401789eb31da2d37fe3215f7142745dd405aaa2dba730428
Python
15,185
371
import json import logging from collections.abc import ( Callable, Iterable, ) from typing import ( Any, Optional, TYPE_CHECKING, Union, ) from urllib.parse import ( urlsplit, urlunsplit, ) from sqlalchemy import ( Column, create_engine, delete, insert, Integer, ...
0e78d2456156b3f2aa20e82c1deafb08e4096b4613b302d4fa56ef47c4fb3eca
Python
15,188
471
import abc import dataclasses import typing from abc import abstractmethod from ._util import Assert, Copy, Iterable, MechId, MechIdTuple, Merge from .exceptions import ModelDefinitionError if typing.TYPE_CHECKING: from .parameter import Parameter @dataclasses.dataclass class CableProperties(Copy, ...
4f2e0f76b6741d594915b7f3d338e79840af8de43a7d80c95d27499d3f13b38d
Python
15,194
352
# Copyright (c) MONAI Consortium # 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 agreed to in writing, so...
9a24e2c495209b51aa57da9b265e68075af99ea7289fecd6336ec51a6e02baa3
Python
15,194
303
import torch from typing import Tuple from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence, pad_sequence from torch import nn import torch.nn.functional as F import numpy as np class RNNClassifier(nn.Module): def __init__(self, arch: str, static_input_size: int, dynamic_input_size: int, static...
3b97d9961a5944b58bdcceaf6820772740fa2cb417921eed3055349e44da09e6
Python
15,213
503
import numpy as np import matplotlib.pyplot as plt import theory_curve import scipy as sp import math import scipy.special import matplotlib as mpl from cycler import cycler from tqdm import tqdm myaxis_font = 8 myfont = 6 mpl.rcParams['axes.prop_cycle'] = cycler(color='bgrcmyk') plt.rcParams.update({'font.size': myf...
561330663cabc563cd55cc4e22ad33ababc5fe7c337811b9d37f0bf3920cd90e
Python
15,213
522
import pytest from brian2 import NeuronGroup,Synapses, run, ms from brian2.utils.logger import catch_logs from numpy.testing import assert_array_equal, assert_equal, assert_allclose import numpy as np from brian2lava.tests.utils import * def _compare(synapses, expected): conn_matrix = np.zeros((len(synapses.sourc...
a6d00b27fd56520f08ebbbf8f6b492f5bf9e1b8cdd5bd8d859694410031c4bf1
Python
15,216
359
"""Independent two-GPU DP/DDP/PP capture and correctness workload. Run DP with Python and DDP/PP with torchrun (two workers). Manual control uses ready/go/done/exit files in --gate-dir so the shell controls the NSYS session. No profiling interface is added to SpikingJelly distributed training. """ from __future__ imp...
6bfe6fe57f58e676cf03fb0a5cc5c727118d7547ac1828074b0111a79e56de19
Python
15,220
416
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
f8485dfa593c43630cec5134fba0899edbee177a1ebf14357553def4e042bc33
Python
15,221
361
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # pyre-strict """ Functions that create ``BenchmarkProblem``s based on BoTorch test functions. """ from collections.abc import Mapping fro...
68dcdf4902779624d09495831bfed5290fa2fa3e10d90931ac6f446ab4d12c50
Python
15,222
508
""" Synapse Assignment by Voxel Association Networks """ import random import copy import operator import itertools import torch import numpy as np import scipy.ndimage as ndimage import pandas as pd from ...types import bbox from ... import seg_utils from .. import colnames as cn from . import locs from . import ...
d0b4f7aa3303f230a549156a07569d74159d8953958284f09043307f7bffc2cc
Python
15,222
469
# -*- coding: utf-8 -*- """ Smoothing ========= Smooth a binary image based on the local configuration of voxels in a cube. See also -------- The algortihm has similarities to the skeletonization algorithm using parallel thinning (:mod:`~ClearMap.ImageProcessing.Skeletonization`). """ __author__ = 'Christoph Kirst...