sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e9c2431faa61a2fda12cdfa8208ad7b2747f56240935bfc64463866c92370847
Python
20,914
477
# 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...
8e3f4ee5c5ffcf69666a27136430d53a16034a61ee4509321fa04cba887fd5da
Python
20,916
531
#!/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 copy import deepcopy from unittest.mock import patch import numpy as np from ax.adapter.base imp...
e412f75994376343ccabe89455c13e976bec727ff790ae0b8b891d4cb139528b
Python
20,925
518
import pytest import networkx as nx def validate_grid_path(r, c, s, t, p): assert isinstance(p, list) assert p[0] == s assert p[-1] == t s = ((s - 1) // c, (s - 1) % c) t = ((t - 1) // c, (t - 1) % c) assert len(p) == abs(t[0] - s[0]) + abs(t[1] - s[1]) + 1 p = [((u - 1) // c, (u - 1) % c...
542a645fff9eb67c52114b61c5dcccd90857eba071b23ce0c441695c816b73fc
Python
20,926
484
""" Dependency management for tools. """ import json import logging import os.path import shutil from typing import ( Any, Dict, List, Optional, Type, TYPE_CHECKING, ) from typing_extensions import Protocol from galaxy.util import ( hash_util, plugin_config, string_as_bool, ) from...
be418d77cea13240fc11f9b61853587a3498416826be963af008627caa14a81e
Python
20,939
654
#!/usr/bin/env python # encoding: utf-8 """ Interface to NRRD volumetric image data files. The interface is based on nrrd.py, an all-python (and numpy) implementation for reading and writing nrrd files. See http://teem.sourceforge.net/nrrd/format.html for the specification. Example: >>> import os, numpy >>> ...
192e807eea16d21e9df0cbb8a1b3869cf340135c414008f3ce05da844fde34e1
Python
20,947
432
# -*- coding: utf-8 -*- """ Created on Fri Jul 5 13:06:13 2019 @author: schelskim """ from .generaltools import generalTools from .sortpoints import sortPoints import numpy as np from skimage import morphology as morph from scipy import ndimage from scipy.signal import medfilt2d as median2 import copy...
f3cc11eceefa0e10d0490c2fc68a25a0b316bc6bdd3611f0a72c8e0d464828e1
Python
20,949
583
__all__ = [ 'plot_corr_matrix', 'plot_linear_fit', 'add_text_adjust', 'swarmplot', 'boxplot', 'plot_kaplan_pval', ] import itertools import adjustText import numpy as np import pandas as pd import scipy from matplotlib import pyplot as plt import scipy.cluster.hierarchy as sch import seaborn a...
07a9625b19568f9161edfe925dbb60b818ab895adbd3b3cbfb99140d08699973
Python
20,968
578
"""This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license.""" from decimal import Decimal import bleach from constants import SAFE_HTML_ATTRIBUTES, SAFE_HTML_TAGS, SAFE_INSTRUCTION_HTML_TAGS from django.db.mo...
0d630f8bf15936f7d25473411fc12b70076212779665096924cb68c083b24088
Python
20,977
654
#!/usr/bin/env python # encoding: utf-8 """ Interface to NRRD volumetric image data files. The interface is based on nrrd.py, an all-python (and numpy) implementation for reading and writing nrrd files. See http://teem.sourceforge.net/nrrd/format.html for the specification. Example: >>> import os, numpy >>> ...
4e189c09f26814eb3704e55ec94a43e0abde99ed6f4b63528060097f3de9ca38
Python
20,992
650
import pytest import torch from spikingjelly.activation_based import ( functional, layer, neuron, op_counter, surrogate, ) def _assert_close(actual: torch.Tensor, expected: torch.Tensor): if actual.dtype == torch.float32: torch.testing.assert_close(actual, expected) else: ...
6c2ea12dff511f164cae6da3eabfd4440cc6d9a9696f78df54ff1113f1054b0a
Python
20,999
548
"""This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license.""" import json import logging import re from collections import OrderedDict, defaultdict from typing import Tuple, Union from urllib.parse import urle...
8948657e29dad3b2da8c51fef0bd206395387669edb2b8b73f6e1e09ef868657
Python
21,005
559
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ CellMap ======= This script is the main pipeline to analyze immediate early gene expression data from iDISCO+ cleared tissue [Renier2016]_. See the :ref:`CellMap tutorial </CellMap.ipynb>` for a tutorial and usage. .. image:: ../Static/cell_abstract_2016.jpg :t...
7cad3312f1e3f8dd29c7b303eae49f8528914d197bfa08e5b5f8beb378d2975d
Python
21,016
555
import abc from typing import ( Any, Dict, List, Optional, Sequence, Type, TYPE_CHECKING, Union, ) from typing_extensions import TypedDict from galaxy.tool_util_models.tool_outputs import ( ToolOutputBoolean as ToolOutputBooleanModel, ToolOutputCollection as ToolOutputCollectio...
1afa784ba72e05179a63cc1b7048fded85d75361aa43c7219c1fb582c0b0ae26
Python
21,018
578
import torchvision.transforms as transforms import h5py import numpy as np import torch import torch.nn as nn import vision_transformer import torch.nn.functional as F import matplotlib.pyplot as plt import time import torch.optim as optim n_epochs = 300 log_interval = 10 batch_size_train = 64 batch_size...
8a2bf0c99aed95910203715fb4ede4a067ad72262f11e9bc46ec92c9c92ffea7
Python
21,052
553
import math import os from datetime import datetime from functools import partial from typing import TYPE_CHECKING, Any, Sequence, cast import numpy as np import tensorflow as tf import learnMSA.model.training_util as training_util from learnMSA.util.embedding_dataset import EmbeddingDataset from learnMSA.util.sequen...
0ddd64215d3a5c87729cda4ac4730c45120ab17ba852c1bb408ce7b5f56d6422
Python
21,073
516
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # import hashlib import logging import os import shutil import subprocess import tempfile try: from threading import Thread except ImportErr...
b3f665c60aaf09b6341cffdd13e26cf4462dc068f4e267cc87ab97cd595ad048
Python
21,073
580
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations import itertools from abc import ABCMeta, abstractmethod from collections.abc import Collection, Iterable, Sequence from typing import ClassVar, TypeAlias import attrs import datumaro as dm import datumaro.compone...
552f5e0c662e6281b34f93e9e4bfeb45d5011b114d389c6eaf9f60fc43a061ff
Python
21,078
683
"""Adapt functions from scikit-learn to use different backends.""" import itertools import math from functools import partial from sklearn.base import BaseEstimator, TransformerMixin from sklearn.utils.validation import check_is_fitted from ..backend import force_cpu_backend, get_backend from ..validation import _ge...
cdffb6b915121fdc8e382561afbfe47aa01d301ec00ebbd67e980eccd335e2c4
Python
21,097
631
import numpy as np import warnings import numbers from timeit import default_timer as timer from datetime import timedelta def sub2ind(array_shape, rows, cols): return rows * array_shape[1] + cols def DAPCA( XX, labels, nComp, YY=None, alpha=None, beta=0.9, gamma=0.4, kNN=1, ...
a0d085a75c3bb54083b08d5f2f4ae7a75e9e1a35d0e9a6bcfa4863a1361d4ac7
Python
21,138
537
import pathlib import shutil import tempfile import types import unittest import numpy as np from bsb_test import NumpyTestCase, RandomStorageFixture, skip_parallel from neo import AnalogSignal, Block, Segment, SpikeTrain from neo import io as neo_io from quantities import ms, mV from bsb import ( Branch, Con...
7d79d8bab241cb646928524cc0f2a92f32285f64766cd56835cdc4cb5365df57
Python
21,151
622
import pytest import torch import torch.nn as nn from spikingjelly.activation_based import base, functional, layer, neuron def _create_test_model(): net = nn.Sequential( layer.Conv2d(1, 32, kernel_size=3, stride=1, padding=1), neuron.IFNode(), layer.MaxPool2d(2, 2), layer.Conv2d(3...
c002e2bc1e63b262d57e88baa511c4b762d48f3df7536cbae4110c406fe03135
Python
21,158
535
from __future__ import annotations from collections.abc import Callable from textwrap import dedent from typing import Any from docrep import DocstringProcessor from squidpy._constants._pkg_constants import Key def inject_docs(**kwargs: Any) -> Callable[..., Any]: # noqa: D103 # taken from scanpy def deco...
2d98f1cb123908a5fa299f87389fac735db5c8ddd7a28a97eff2353da5f39384
Python
21,176
826
import operator from pytest import raises from nl_expr import expression_walker, expressions from nl_expr.logic import Negation, Union as LogicUnion from .. import DatalogProgram, Fact, Implication, Conjunction from ..aggregation import ( AGG_COUNT, BuiltinAggregationMixin, DatalogWithAggregationMixin, ...
150745560b7c33d2515d9a59ac7b96bb9c7e3c5502a0199ce1a9480a99c2a36a
Python
21,188
604
import abc import logging import os from typing import ( Union, ) from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, iter_headers, ) from .tabular import Tabular log = logging.getLogger(__name__) @build_sniff_from_prefix c...
530f8c7aaddb02b0a055457f27b16c6d5c705ca3d01a5d02f8404b897869e804
Python
21,209
673
# -*- coding: utf-8 -*- """ Created on Sat Jul 25 16:13:56 2015 @author: ckirst """ ############################################################################## # Test Alignment ############################################################################## import os; from iDISCO.Parameter import * from iDISCO.Ru...
b704725ceb742502b0cc67e49c2396e12ebb2df51f0139f45a1604a3438f1402
Python
21,241
658
""" Joins of points within a Euclidean distance, computed with numpy. This is the numeric kernel of the Euclidean spatial-bound syntactic sugar (see :mod:`neurolang.frontend.datalog.sugar.spatial`), which only detects the bound and rewrites the rule. :func:`euclidean_distance` is the ``euclidean`` built-in function. :...
149de1887a426345fadb4d8d548f20a3d23efe1eedce3da610b16c1bbab00e52
Python
21,276
502
#!/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 # pyre-ignore-all-errors[8] # # `Mapped[T] = Column(...)` is the SA 1.4-compatible bridging form. SA 2....
97f5ffb63625a54260248b10aabf5d94b5f11d0ff8da43e30b8353e0eeb9963d
Python
21,283
520
import math import random from copy import deepcopy import numpy import torch from torch import nn from transformers import BertModel, BertConfig, AutoModel USE_CUDA = torch.cuda.is_available() MAX_OUTPUT_LENGTH = 32 class Beam: # the class save the beam node def __init__(self, score, input, outp...
1ede06fc377c971a6e85f1f2e19d0dbfb1ed27b747aee7bcae95b5349750833f
Python
21,287
591
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 14 16:43:35 2022 @author: akshay """ import pandas as pd import numpy as np import scipy from scipy import stats #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #from stack overflow def add_p_value_annotation(fig, array_columns, subplot=None, _format=dict(int...
05bb44b216812de3126b64735ea04203618527da524c47b44412d857168f6939
Python
21,315
642
""" Unit tests for dedensification and graph summarization """ import pytest import networkx as nx class TestDirectedDedensification: def build_original_graph(self): original_matrix = [ ("1", "BC"), ("2", "ABC"), ("3", ["A", "B", "6"]), ("4", "ABC"), ...
a35cbdac6c4caf593d4b268481cf5f84e1092273490c0f48e0000d650878f17c
Python
21,315
462
# 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...
d67e7ee118a5320f57b11b986d5ccb7f2a8ff61205d489768e22b9ca127419ab
Python
21,343
638
"""Maximum flow algorithms test suite.""" import pytest import networkx as nx from networkx.algorithms.flow import ( boykov_kolmogorov, build_flow_dict, build_residual_network, dinitz, edmonds_karp, preflow_push, shortest_augmenting_path, ) from networkx.algorithms.flow.utils import _capac...
f9a2c7a77a5b3fa362d8244edb62418a1aff310dbf01904df1edeb1e13144aa1
Python
21,355
506
import argparse import copy import os import subprocess import torch import numpy as np from sklearn.metrics import f1_score as compute_f1_score from collections import defaultdict # methods that need encoder trained before train_encoder_methods = ['cpc', 'spatial-appo', 'vae', "naff", "infonce-stdim", "global-infon...
4653c215df37ee2a6c69dd9808f278da4fcf19424241ac15a8075ff745defc8b
Python
21,359
626
import matplotlib #matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.cm as cm from matplotlib import gridspec import parmap import numpy as np import pandas as pd import os import shutil import cv2 import scipy.io as sio import scipy.signal from Specgram.Specgram import Specgram import glob2 f...
06b18cfa4a2a2252d426c90e56e0034c573942b2268aad81efc25d255a883ffe
Python
21,360
548
"""Tests for ancestral probability calculations and rate matrices.""" import os import numpy as np import pytest import tensorflow as tf from learnMSA import Configuration from learnMSA.model import LearnMSAModel, LearnMSAContext from learnMSA.model.tf import training import learnMSA.tree.tf.initializer as Initialize...
b163fcc4baa755af094fc440c8d51406e152078ad698f6c4d5daf95fc2c13495
Python
21,371
488
# 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...
231d62419206331918c6ee4d03a049672cd7c321d5444d78b57ec06048dc10b6
Python
21,432
647
"""Confounds Workflow Builder Functions. Contains a collection of processing workflow builders specifically for fMRIPrep confound file processing. """ import os import copy from typing import List from nipype.interfaces.utility import Function, IdentityInterface from nipype.interfaces.io import ExportFile import nip...
4e493643a17a22b66643962f43989f8fd65b56b4a1fd8def31b06a8b2a2262bf
Python
21,432
793
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Large Data and Parallel Tools This module provides an interface to tools to deal with large numpy arrays and speed up numpy routines that get very slow for data arrays of 100-500GB size """ __author__ = 'Christoph Kirst <ckirst@rockefeller.edu>' __license__ = 'MI...
ba9d8a1cc656d47bea3fab3583a441ce27a70ff67287cfad09ec4d1897dd17d3
Python
21,442
615
import copy import os from unittest import mock import pytest import torch from spikingjelly.activation_based import functional, layer, neuron from spikingjelly.activation_based.model import Spikformer from spikingjelly.activation_based.precision import ( PrecisionConfig, prepare_model_for_precision, ) from s...
15577acf8d99ba57de84f2fefb9b9a4da335b9ff099f0d3799cb9446b182c50e
Python
21,444
508
from __future__ import annotations import warnings import numpy as np import pandas as pd import pytest import scipy.sparse as sp from anndata import AnnData from squidpy._constants._pkg_constants import Key from squidpy.gr import ( centrality_scores, interaction_matrix, nhood_enrichment, spatial_nei...
5cf3246bb9c774bd7484df2ae3f012b6b4e9d561cb9ed28d2e473d79e5deb463
Python
21,445
505
# 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 typing import final, Literal import pandas as pd from ax.adapter.base import Adapter from ax.analysis.analysis import A...
39a209e87768f8b276ecb5367003d6cc77db97fde2a1bb06cdacbdc0395f2e99
Python
21,458
596
from __future__ import absolute_import import csv import functools import logging import os import sys import sysconfig from pip._vendor import pkg_resources from pip._internal.exceptions import UninstallationError from pip._internal.locations import bin_py, bin_user from pip._internal.utils.compat import WINDOWS, c...
a44c849b60bf533d310b72589c1f0fd8dfae78bcfead84e477c1c20467d0339e
Python
21,481
508
import threading from types import SimpleNamespace from unittest.mock import MagicMock, patch from core.current_request import CurrentContext from django.test import override_settings from label_studio.core.redis import ( delete_job_by_id, get_jobs_by_meta, is_job_on_worker, start_job_async_or_sync, ...
c429d4f79f6c32d50ee72fb31a5284555258a179e3439c51832d5f0246b59ae5
Python
21,483
477
""" Copyright (c) 2019 10x Genomics, Inc. All rights reserved. Mark PCR duplicates in a BAM file """ from __future__ import division import itertools import json import math import os import numpy as np import martian import pickle import pysam import tenkit.bam as tk_bam import tenkit.lane as tk_lane from barcodes i...
9bad9c6ba534d514fea680d21003174082e291b1b7a635036b1f97dd63021f8e
Python
21,521
579
import numbers from ..backend import get_backend from ..progress_bar import ProgressBar from ..utils import compute_lipschitz_constants from ..scoring import l2_neg_loss from ..validation import check_cv from ._solvers import solve_weighted_kernel_ridge_conjugate_gradient from ._solvers import solve_weighted_kernel_r...
1da56270e4b97f2d11814dd8bb3d7068ceecd3202fea86dd3ed408eb9ca83fb0
Python
21,530
487
"""Tests for mibidata.tiff Copyright (C) 2021 Ionpath, Inc. All rights reserved.""" import datetime import os import shutil import tempfile import unittest import warnings import numpy as np from skimage import io as skio, img_as_ubyte, transform from tifffile import TiffFile from mibidata import mibi_image as mi ...
e413b9610836842dfdc193a0d37d9d0522d592a6cda71d88db3823aed9fa35f6
Python
21,535
497
import io from typing import Callable from nl_expr.logic import Implication from nl_expr.expressions import Constant, Symbol from ..constraints_representation import RightImplication from ..ontologies_parser import OntologyParser def test_1(): owl = '''<?xml version="1.0"?> <rdf:RDF xmlns="http://www.w3.org...
250135d30f1c20f4328700877f5bef91f3d5f379bc25faa9d88f1c3e50274b02
Python
21,553
556
"""Unit tests for the :mod:`networkx.generators.random_graphs` module.""" import pytest import networkx as nx _gnp_generators = [ nx.gnp_random_graph, nx.fast_gnp_random_graph, nx.binomial_graph, nx.erdos_renyi_graph, ] @pytest.mark.parametrize("generator", _gnp_generators) @pytest.mark.parametrize...
402c354f395f18a46ab79bd3ad989b30e775bdfc5a9af437d9e23629546c1e77
Python
21,560
507
# 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...
92cbed9e4c17791eb622a09e35790c89be958d6d4df8e06aefaeacec65c1d2a8
Python
21,566
646
# -*- coding: utf-8 -*- # Copyright (c) Vispy Development Team. All Rights Reserved. # Distributed under the (new) BSD License. See LICENSE.txt for more info. """ About this technique -------------------- In Python, we define the six faces of a cuboid to draw, as well as texture cooridnates corresponding with the ver...
799cd46e4ade55f9d5972c9b65aa410586be2a6448a8e9ae316fb4b95e88e205
Python
21,589
468
"""Functions to create volumetric neuron densities for the following inhibitory neuron types of the mouse brain: - PV+ - SST+ - VIP+ - GAD67+ (a superset of the union of the previous three) The algorithm is presented in "Atlas of inhibitory neurons in the mouse brain" by D. Dimitri Rodarie et al., to appear in <journa...
4864229c97ac2a5e86bc500d284ba4f6aeab25cef452ef3b2e0dd7e41785cd38
Python
21,602
535
import pytest from ..agent import ( IclAgent, ReactAgent, extract_query, make_agent, parse_text_action, parse_verdict, ) from ..providers import LLMError, Reply from .fakes import ScriptedClient, assistant_config, provider PAIN_SQUALL = "obtain every Study that mentions 'pain'." PAIN_DATALOG =...
c7baca2501ab55d5aafc6f271b823c043b4fb2dccac78757e687316879b6199d
Python
21,618
667
# -*- coding: utf-8 -*- """ 3d Skeletonization PK12 ======================= This module implements the 3d parallel 12-subiteration thinning algorithm by Palagy & Kuba via parallel convolution of the data with a base template and lookup table matching. Reference --------- Palagyi & Kuba, A Parallel 3D 12-Subiterati...
5cb90661068ebbabcea308ff25cd2dc037603438393be3a301c037ff4607d6da
Python
21,619
487
# MIT License # # Copyright (c) 2019-2024 The PyQMC Developers # # 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, m...
d41e599bbdff97fd3e1d99f6ffa3e7e79f3060c2c662ccdd67646c7422b2d287
Python
21,619
515
#!/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 contextlib import nullcontext from dataclasses import replace from itertools import product from...
c6c4f4e3c3a4fee334661a5d737e2ab30575cda0863a52509ec6c64c3b26e68a
Python
21,637
590
# This module uses material from the Wikipedia article Hopcroft--Karp algorithm # <https://en.wikipedia.org/wiki/Hopcroft%E2%80%93Karp_algorithm>, accessed on # January 3, 2015, which is released under the Creative Commons # Attribution-Share-Alike License 3.0 # <http://creativecommons.org/licenses/by-sa/3.0/>. That ar...
15c1e9b305849cd51dd1e9f4f95c92ec9da7c42affdfcdeee761d9b965873dc2
Python
21,641
699
import inspect import json import math import numbers from textwrap import TextWrapper import mmap import time import numpy as np from asciitree import BoxStyle, LeftAligned from asciitree.traversal import Traversal from collections.abc import Iterable from numcodecs.compat import ensure_text, ensure_ndarray_like from...
718cd69e2792e78779913e37fa7c1ff99df36ad04bca57983f049768431fbf32
Python
21,655
537
import multiprocessing import os from functools import partial from shutil import move, rmtree import feather import numpy as np import pandas as pd from alpineer import io_utils, misc_utils from pyarrow.lib import ArrowInvalid from ark.phenotyping import cluster_helpers, pixel_cluster_utils multiprocessing.set_star...
74f555694629e325cce8c5ffb8c0f91a18679ee3b52d0a1e25563d60641dce54
Python
21,682
593
""" Superclass Manager and Serializers for Sharable objects. A sharable Galaxy object: has an owner/creator User is sharable with other, specific Users is importable (copyable) by users that have access has a slug which can be used as a link to view the resource can be published effectively making ...
3c7001f130d92327378373ac83be75c6571315d23083c5ff8036b4fff17ade97
Python
21,717
705
# -*- coding: utf-8 -*- # Imports import sys import torch from gpytorch.likelihoods import GaussianLikelihood from gpytorch.constraints import GreaterThan from sklearn.linear_model import ARDRegression from sklearn.model_selection import GridSearchCV import numpy as np import warnings from .base_models import gp_...
32c4aba1273a59bf0439417d2c072965c1fa662cd926601267b1900c18813728
Python
21,724
516
#!/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 from dataclasses import dataclass from logging import Logger from...
47f4433fef08af51e1bc314243e59f693b0c57b82c7717090c64cfa36bb13f6c
Python
21,746
530
import os import h5py import numpy as np import matplotlib.pyplot as plt from jinja2 import Template from typing import List, Dict, Optional import importlib.resources import base64 import io from .report import compute_per_position_ic, _plot_weights, tomtomlite_dataframe, generate_tomtom_dataframe from memelite.io im...
e930855bfcd0d35cdf8c65b688bb8904ab7381c14b117061aac966f5c603e559
Python
21,752
801
# -*- coding: utf-8 -*- """ RegularExpression ================= Module providing routines to check and convert between regular and file expressions. Utility module fused by :mod:`ClearMap.Utils.TagExpression`. """ __author__ = 'Christoph Kirst <ckirst@rockefeller.edu>' __license__ = 'MIT License <http://www.op...
fce29c4d3f189c89681b57801f059a1fa7c77f0ed33fdee4b7d34a4a63d5232f
Python
21,753
353
import unittest import sys import json with open(sys.argv[-1], 'rb') as f: INPUT_DICT = json.load(f) sys.path.insert(0, '../') from tension.base import FORCEModel from tension.models import EchoStateNetwork, NoFeedbackESN from tension.constrained import ConstrainedNoFeedbackESN, BioFORCEModel from tension.spiking...
0f5aa8fac6b5ee62770148f2c72c6fc2633658552de8afcd2da990327a1427ab
Python
21,781
533
#!/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 itertools from copy import deepcopy from datetime import datetime from unittest import mock fro...
67aab4cf9204ab122fe5abbb08e87c9253ae83a09dd954536bd7328ec3f5c96a
Python
21,783
563
"""Compare paired vision measurements and archive release evidence.""" import argparse import hashlib import json import math from pathlib import Path import re import statistics import subprocess import tempfile from urllib.parse import unquote, urlsplit import zipfile def _hash(path): with Path(path).open("rb"...
7584e51fef6e8d21afdb6fb1204fac87b222287080bb5c3469bc50f824ef7faf
Python
21,806
609
import matplotlib.pyplot as plt from scipy.optimize import curve_fit from matplotlib import gridspec from pylab import * import numpy as np import random import math import time import os import glob import copy # change the default font family plt.rcParams.update({'font.family':'Arial'}) plt.rc('xtick...
3ae5a3c3a7516f319e4351366ce2bbe78d8db3949f5500f9a900d0ff78f3c080
Python
21,810
576
""" Core state management functionality for Label Studio. Provides high-performance state management with caching and batch operations that can be extended by Label Studio Enterprise with additional features. """ import logging from datetime import datetime from typing import Any, Dict, List, Optional, Type from cor...
c3014274f04b888332e7c2adb96c0ed3cdb8dbbf50edc7ee73decc240524505b
Python
21,832
521
import logging import time import traceback from typing import Callable, Optional from core.feature_flags import flag_set from core.utils.common import load_func from data_import.uploader import load_tasks_for_async_import_streaming from django.conf import settings from django.db import transaction from label_studio_s...
6de8754e882c206bff80ee71004c8abe57bcb3108bd9b7e946114d294aff2489
Python
21,837
594
#! /usr/bin/env python import sys import argparse import numpy as np import pickle as p from multiprocessing import Manager, Pool import os import pandas as pd from copy import deepcopy from sklearn.model_selection import StratifiedKFold, GridSearchCV, KFold from sklearn.metrics import (f1_score, confusion_matrix, roc_...
e79d984454bc6a46de06277e88159f865db44493386f1f0a5a2e4cfa30dfb829
Python
21,839
451
from typing import Literal, Optional import torch from .. import surrogate __all__ = [ "bit_spike_compress", "bit_spike_decompress", "bit_pack_spike_dense", "packed_spike_linear", "sparse_linear", "if_linear", "lif_linear", ] def bit_spike_compress(spike: torch.Tensor) -> torch.Tensor: ...
5b1f1359aabe6fe17163510e95e77a4dd27d2315573d2511e948b4b056f2e986
Python
21,849
541
"""Utility functions for cell density computation.""" from __future__ import annotations import json from copy import deepcopy from pathlib import Path from typing import TYPE_CHECKING from warnings import warn import numpy as np import pandas as pd import scipy.misc import scipy.ndimage from atlas_commons.typing imp...
6c862f7d0d5b57eabc3697d7a3a460a7eb45365395dc1c52c2df8bb1d4331a72
Python
21,889
666
""" Set of syntactic sugar processors at the intermediate level. """ import operator as op import typing from typing import AbstractSet, Any, Callable, DefaultDict from nl_expr import expression_walker as ew from nl_expr import expressions as ir from nl_core.datalog.expression_processing import ( conjunct_formula...
7fb6de5da344ee76f6ec7c8236a06fd71f18c2223a0bd48e089c88554ca569d2
Python
21,890
660
# 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...
449aa19308b8a37bf02016166c293c4723f33c714327393b101c0bb7285b9036
Python
21,891
680
from __future__ import annotations import os from collections.abc import Callable, Mapping, Sequence from functools import wraps from inspect import signature from pathlib import Path from types import MappingProxyType from typing import TYPE_CHECKING, Any import matplotlib as mpl import numpy as np import pandas as ...
c5d14b1784466cff8a1f656c08db026b3c27294f44e7368739a4e5267fda8b59
Python
21,905
557
import os import warnings from pathlib import Path import numpy as np import pytest from learnMSA.util.sequence_dataset import SequenceDataset from learnMSA.util.aligned_dataset import AlignedDataset DIR = "tests/data/" def test_records() -> None: for ind in [True, False]: with SequenceDataset(f"{DIR}...
75aecbd51c6bdb89c57a70c863e72a4599923faf1299a8ed681695aabbbcc3d0
Python
21,926
722
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import logging import os import sys from enum import Enum from http import HTTPStatus from pathlib import Path from subprocess import PIPE, CalledProcessError, run from time import sleep import pytest import requests import yaml from shared.utils.c...
73d552d579a71953049a6487bff2e3a59bf3111fe2973c69a29162f801cfe8bd
Python
21,952
669
# -*- coding: utf-8 -*- """ This is a Python translation (end enhancement) of the original Matlab script released for the Frontiers paper, in 2018. This script defines the retinal contrast function. First the parameters are set. Then the function computes input scene luminances by combining a 2D input map of...
b3f56d902d2b6f99268387ad238114cb3220114fc1428c6dcb7c18228c645cfe
Python
21,952
379
# -*- coding: utf-8 -*- """ Created on Fri Jul 5 10:13:28 2019 @author: schelskim """ import os import numpy as np import pandas as pd from skimage import io import copy import math from skimage.draw import line_aa import re class Analyzers(): @staticmethod def analyzeIntensities(date,experiment,neuron...
a54aed7cbfdb5791246e459bc48221cbeca50fb641e7787ac8235b184690959a
Python
21,977
641
import torch import torch.nn as nn import h5py import numpy as np import torch.utils.data.dataset import torch.optim as optim import torchvision.transforms as transforms import torch.nn.functional as F import matplotlib.pyplot as plt import cls_cvt import time n_epochs = 200 log_interval = 10 batch_size_...
be25bfd1b52f358b0dd79f42c49f98e3d26efdd5b4fd45bca187850d8553679f
Python
21,977
641
import torch import torch.nn as nn import h5py import numpy as np import torch.utils.data.dataset import torch.optim as optim import torchvision.transforms as transforms import torch.nn.functional as F import matplotlib.pyplot as plt import cls_cvt import time n_epochs = 200 log_interval = 10 batch_size_...
19d16c8791e6dcff076f8d76384e6367ba9d6fb61877151b5bd7bc49a5a30108
Python
21,978
641
import torch import torch.nn as nn import h5py import numpy as np import torch.utils.data.dataset import torch.optim as optim import torchvision.transforms as transforms import torch.nn.functional as F import matplotlib.pyplot as plt import cls_cvt import time n_epochs = 200 log_interval = 10 batch_size_...
79f00caeb21accb871888cb43a92f834731b708becc6bdc41cf3d157dcc8281d
Python
21,978
641
import torch import torch.nn as nn import h5py import numpy as np import torch.utils.data.dataset import torch.optim as optim import torchvision.transforms as transforms import torch.nn.functional as F import matplotlib.pyplot as plt import cls_cvt import time n_epochs = 200 log_interval = 10 batch_size_...
352dbd86125857e9a0ba44edcc8b216243e9c0bf468697d031d17eb51ddf1e51
Python
21,980
641
import torch import torch.nn as nn import h5py import numpy as np import torch.utils.data.dataset import torch.optim as optim import torchvision.transforms as transforms import torch.nn.functional as F import matplotlib.pyplot as plt import cls_cvt import time n_epochs = 200 log_interval = 10 batch_size_...
f5298892f10f48b586f87906e3c3e06512d1f700ef287041635d80486874969d
Python
21,980
641
import torch import torch.nn as nn import h5py import numpy as np import torch.utils.data.dataset import torch.optim as optim import torchvision.transforms as transforms import torch.nn.functional as F import matplotlib.pyplot as plt import cls_cvt import time n_epochs = 200 log_interval = 10 batch_size_...
60fcdeef1ff7cdfad9769b2cc0c6c12d67ed7d073e712b0127344b777ee3f39e
Python
21,981
641
import torch import torch.nn as nn import h5py import numpy as np import torch.utils.data.dataset import torch.optim as optim import torchvision.transforms as transforms import torch.nn.functional as F import matplotlib.pyplot as plt import cls_cvt import time n_epochs = 200 log_interval = 10 batch_size_...
476c01c2eef9d454f02fe6aa28b176f3cfa1d70c87504518ad47afe86f6eb02c
Python
21,982
571
""" Manager and Serializer for Library Folders. """ import logging from dataclasses import dataclass from typing import ( Optional, TYPE_CHECKING, Union, ) from sqlalchemy import ( and_, exists, false, func, not_, or_, select, ) from sqlalchemy.exc import ( MultipleResultsF...
31b8b982bbd1b81089fbd1f7a8fe430679862d49ca83131c63b0080ed53dc9d2
Python
21,984
670
"""Laplacian matrix of graphs. All calculations here are done using the out-degree. For Laplacians using in-degree, use `G.reverse(copy=False)` instead of `G` and take the transpose. The `laplacian_matrix` function provides an unnormalized matrix, while `normalized_laplacian_matrix`, `directed_laplacian_matrix`, and ...
a986402afff7a577d5b1d3a17aa1458b73e3945a0786e7add07bde19df0b69b5
Python
21,995
757
import codecs import io import math from ast import literal_eval from contextlib import contextmanager from textwrap import dedent import pytest import networkx as nx from networkx.readwrite.gml import literal_destringizer, literal_stringizer class TestGraph: @classmethod def setup_class(cls): cls.s...
55b7e9613c6aa1a058efb5a2708771fe36253140fb1031472270d0d76018179c
Python
22,002
459
from oct import * import colorcet as cc import matplotlib cp, np, convolve, gpuAvailable, freeMemory, e = checkForCupy() class Colormap: """Generate an rgb frame from a greyscale using a chosen colormap""" def __init__(self, cmapLabel='hsv'): self.cmap = matplotlib.cm.get_cmap('hsv') self.cm...
cfe0730de3d4245a097030f508fdca797237f175c1f9e971fa982e22dd5761f8
Python
22,006
641
import torch import torch.nn as nn import h5py import numpy as np import torch.utils.data.dataset import torch.optim as optim import torchvision.transforms as transforms import torch.nn.functional as F import matplotlib.pyplot as plt import cls_cvt import time n_epochs = 200 log_interval = 10 batch_size_...
79b681b8815274ee4ba26b51d9e773834c8b29d2d49bcbae619de343ae5912ad
Python
22,008
641
import torch import torch.nn as nn import h5py import numpy as np import torch.utils.data.dataset import torch.optim as optim import torchvision.transforms as transforms import torch.nn.functional as F import matplotlib.pyplot as plt import cls_cvt import time n_epochs = 200 log_interval = 10 batch_size_...
6c35dd45497759ed71cb55ddee842851fdb06939014ea10d13e3d82d540b08d9
Python
22,010
657
# test_core.py # Contact: Jacob Schreiber <jmschreiber91@gmail.com> import numpy import pytest from modiscolite.core import TrackSet from modiscolite.core import Seqlet from modiscolite.core import SeqletSet from .synthetic import random_one_hot from .synthetic import random_track_set from .synthetic import two_moti...
c094858d3ede9672b9712e80bd0b4ed75ce9fc2e74defee432a6442f66777d73
Python
22,023
549
import os, sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from bsb.core import Scaffold, from_hdf5 from bsb.config import JSONConfig from bsb.simulators.nest import NestCell from bsb.models import Layer, CellType from bsb.exceptions import * from mpi4py.MPI import COMM_WORLD as mpi import unitte...
01b61950f62c0701d924e10f3502fde83254f83865926fe2f69c930b3c6d0b42
Python
22,028
524
"""Inquire participant's decisions from descriptions. Based on a data file collected in the active SP condition, provide gambles from descriptions. Notes ----- When we display the description task according to *experienced* data, it might happen that during the experienced condition (i) a distribution was not sampled...
76c3c2bf7041282bb875f60c205341971c54fcaa91e2c8820edc737f9e08636b
Python
22,035
399
from __future__ import annotations import contextlib import dask.array as da import matplotlib.pyplot as plt import numpy as np import pytest import spatialdata as sd import spatialdata_plot as sdp import xarray as xr from spatialdata.models import Image2DModel, Labels2DModel from spatialdata.transformations import S...
1e95668a57814b2a846c5c10c3c81d64b541106b75b280da002dc5887a35497a
Python
22,036
641
import torch import torch.nn as nn import h5py import numpy as np import torch.utils.data.dataset import torch.optim as optim import torchvision.transforms as transforms import torch.nn.functional as F import matplotlib.pyplot as plt import cls_cvt import time n_epochs = 200 log_interval = 10 batch_size_...
f34255b2cde8c06ead02f4cf51277a2d79d9ba9027a23f1565e2833172b9dfae
Python
22,036
619
import matplotlib.pyplot as plt 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 # change the default font family plt.rcParams.update({'font.family':'Arial'}) plt.rc('xtick', labelsize=12) plt.rc('ytick',...
745cd389fa9e567a34db24de2d89135fcb0d99ecc65fd45b7c945ca254a1ec14
Python
22,053
538
#!/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 copy import deepcopy from math import sqrt import numpy as np from ax.adapter.base import DataLo...
d14ad379330ca1d4242665c8af62b572d78d95b13d0d54ebd8ee46981b406267
Python
22,055
493
""" Create a density field for each mtype listed in `app/data/mtypes/density_profiles/mapping.tsv`. This input file can be replaced by user's custom file of the same format. Volumetric density nrrd files are created for each mtype listed in either `mapping.tsv`. This module re-uses the overall excitatory and inhibito...