sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
edb1e0a99bbe9a3ae868bfe57631981988fc92b00971762d06c681b2ed973d85 | Python | 15,978 | 460 | # -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# cell_metadata_filter: -all
# custom_cell_magics: kql
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.2
# kernelspec:
# display_name: .venv
# language: py... |
ad3b0ebf552fb250dec50bee59e683bc232cdcac92b5e74dc7702ac2b994d10a | Python | 15,985 | 495 | """
Some code are adapted from https://github.com/liyaguang/DCRNN
and https://github.com/xlwang233/pytorch-DCRNN, which are
licensed under the MIT License.
"""
from contextlib import contextmanager
from sklearn.metrics import precision_recall_curve, accuracy_score, roc_auc_score
from sklearn.metrics import f1_score, r... |
eca12c86d9ac32561c051cec7c3a6422a366cf2be32feb9e18d8c0ed2e1cf612 | Python | 15,989 | 412 | from __future__ import annotations
import abc
import typing
from functools import cache
from itertools import chain
import numpy as np
from opentelemetry import trace as _otel_trace
from .. import config
from .._util import ichain, obj_str_insert
from ..config import refs, types
from ..exceptions import Connectivity... |
18eaef1d12a97a702c378f01232a6f1a2c9c36472a3ba64933858484fe83b1f8 | Python | 16,008 | 501 | # test_report.py
# Contact: Jacob Schreiber <jmschreiber91@gmail.com>
import os
import shutil
import struct
from html.parser import HTMLParser
import numpy
import pandas
import pytest
from modiscolite.report import compute_per_position_ic
from modiscolite.report import write_meme_file
from modiscolite.report import... |
a3bbde990abe760ac6c26db78dc8a0bdae1cbfe796a1c7bb46396c194cfc9f9b | Python | 16,038 | 420 | #!/usr/bin/env python
#
# Copyright (c) 2014 10X Genomics, Inc. All rights reserved.
#
# Utilities for manipulating fasta and fastq files
#
import glob
import gzip
import numpy
import os
import re
import sys
from tenkit.constants import ILLUMINA_QUAL_OFFSET, BCL_PROCESSOR_FASTQ_MODE, ILMN_BCL2FASTQ_FASTQ_MODE
# Pars... |
35d33c87193271f13ef94c6d1e68c415a4359871dc8f008b4cf0408fdab797d8 | Python | 16,043 | 428 | # 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... |
864c0f1215c43b74a6b33246ec913ff3ef13a932ddb1e59b589567384ed700ca | Python | 16,044 | 424 | from __future__ import print_function, unicode_literals, absolute_import, division
import numpy as np
import warnings
import os
import datetime
from tqdm import tqdm
from zipfile import ZipFile, ZIP_DEFLATED
from scipy.ndimage.morphology import distance_transform_edt, binary_fill_holes
from scipy.ndimage.measurements ... |
68ed4cd376382a48171f8e44931932cb71c006245a8de83b8d1330fcd0856db4 | Python | 16,053 | 540 | # -*- coding: utf-8 -*-
"""
ParameterItems
==============
Provides *ClearMap* specific parameter items for use with pyqtgraph.
"""
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE)'
__copyright__ = 'Copyright © 2020 by Christoph Kirst'... |
c34d8211ae7cc52c1e2c26c039e6e0a755d9a0238a37b1bfa8007c2031e18137 | Python | 16,053 | 337 | # 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... |
eaf040d106f092f06dbfa8cd569161e9d5de371b9fb18a580a605a21d4126d01 | Python | 16,053 | 347 | import torch.nn as nn
from models.utils import modules
#-----------------------------------------------------------------------------------------------------------#
#####################
### ResNet-blocks ###
#####################
class BasicBlock(nn.Module):
'''Standard building block for ResNets.'''
expan... |
c0413b2a9ef535163fc089a0a9ddf72d71760b619f70151eaf08e2903c35bab4 | Python | 16,054 | 392 | """Galaxy Quotas"""
import logging
from typing import Optional
from sqlalchemy import select
from sqlalchemy.sql import text
import galaxy.util
from galaxy.objectstore import is_user_object_store
log = logging.getLogger(__name__)
class QuotaAgent: # metaclass=abc.ABCMeta
"""Abstraction around querying Galaxy... |
522e910af60837968e89a1de2cf704068654736e5c387eaa9947721bb2d933ac | Python | 16,057 | 372 | """Client for staging inputs for Galaxy Tools and Workflows.
Implement as a connector to serve a bridge between galactic_job_json
utility and a Galaxy API library.
"""
import abc
import json
import logging
import os
from typing import (
Any,
BinaryIO,
Callable,
Dict,
List,
Optional,
Tuple,... |
502afac7de70fa4096810a6b483714a59a94a98f5f220792867e88b3eb6745dc | Python | 16,063 | 345 | import os
import numpy as np
import sys
sys.path.insert(1, "../..")
from learnMSA.util.aligned_dataset import AlignedDataset
import learnMSA.protein_language_models.common as common
import pandas as pd
import tensorflow as tf
PFAM_PATH = "../../../../PFAM"
#preprocessing
def get_family(filepath):
return ".".j... |
797085d09fd696e2fd9de70a657d9f1267464720f3deeafb63c0f45bffdb5e94 | Python | 16,077 | 496 | """Tests for backing using the `.file` and `.isbacked` attributes."""
from __future__ import annotations
from typing import TYPE_CHECKING
import joblib
import numpy as np
import pytest
from scipy import sparse
import anndata as ad
from anndata.abc import CSCDataset, CSRDataset
from anndata.compat import CSArray, CS... |
2e609efe968b49e8f1a7c9740d7e5c2abdd95c8cdaa48d2e498e7252752fffcd | Python | 16,078 | 345 | """
Parallelization library for trial-based simulations
===================================================
.. module:: lib_parallel
:platform: Linux
:synopsis: module for handling parallel computation of simulations
.. moduleauthor:: Jose M. Esnaola-Acebes <josemesnaola@gmail.com>
This library contains a para... |
eece201e077ab499fd830654a4d10cdd5394be008df70d4bab742ed087f08d9e | Python | 16,079 | 252 | from torch import nn
import numpy as np
import models.conv.layers as conv_layers
from models.utils import modules
class ConvLayers(nn.Module):
'''Convolutional feature extractor model for (natural) images. Possible to return (pre)activations of each layer.
Also possible to supply a [skip_first]- or [skip_last... |
dd7c8ce953bec376d43d8c7a66ffc3ee3034e72cea570ece65af20844ec9fc9e | Python | 16,092 | 450 | # 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... |
9d4a501380a6acba770417d43b2ef49eff429b970c25fdc624a1b47bccb2837a | Python | 16,095 | 481 | # 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 abc import ABC, abstractmethod
from collections.abc import Sequence
from datetime im... |
48bf8123a1a549edcbc1716c66327721622f5b052add29cae8c63d216dfb2202 | Python | 16,099 | 486 | """
This module imports all supported storage engines, objects that read and write data, which
are present as subfolders of the `engine` folder, and provides them transparently to the
user, as a part of the :class:`Storage <.storage.Storage>` factory class. The module scans
the :mod:`.storage.interfaces` module for any... |
60d51425ec5bebeac32b854714b5219d15e859f63d8a4593ee57e10dc1bbab2f | Python | 16,107 | 519 | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 19 11:42:52 2015
Test Transformation with Elastix - Points vs Data
Notes:
- Elastix provides transform T: fixed -> moving
- for alignment use fixed = data and moving = atlas / reference
- result.mdh in elastix directory is T^(-1) moving, i.e. has size of fixed image
- r... |
8cd6c8695c31f78821e2272a97e0954bdec890fbd0cb220b611f93f7da516a08 | Python | 16,114 | 493 | from __future__ import annotations
import itertools
from collections.abc import Callable, Mapping, Sequence
from pathlib import Path
from types import MappingProxyType
from typing import Any
from anndata import AnnData
from matplotlib.axes import Axes
from matplotlib.colors import Colormap
from matplotlib.figure impo... |
a150513957d465c634d408a5e105d27cdcbe9d6d435bdac59a9eb2cc2308a420 | Python | 16,132 | 414 | """Benchmark fused IF/LIF-Linear against unfused dense paths."""
import argparse
import hashlib
import json
import os
import socket
import statistics
import subprocess
from datetime import datetime, timezone
from pathlib import Path
import torch
import torch.nn.functional as F
from spikingjelly.activation_based impo... |
5e692169cbb2c3d083be205364f947ea7983f8969b4a4d1a3dc5661a0a782de6 | Python | 16,143 | 502 | """Functions to convert NetworkX graphs to and from other formats.
The preferred way of converting data to a NetworkX graph is through the
graph constructor. The constructor calls the to_networkx_graph() function
which attempts to guess the input type and convert it automatically.
Examples
--------
Create a graph wi... |
d6775ee8fd2be86bc18ea271f5a595282ffd93c50cc9f653f0476ea62bf06d1f | Python | 16,152 | 441 | """
Design
Step 1: Load in prototype, identify all needed lines
Step 2: Load in paths for all image files, exclude/include as needed
Step 3: Run through all required image files, construct the file changes
Step 3a: Change prototype and spit out into fsf output folder
Step 4: Launch a feat job for each fsf
"""
import ... |
36acaa627757d69a955364443b59c636bb0e91a1f1de39a1a729561f1a665d53 | Python | 16,154 | 384 | import tensorflow as tf
from src.models.cs_model import CompressedSensingNet, CompressedSensingCVNet, CompressedSensingInceptionNet
from src.models.wavelet_model import WaveletAI
from unittest import skip
from tests.test import BaseTest
import copy
import tensorflow_probability as tfp
import numpy as np
tfd = tfp.distr... |
a32cf36d3a7fff117ab2d5940787520f78d51a63f36d2098d4a188bda3494ac8 | Python | 16,156 | 433 | import abc
import itertools
import typing
import numpy as np
from bsb import CellType
from . import config
from .config import refs
from .exceptions import (
ConnectivityError,
DatasetNotFoundError,
MorphologyDataError,
MorphologyError,
)
from .reporting import report
from .rng import RngConsumer
if... |
ed7f5b5a12d380f51524c30fe58f8a9161a2d406119098e5f952370c1ebf0386 | Python | 16,159 | 524 | # -*- coding: utf-8 -*-
"""
Create some statistics to test significant changes
in voxelized and labeled data
TODO: cleanup / make generic
"""
#:copyright: Copyright 2015 by Christoph Kirst, The Rockefeller University, New York City
#:license: GNU, see LICENSE.txt for details.
import sys
self = sys.modules[__name__];... |
567bcf2e4c63184c1ff2dbc691d472e1a32728df4884e592ea8bd91538be030d | Python | 16,166 | 490 | #!/usr/bin/env python
from __future__ import division
import argparse
from collections import defaultdict
import cairo,random
import os,sys,collections,re,multiprocessing
# ~ ,commands,shutil
from argparse import ArgumentParser
from math import pi as p
#import pyBigWig
from tqdm import tqdm
def hex2rgb(hexstring, digi... |
1d6d1d8e7f33b4a20a49a1a3549133f8b8ae5bf1a01412a844e8d49b7f08f0bb | Python | 16,172 | 404 | import random
import time
import numpy as np
import scipy.sparse as sp
import torch
import torch.nn.functional as F
from tqdm.auto import tqdm
from ..base import InjectionAttack, EarlyStop
from cogdl.utils.grb_utils import eval_acc, feat_preprocess, adj_preprocess, getGraph, getGRBGraph
class SPEIT(InjectionAttack)... |
5df46df5ea157f5420cf625dc4b204785638582b7395e54cf901b4a3bc900847 | Python | 16,175 | 308 | import tensorflow as tf
import numpy as np
import os
from data_reload import *
# REGULARIZER = 0.01
BATCH_SIZE = 10
def compute_accuracy(v_xs, v_ys):
global prediction
y_pre = sess.run(prediction, feed_dict={xs: v_xs, keep_prob: 1})
correct_prediction = tf.equal(tf.argmax(y_pre, 1), tf.argmax(v_ys, 1))
... |
c71146a808611be9b72fff2adc57d315de5b6ba4e1a228273fc5b12561305ef1 | Python | 16,180 | 434 | """
Highest-label preflow-push algorithm for maximum flow problems.
"""
from collections import deque
from itertools import islice
import networkx as nx
from ...utils import arbitrary_element
from .utils import (
CurrentEdge,
GlobalRelabelThreshold,
Level,
build_residual_network,
detect_unbounded... |
e1412bb8c3a31bf8502088b3af2e17c310fb4565202a9ff6f699ebd8f97b7eae | Python | 16,184 | 376 | """
Plot Figure 4
"""
import numpy as np
import strinf as si
# # # PARAMETERS # # #
ZOOM = 1.5
SAVE = True
SHOW = True
PANEL = ("E", "F", "G", "H", "I", "J", "K", "L",) # The sketches in A, B, C, D, are always plotted.
motion_repulsion = {
# By angle
"angle_model" : "./data/analysis_2021-08-19-12-14-27-1... |
e715c9d80a6f6b06d92b7137a2037b67a0391cf6b6104f60b6ec9d0314af8855 | Python | 16,194 | 395 | #!/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
import copy
from collections import OrderedDict
from collections.a... |
6cc2561f04a2c35f6fa8255688943d664b4f50120e8ac03465922dc7860e11a0 | Python | 16,198 | 481 | """
Mock infrastructure for testing ModelManagers.
"""
import os
import shutil
import tempfile
from collections.abc import (
Callable,
Hashable,
)
from typing import (
Any,
cast,
Optional,
)
import mako
from galaxy import (
di,
quota,
)
from galaxy.app import UniverseApplication
from gala... |
504023e8da651bc9903d6eb8152e86aaa6391025277c2ebdd1f9def6a090e02a | Python | 16,206 | 384 | """Job control via the Condor DRM via CLI.
This plugin has been used in production and isn't unstable but shouldn't be taken as an
example of how to write Galaxy job runners that interface with a DRM using command-line
invocations. When writing new job runners that leverage command-line calls for submitting
and checki... |
a8ddeb4555539ddbc3eb56c861686e7991a5e2ac0166de7ebf722ad77ef0d577 | Python | 16,227 | 425 | import typing
from ...datalog import DatalogProgram
from ...datalog.basic_representation import UnionOfConjunctiveQueries
from ...datalog.negation import DatalogProgramNegationMixin
from nl_expr.exceptions import (
ForbiddenDisjunctionError,
ForbiddenExpressionError,
)
from nl_expr.expression_pattern_matching ... |
90d50ca97d4c4ee99d493a28171a72c7d944d1268b03ceb237f7446b3ecc0be9 | Python | 16,229 | 482 | """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 pytest
from data_import.models import FileUpload
from django.conf import settings
from django.core.files.base import ContentFil... |
4269b521c582c48588784fd741601d01c2b1aa5844ddf197eb402e60567856b2 | Python | 16,256 | 464 | from collections import defaultdict
import networkx as nx
__all__ = ["combinatorial_embedding_to_pos"]
def combinatorial_embedding_to_pos(embedding, fully_triangulate=False):
"""Assigns every node a (x, y) position based on the given embedding
The algorithm iteratively inserts nodes of the input graph in a... |
89c406ebe3c483dd51c51013862d42b88b0e28df455639894dff111f69d16256 | Python | 16,259 | 476 | #!/usr/bin/env python
#
# Copyright (c) 2015 10X Genomics, Inc. All rights reserved.
#
import h5py
import hashlib
from HTMLParser import HTMLParser
import json
import numpy as np
import os
import pandas as pd
import errno
import shutil
import six
import subprocess
import sys
import tables
import gzip
import lz4.frame a... |
26638721b21f5a11b186c64ca60f92e085772cfe38552a4503fd29453f49d4b6 | Python | 16,274 | 461 | """Script to train a model that predicts disc size for image of optic nerve head."""
import numpy as np
import pandas as pd
import tensorflow as tf
from tools.data.disc_size_pipeline import DiscSizeDSBuilder
from tools.metrics import (gen_confusion_matrix, get_accuracy_scores,
get_auc_scores... |
d11029adc481376d7f1b4d1e4aee2b0c86ee780fb143c89b1a5776f5c52c09c4 | Python | 16,276 | 437 | #!/usr/bin/env python
# Copyright 2020 The HuggingFace Team. 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... |
d5a5b52f0ed3144f82bdc56a202bb79f4432a738155f298499bf4710ada3a3bc | Python | 16,281 | 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
import functools
import warnings
from collections.abc import Callable, Mapping, Sequence
import numpy... |
a142524be421bc89e169df402425c20a4d31ececc0725205f518c1499ea0079f | Python | 16,291 | 476 | """Original NetworkX graph tests"""
import pytest
import networkx as nx
from networkx import convert_node_labels_to_integers as cnlti
from networkx.utils import edges_equal, nodes_equal
class HistoricalTests:
@classmethod
def setup_class(cls):
cls.null = nx.null_graph()
cls.P1 = cnlti(nx.pat... |
464316d184ddc12aca0b4b27efd6c77460a3d16f97f91a5ca2d98b052b975f87 | Python | 16,298 | 280 | import numpy as np
import common
class Slowwave:
"""
The basic model generating slow waves.
"""
def __init__(self, epoch_length, epoch_number, pre_w_initial, plasticity_option=True, plot_option=True, connect_prob_ee=0.05, connect_prob_ie=0.3):
self.params = common.ConstantsAndFunctions()
... |
d7bd7df8429aad6b39f83d573f0c8fa0928ccc9ccc0811485fecc1b8dc96fb00 | Python | 16,303 | 372 | import numpy as np
import pytest
import tensorflow as tf
from packaging.version import parse as version
from tf_keras_vis import keras
from tf_keras_vis.gradcam import Gradcam
from tf_keras_vis.gradcam_plus_plus import GradcamPlusPlus
from tf_keras_vis.layercam import Layercam
from tf_keras_vis.saliency import Salienc... |
7c825a689743634a290fcdb1819cf85ea7bc7690647f771b9573cf5da6826108 | Python | 16,310 | 414 | """Verify metabolite and reaction cross-references against chemical structure.
MetaNetX (MNXref) is the hub. chem_prop maps a structure (InChIKey) to an MNXM and
chem_xref maps that MNXM to every other database's identifier; reac_prop / reac_xref
do the same for reactions, matched by their participant-structure signat... |
b837336ba3c3f6a6efc153d45f530165ba2941dac010a364e83a42164734dad5 | Python | 16,315 | 505 | """
Equitable coloring of graphs with bounded degree.
"""
from collections import defaultdict
import networkx as nx
__all__ = ["equitable_color"]
@nx._dispatchable
def is_coloring(G, coloring):
"""Determine if the coloring is a valid coloring for the graph G."""
# Verify that the coloring is valid.
ret... |
d2bf0ccd39496d3838f907f6e65a543bfe89e22511e08318b8c23c8db12c4288 | Python | 16,327 | 502 | # 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... |
ac6562c56d0e1f81c94890787759485da7410c5c91cef8fb4c02b81da5ed00a9 | Python | 16,334 | 512 | """Calculate RSA timecourse.
- create model RDMs
- For each subj and stream:
- load rdm_times array
- for each timepoint
- correlate ERP-RDM with model RDMs
- plot means over subjs for each stream
- check which timewindow is has high correlation
- plot mean ERP-RDMs for each stream over subjs and selec... |
af24ca7a00a8622c576c0a8e9f7988b7dbd231be7aeba0effa97cc917123a141 | Python | 16,342 | 459 | from collections import UserDict
import pytest
import networkx as nx
from networkx.utils import edges_equal
from .test_multigraph import BaseMultiGraphTester
from .test_multigraph import TestEdgeSubgraph as _TestMultiGraphEdgeSubgraph
from .test_multigraph import TestMultiGraph as _TestMultiGraph
class BaseMultiDi... |
6c39884b9756ad3d6cec2aef7b6b592535ef798f86d83215e05dca07cfbb36c2 | Python | 16,343 | 367 | import unittest, os, sys, numpy as np, h5py
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import bsb.output, test_setup
from bsb.morphologies import Morphology, Branch
from bsb.exceptions import *
class TestRepositories(unittest.TestCase):
def test_empty_repository(self):
pass
class... |
e916d9d51d4c428a9a4938d0e33465f64d6e4a275d9af9fadb7bd30110f4b1a8 | Python | 16,353 | 278 | """09_mre_cohort_corr.py - cohort E-field vs MRE-stiffness correlation.
Olsson et al. 2025 already published the MRE-to-microstructure relationships (MD/uFA/FA vs stiffness) on
this exact cohort, so re-deriving them adds no new science. The question here is whether the tDCS E-field,
and the MD-dMRI-vs-DTI conductivity... |
6eeca0a661cdefeb63506440993f81195567500e066f1320253179a67c2d4948 | Python | 16,357 | 766 | # -*- coding: utf-8 -*-
"""ISO 3166-1 alpha-2 -> one readable English country name (249 entries), plus each one's continent and numeric code.
The single list of country names for the use-case pages: the Google Sheet's COUNTRIES
dropdown should use exactly these names, and usecase_map_stats.country_iso() accepts every
... |
61f3fcf0a2d3859c8e36d6c799d3febb747ee184cce7ad29b55f93b1ae791a21 | Python | 16,367 | 429 | import numpy as np
from sklearn.metrics import pairwise_distances
from scipy.spatial.distance import cdist
from ._hdbscan_linkage import mst_linkage_core
from numpy import isclose
def all_points_core_distance(distance_matrix, d=2.0):
"""
Compute the all-points-core-distance for all the points of a cluster.
... |
1dd6c1b434f994fe3ded20f53b1497c3dffb530e8b7e02b44022fc05d8bbc20b | Python | 16,398 | 350 | import itertools
import os
import pathlib
import tempfile
import time
from zipfile import ZipFile
from pathlib import Path
import numpy as np
import pytest
import tifffile
from alpineer import image_utils, test_utils, io_utils
from pytest_mock import MockerFixture
from skimage import io
from unittest.mock import call,... |
22182230509955f8f7b9b29ab5f886110d97ad92a963d33f4d96dfdd3c0a0b24 | Python | 16,423 | 331 | import math
from typing import Callable, Optional, Tuple
import torch
from .._ops.first_spike import _newton_finish, _newton_proposal
__all__ = ["first_spike_time"]
_Response = Callable[..., Tuple[torch.Tensor, torch.Tensor]]
def _evaluate(response, time, piece, parameters, *, check_finite=True):
result = res... |
4df38486b772f33279589414b69bcd0b33c4dd0e5da73f5107a33286dc7dcf81 | Python | 16,424 | 461 | # core.py
# Authors: Jacob Schreiber <jmschreiber91@gmail.com>
# adapted from code written by Avanti Shrikumar
import pickle
import numpy as np
import scipy.sparse
from . import affinitymat
from . import cluster
from . import util
from collections import OrderedDict
class TrackSet(object):
def __init__(self, one... |
02a544b981a2a1eef274f8139fd8d8b9e23f824dbfd3956b38ddd98321c69828 | Python | 16,429 | 473 | 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... |
9564ba3052e0b15f93587f1c9e710aa67c1bcce7da02485a2266a9d21a0a3764 | Python | 16,431 | 516 | """Behaviour analyses"""
import os
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
import pingouin as pg
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import seaborn as sns
from surfplot import Plot
import cmasher as cmr
from adaptman.config import Config
from adaptman.uti... |
6bbd1b4a5cdd00db97e4290bda14c02e0b2ea7b531aaf4c16cb5c6efb28d08ef | Python | 16,440 | 497 | __all__ = [
'stats_to_str',
'features_rename_dict',
'strain_rename_dict',
'rename_features',
'get_pairs_longitudinal',
'linear_detrending',
'medmad',
'calc_delta',
]
import itertools
from typing import Union, Optional
import numpy as np
import scipy.stats
import sklearn
def stats_to_... |
38bba4671f04152ca315b4f9d77c0c931697f2244d8b42144198fc083aee8932 | Python | 16,442 | 381 | from itertools import filterfalse
from oct.utils import *
from oct.utils.angioUtils import *
from ..load.metadata import Metadata
import logging
cp, np, convolve, gpuAvailable, freeMemory, e = checkForCupy()
class Angiography:
""" Angiography contrast OCT reconstruction"""
def __init__(self, mode='cdv'):
... |
f752a4ff64064b006939c85c6e0bacd7d26d84284b72164e9fad8c548ddedd56 | Python | 16,446 | 466 | """Floyd-Warshall algorithm for shortest paths."""
from collections import defaultdict
import networkx as nx
from networkx.algorithms.shortest_paths.weighted import _weight_function
__all__ = [
"floyd_warshall",
"floyd_warshall_predecessor_and_distance",
"reconstruct_path",
"floyd_warshall_numpy",
... |
01ea9904dee9d12ca06834401e7cb8f340e427596696c06b873076f2f0d66da7 | Python | 16,448 | 506 | import tensorflow as tf
from tensorflow import keras
from keras import optimizers
from tensorflow.keras import layers
import numpy as np
np.set_printoptions(precision=5)
import matplotlib.pyplot as plt
import pandas as pd
pd.options.display.float_format = '{:,.5f}'.format
import scipy as sp
from scipy import stats
imp... |
224000279954f18ae9539b63000377821fa6d76bc6646c70d72b75b3850fcfb7 | Python | 16,449 | 452 | """Ontologies loaded into a frontend: the parser's tests are in
``neurolang/datalog/tests/test_ontologies_parser.py``."""
import io
from typing import Callable
from nl_expr.logic import Implication
from nl_expr.expressions import Constant, Symbol
from ...frontend import NeurolangPDL
KNOWLEDGE_GRAPH = """
@prefix pv... |
073a3bef31bbf4bbfff8ecdd23565928efdcd77c2b9c599fbfad05ae40f25c8d | Python | 16,453 | 488 | import itertools as it
import pytest
import networkx as nx
from networkx.algorithms.connectivity import EdgeComponentAuxGraph, bridge_components
from networkx.algorithms.connectivity.edge_kcomponents import general_k_edge_subgraphs
from networkx.utils import pairwise
# ----------------
# Helper functions
# ---------... |
904ce626b0f9764b666122a8304bc812fbb93efa2e659c73646328382432e17f | Python | 16,458 | 498 | # -*- coding: utf-8 -*-
# Imports
import pandas as pd
import numpy as np
from rdkit import Chem
from itertools import product
try:
from mordred import Calculator, descriptors
except:
print('Mordred not installed.')
from .utils import Data, bot
from .chem_utils import name_to_smiles
# Calculate Mordred ... |
13b0caf824bdae6373875472e0d44b6c8186812658ac6a637d34aa7856d9abb2 | Python | 16,464 | 347 | import os
import tensorflow as tf
import learnMSA.legacy.DirichletMixture as dm
from learnMSA.util.sequence_dataset import SequenceDataset
#from learnMSA.protein_language_models.MultivariateNormalPrior import MultivariateNormalPrior, make_pdf_model
from learnMSA.protein_language_models.bilinear_symmetric import make_sc... |
a35a714d72432c3a6b58046af6230da3cb96335135849a2eee6035d133c72e4c | Python | 16,471 | 399 | """
The prompts of the LLM query assistant.
The system prompt tells the model the target language with a short
reference of its syntax, the predicates of the engine and the examples
most similar to the question. The ReAct agent's tools are described
once (:data:`TOOLS`), sent to the provider as native tools or written... |
1c12d978d76289c58fefc03ddadfcd3287417f669e5313d10e4ce82b2666cc19 | Python | 16,483 | 427 | #!/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
import warnings
from collections.abc import Mapping
from functools... |
a1c6e218181d5d84df9e1f516161cdc16ef5601888f260a1df518b5c85df665b | Python | 16,490 | 436 | #!/usr/bin/env python
#
# Copyright (c) 2015 10X Genomics, Inc. All rights reserved.
#
import array
import numpy as np
import scipy.stats as sp_stats
import sys
import cellranger.constants as cr_constants
import tenkit.constants as tk_constants
import tenkit.seq as tk_seq
import tenkit.stats as tk_stats
import collecti... |
5c42ac2da87c973540be789531626cd0c213915f1caae911f38a79153fbce215 | Python | 16,508 | 309 | from uff.ic.mell.sentimentembedding.datasets.dataset import DataSet
from uff.ic.mell.sentimentembedding.classificadores.classificador import ClassificadorWrapper
from uff.ic.mell.sentimentembedding.modelos.modelo import Modelo
from uff.ic.mell.sentimentembedding.modelos.modelo_roberta import *
from uff.ic.mell.sentimen... |
66eeb92ab047864d156394023de50c9de01806306762c407191024724292760b | Python | 16,516 | 445 | """
Ranking of queries, Dalvi & Suciu [1]_, section 4.1.
A query is ranked when there is an order on its bound variables such that
the variables of every atom follow it: its free variables, the answer
variables, are constants, as in Dalvi & Suciu, and need no order. A query
that is not ranked is rewritten into an equi... |
10b2d7621579391a5a884ef2cb207a0b5a3feb021be9a70c5644284b130d61e6 | Python | 16,537 | 428 | """
Copyright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu.
"""
import sys, os, argparse, time
import numpy as np
from glob import glob
import torch
from torch import nn
from tqdm import trange, tqdm
from cellpose import models
from cellpose.io import logger_setup, imread, ... |
bbb5f4b7549602f10c1161e441fbf0edb5c0b7cb6692dbf7c2c64a3b81e0c8d9 | Python | 16,541 | 379 | # 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 unittest.mock import patch
import pandas as pd
from ax.analysis.healthcheck.early_stopping_healthcheck import EarlySto... |
23212b7b92e866b3df1907b3f62b5091f673a9c26147a2891922309b19bd66fb | Python | 16,546 | 435 | import numpy as np
import os
import pickle
import torch
import json
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import math
import utils
from data.data_utils import *
from data.dataloader_detection import load_dataset_detection
from data.dataloader_classification import load_datase... |
2f3a5cfd160ce58a3c27b74126abdc7a7d646c8fdf93f90230f987ea82984dd6 | Python | 16,565 | 455 | import cv2
import time
import os
from datetime import datetime
from matplotlib import pyplot as plt
import matplotlib as mpl
from copy import deepcopy
import numpy as np
from scipy import interpolate
import math
from scipy import stats, cluster, spatial, special
from sklearn.cluster import KMeans
from sklearn import pr... |
7cc7fac316861911cd7ede3d578e3723f2892e887d0479896629ec4e186df496 | Python | 16,565 | 313 | from __future__ import division
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import fanc
import fanc.plotting as kplot
import os.path
import pytest
import numpy as np
import pybedtools as pbt
def abs_ax_aspect(ax):
bbox = ax.get_position()
fig = ax.figure
aspect = (bbox.height*fi... |
7b3153f855c0efb2ee9c2d7fb984016a46d070d563845b37cb385419261444f9 | Python | 16,578 | 430 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 5 11:24:49 2020
@author: amelie
"""
from brian2 import *
from scipy import signal
from cells.RS_FEF import *
from cells.FS_FEF import *
from cells.SI_FEF import *
from cells.VIP_FEF import *
from FEF_visuomotor import *
runtime=3*second
de... |
2f6c49f32fcb5896cbaf6cc8c3a7aac15314a2464f3bc4ec7963fffc897613e7 | Python | 16,584 | 446 | from __future__ import annotations
from collections.abc import Mapping, Sequence
from pathlib import Path
from typing import Any, Literal
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scanpy as sc
from anndata import AnnData
from matplotlib.axes import Axes
from matplotlib.colorbar imp... |
81ed613ee302ff5867c3992644bc40f6426d59eb632cdc0b73eeb4a5ade205d4 | Python | 16,597 | 517 | import tensorflow as tf
from tensorflow import keras
from keras import optimizers
from tensorflow.keras import layers
import numpy as np
np.set_printoptions(precision=5)
import matplotlib.pyplot as plt
import pandas as pd
pd.options.display.float_format = '{:,.5f}'.format
import scipy as sp
from scipy import stats
imp... |
bf5ea7f567b72576909c9895045a86a401644a29c593fa5ff7c02797c3b46d34 | Python | 16,632 | 381 | #!/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... |
358a91276bae12e270aff34d2f3587d26fecfd8b286c31506fa1eac6e43649ec | Python | 16,638 | 417 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013-2015 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
from io import BytesIO
import logging
import os
import re
import struct
import sys
from .compat import sysconfig, detect_encoding, ZipFi... |
8383531d50ad2e91387f4f993057fcbb7a7af28ac8aec46d49e7b30cd490fe50 | Python | 16,672 | 524 | from __future__ import annotations
import bz2
import gzip
from collections import OrderedDict
from importlib.metadata import version
from os import PathLike, fspath
from pathlib import Path
from types import MappingProxyType
from typing import TYPE_CHECKING
import h5py
import numpy as np
import pandas as pd
from pack... |
7cb74a0c244ce4c4817d679209a2d1594eef19d952a2e43cf24bcab4d8e648d0 | Python | 16,680 | 560 | # test_cli.py
# Contact: Jacob Schreiber <jmschreiber91@gmail.com>
import os
import h5py
import numpy
import pytest
from click.testing import CliRunner
from modiscolite.cli import cli
from modiscolite.cli import _split_chroms
from modiscolite.io import save_hdf5
from modiscolite.util import MemeDataType
from meme... |
787d2e042e1ea029d9ffba6eb840594f38fbf9c8ebc54acd7c6b51032ff07b16 | Python | 16,682 | 462 | import math
import logging
from random import random, randint, choice
import numpy as np
from scipy.spatial import KDTree
from skimage.transform import integral_image, integrate
from gunpowder.batch_request import BatchRequest
from gunpowder.coordinate import Coordinate
from gunpowder.points import Points
from gunpowd... |
1814d889023ccd51f1a9038fd38e5a2e7bdc091452dd3987ffea74138dd4ba98 | Python | 16,686 | 419 | """
Page assistant agent for Galaxy History Pages.
Reads history contents via tools, proposes markdown edits with structured output
(FullReplacementEdit or SectionPatchEdit), and supports conversational responses.
"""
import logging
from pathlib import Path
from typing import (
Any,
Literal,
Optional,
)
... |
3b605011f9e11b66e98500180ddd78960f4b5eb0dc3865a03e6c5394c545fa67 | Python | 16,690 | 431 | #!/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 ax.adapter.base import DataLoaderConfig
from ax.adapter.data_utils imp... |
05ebd9878aa4d74336d90f9e5ea9469a9a56191a925728275a8d6f2113f376f1 | Python | 16,694 | 386 | '''
The script to train PIGNPI with noisy input
'''
import os
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import numpy as np
import torch
torch.set_num_threads(1)
from torch.autograd import Variable
from matplotlib import pyplot as plt
import pickle as pkl
from torch.optim im... |
bfd2df289cc1286ec9fc30412fcc22296d8dce3539abd1873130360b88aca5ad | Python | 16,710 | 500 | __all__ = [
'stats_to_str',
'features_rename_dict',
'strain_rename_dict',
'rename_features',
'get_pairs_longitudinal',
'linear_detrending',
'medmad',
'calc_delta',
]
import itertools
from typing import Union, Optional
import numpy as np
import scipy.stats
import sklearn
def stats_to_... |
97649e992e59fca601d0f43bcb6135d98976f3eadf7a07264916eabc496c4292 | Python | 16,740 | 413 | """Prepares a distribution for installation
"""
import logging
import os
from pip._vendor import pkg_resources, requests
from pip._internal.build_env import BuildEnvironment
from pip._internal.download import (
is_dir_url, is_file_url, is_vcs_url, unpack_url, url_to_path,
)
from pip._internal.exceptions import (... |
b89944045accfd1300d2e5e6544f196aff915eebb474e61fa6b17fe365acc86b | Python | 16,744 | 485 | import numpy as np
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
from nilearn.input_data import NiftiSpheresMasker
from nilearn.input_data import NiftiLabelsMasker
from nilearn.input_data import NiftiMapsMasker
from nilearn.image impo... |
ca4bdddaade60432007de4fbcd88b5cbb31f561c271565ebe1f2939ca54a0236 | Python | 16,746 | 485 | import numpy as np
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
from nilearn.input_data import NiftiSpheresMasker
from nilearn.input_data import NiftiLabelsMasker
from nilearn.input_data import NiftiMapsMasker
from nilearn.image impo... |
d37d6b2a17c5a5f6769a42cbeb5b91790ede675a4097322207384bc6fd07bb24 | Python | 16,749 | 442 | #!/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 random
import time
from dataclasses import dataclass
from logging import Logger
from ax.core.t... |
b39765ef85db6e6bc2cb57a275e998c80ca73999f04da30197c728dfa8c86e18 | Python | 16,757 | 525 | """
Tests for VF2 isomorphism algorithm.
"""
import importlib.resources
import random
import struct
import pytest
import networkx as nx
from networkx.algorithms import isomorphism as iso
class TestWikipediaExample:
# Source: https://en.wikipedia.org/wiki/Graph_isomorphism
# Nodes 'a', 'b', 'c' and 'd' for... |
68a1e08d581223444e23d72c73e779d28e5dddfb6dfe6a5d1a8b21ac55b264c1 | Python | 16,768 | 373 | import torch
from .. import functional, surrogate
from .lif import LIFNode
__all__ = ["ILIFNode"]
class ILIFNode(LIFNode):
def __init__(
self,
tau: float = 4.0 / 3.0,
v_threshold: float = 1.0,
surrogate_function: surrogate.MultiLevelSpikeCount = surrogate.MultiLevelSpikeCount(
... |
fa9b8d95a1ce5cf2f7623f8cb2620566c732a606556d68139141e37bb35cd8c8 | Python | 16,773 | 401 | # Flat versions of objective functions described in Tiago P. Peixoto
# Nonparametric Bayesian inference of the microcanonical stochastic block model
# for more see in peixotos_hierarchical_sbm.py
# with usage of scipy and only non log version
# @formatter:off
import math
from scipy.special import binom
from .peixoto... |
bb06b6a5fe1ba99c09fc5dc54a088add41b9bc82f5f5ecd108fda5c478c94b75 | Python | 16,775 | 456 | from collections import defaultdict
from functools import partial
from typing import Any, Callable
import torch
import torch.nn as nn
from .base import BaseCounter
aten = torch.ops.aten
__all__ = ["MemoryAccessCounter"]
def _bytes(x: torch.Tensor):
return x.element_size() * x.numel() if torch.is_tensor(x) else... |
921d4bdbeddb713b7b68745467ff53b0a2ae7e3c9ed6cc73cd9841073252b085 | Python | 16,784 | 449 | """Custom fsspec filesystem implementation for Aspera ascp transfers.
This module provides an fsspec-compatible filesystem wrapper around the Aspera ascp
command-line tool for high-speed file transfers. It is designed to be extensible
for future enhancements such as ENA-specific handling, retry logic, and fallback mec... |
a6729c302811764ab69b0716ecf55eca98e36770689e8d40559f585a8a85e397 | Python | 16,785 | 335 | # 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... |
d95e13ded1ae8dc02d5775ba59c4d052318001eddbd6baa29ce368c1484bb1af | Python | 16,795 | 529 | """Basic algorithms for depth-first searching the nodes of a graph."""
from collections import defaultdict
import networkx as nx
__all__ = [
"dfs_edges",
"dfs_tree",
"dfs_predecessors",
"dfs_successors",
"dfs_preorder_nodes",
"dfs_postorder_nodes",
"dfs_labeled_edges",
]
@nx._dispatchab... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.