sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
ab726d5acb269fdc820769817648ca66391ac66061906f7f7493b39ae262428b | Python | 5,339 | 168 | """Routines to find the boundary of a set of nodes.
An edge boundary is a set of edges, each of which has exactly one
endpoint in a given set of nodes (or, in the case of directed graphs,
the set of edges whose source node is in the set).
A node boundary of a set *S* of nodes is the set of (out-)neighbors of
nodes in... |
d17ab966539dd8e39e1f028cea11b2eba82730601bca18a8ec3b632c777b0c58 | Python | 5,339 | 155 | from __future__ import absolute_import
import errno
import itertools
import logging
import os.path
import tempfile
from pip._internal.utils.misc import rmtree
logger = logging.getLogger(__name__)
class TempDirectory(object):
"""Helper class that owns and cleans up a temporary directory.
This class can be ... |
a1120afad05ff250bb3bbeba846c390517e16d7ccf6c3b3fbe181cf365026a65 | Python | 5,343 | 163 | """
Completion of SQUALL from its grammar.
The SQUALL parser is an Earley parser, which cannot be fed tokens
interactively, but parsing the current sentence followed by a character
that no terminal accepts fails *at the end* of the sentence with the set
of terminals allowed there (:meth:`SquallGrammarOptions.options`)... |
7f73c7e7503a4357cd5dd90ee703ed85facc452c979f59b5d78a87b57385cdb1 | Python | 5,345 | 185 | # 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... |
bc43e523e6af131250e21b2b6ffa0190cfe20b19b3b7677509b4c269a7c52dc1 | Python | 5,345 | 148 | """Periodic gauge emitter for control-queue depth and worker-process counts.
Scheduled by Celery beat (see ``galaxy.celery.__init__.setup_periodic_tasks``)
at a fixed cadence. Opens a short-lived kombu connection, iterates the control
queues returned by ``all_control_queues_for_declare`` and samples each queue's
messa... |
2f5774f8a296fc3c97475c6018cfc4dc1eee0acceeec5f34e8838f86502e9465 | Python | 5,346 | 102 | import json
import os.path
from dataloaders import DataloaderParameters
from m4depth_network import M4depthAblationParameters
class M4DepthOptions:
def __init__(self, args):
# Global Options
args.add_argument('--dataset',
default="",
choices=['m... |
3e587716afea2e78cfae191eec2315fd1dba13bc523157dafd804c37a9fa88dd | Python | 5,349 | 176 | # test_cluster.py
# Contact: Jacob Schreiber <jmschreiber91@gmail.com>
import numpy
import scipy.linalg
import scipy.sparse
import pytest
import igraph
import leidenalg
from modiscolite.cluster import LeidenCluster
from numpy.testing import assert_raises
from numpy.testing import assert_array_equal
def _block_aff... |
80f72ea743e3bea66bbe47a5ef707173ac2454e30fe20d1a6057ebe6dab51a96 | Python | 5,349 | 177 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 4 09:05:19 2022
@author: townesf
"""
import random
import numpy as np
from pandas import get_dummies
from anndata import AnnData
from scanpy import pp
from utils import misc,preprocess
dtp = "float32"
random.seed(101)
def squares():
A = np.zeros... |
b54f637e98e364aeef65afa17d317f23e588ee09768207a613c2878c15c6bc17 | Python | 5,350 | 154 | """
==============================
Scoring Time Series Estimators
==============================
This examples demonstrates some of the caveats / issues when trying to
calculate performance scores for time series estimators.
This pipeline has been designed to evaluate performance using
segments (not series') as insta... |
15e7cf531e66d84fbb83b04f91b056522bcf0b4bf9a9f6b9ebb16400e0763cc9 | Python | 5,351 | 8 | from ..standard_syntax import parse_rules
def test_rules_properties_parsing():
res = parse_rules()
expected = {'argument': {'values': ['<arithmetic_operation>', '...']},
'arguments': {'unit': '<argument>', 'params': 'number', 'sep': ','}, 'arithmetic_operation': {'values': ['<operand>', '<oper... |
b761d78dff091d76eb08465440e88f45524e8c3f8ed0b6ca26413be284312b64 | Python | 5,352 | 141 | """Motion structure classification based on the trials from Yang et al. (2021)"""
import numpy as np
from datetime import datetime
from strinf import WorldVeloFunction, ObservationGeneratorVelo, \
FilterStrinfNaturalParameters, FilterStrinfAdiabaticDiagonalSigma,\
inf_method_MAP_s... |
238c11f085c46c7b8e3fef499319746dd654f057ec8852da74c87a632648cb39 | Python | 5,355 | 141 | import unittest
import numpy as np
import numpy.testing as npt
from sklearn.datasets import make_blobs
from sklearn.metrics import adjusted_rand_score
from divik.cluster import (
DiviK,
DunnSearch,
GAPSearch,
KMeans,
)
def _fast_kmeans(**config):
distance = config.get("distance", "correlation")
... |
a46bbd7b4cb4a67a755bb19fcb504742af961ed4e490fba020f33aa72e761413 | Python | 5,359 | 161 | # 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... |
b84ccda16a82bf6064ea63e7dada0af661f362d03ae1675d78a2cceb783c4756 | Python | 5,365 | 202 | from nl_expr.expressions import Symbol, Constant, ExpressionBlock
from nl_expr.expression_walker import ExpressionBasicEvaluator
from nl_expr.logic import Implication, Conjunction, UniversalPredicate
from nl_core.datalog.basic_representation import DatalogProgram
from nl_core.datalog.expressions import TranslateToLogic... |
ba1163becd38a1dc40053a18e0846283f09a513a400b749f651bb5a754fb1706 | Python | 5,366 | 163 | import pytest
import networkx as nx
def test_valid_degree_sequence1():
n = 100
p = 0.3
for i in range(10):
G = nx.erdos_renyi_graph(n, p)
deg = (d for n, d in G.degree())
assert nx.is_graphical(deg, method="eg")
assert nx.is_graphical(deg, method="hh")
def test_valid_deg... |
618f91bdebbac4c448a9112bd44170d1f4b092f2877612d382f288f259857a22 | Python | 5,367 | 151 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 24 13:26:41 2018
@author: jacobrosenstein
"""
import json
from datetime import datetime
import numpy as np
import copy
import chemcpupy as ccpu
class MixtureList:
def __init__(self,*args,**kwargs):
self._mixture_list = []
... |
131130093ec3f5b971e12e560d9601e728d58cfaefc4bf29495c2e155dc4af39 | Python | 5,369 | 205 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
data=pd.read_csv('F:\\YF文件\\NC-paper\\论文图\\出图\\程序\\current\\test1.csv',engine = 'python')
# data=pd.read_csv('F:\\YF文件\\NC-paper\\论文图\\出图\\程序\\current\\Class2.csv',engine = 'python')
data1=data.values
(row,col)=data1.shape
# Nsteps le... |
78f91efe20fc84da2b6e138ab4b2109e48a5e51a6a25859f8ec0338c489bee51 | Python | 5,370 | 142 | import abc
import functools
import logging
import os
from typing import (
ClassVar,
Optional,
)
import fs
import fs.errors
from fs.base import FS
from galaxy.exceptions import (
AuthenticationRequired,
MessageException,
)
from galaxy.files.models import (
AnyRemoteEntry,
FilesSourceRuntimeCont... |
fd673f612e446ee77a7a6a517e6ef8e07ed0ed3b1a03fd7c65a7f43b79b14244 | Python | 5,370 | 39 | import numpy as np
import MDAnalysis as mda
import MDAnalysis.analysis.align as ana
import sys
psfs=["../trajs/_scratch_r16_ma2374_gmx_cftr_2nd_round_310K_I37R_2.psf", "../trajs/_scratch_r16_ma2374_gmx_cftr_2nd_round_310K_I37R_2.psf", "../trajs/_scratch_r16_ma2374_gmx_cftr_2nd_round_310K_I37R_2.psf", "../trajs/_scratc... |
2c1a346885843183a8cedceb87a078d02da7df5b2ee3a0550e82bad6cf94824f | Python | 5,374 | 199 | from enum import Enum
from typing import (
Literal,
Optional,
)
from uuid import UUID
from pydantic import Field
from galaxy.util.hash_util import HashFunctionNameEnum
from . import PdfDocumentType
from .schema import (
BcoGenerationParametersMixin,
DatasetSourceType,
HistoryContentType,
Model... |
37d8a4ee329c6a90ddc2a94e3f29a4e1c2a7676ec30599c1b70483b79d423e0d | Python | 5,374 | 144 | # Generated manually for UTC-1335 import/reimport observability
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects', '0036_projecthotkeypreference'),
]
operations = [
# auto_now_add → manual progress/status clock is ORM-only; colum... |
d5c1d8b640d9f1536e08c2a9bee9db1b0c7905f93351c6b5c7e8aad976aba49e | Python | 5,374 | 108 | """
Code conceptualized from model notebook.
Functions for image augmentation to improve model performance.
March, 2022
Ye Yuan (yeyu@umich.edu)
ALL AUGMENTATION FUNCTIONS MUST TAKE IN XYCZ INPUT IMAGE AND OUTPUTS THE SAME SHAPE AND DTYPE IMAGE.
ALL AUGMENTATION FUNCTIONS MUST SUPPORT AUGMENTATION OF MASK (dtype=np... |
0b95d6e354e11c5f4a88de5fd812e2d318fc02cce685dde404152781613a9640 | Python | 5,375 | 154 | import torch
import torch.nn as nn
import torch.nn.functional as F
from cogdl.utils.link_prediction_utils import GNNLinkPredict, sampling_edge_uniform
from cogdl.layers import RGCNLayer
from .. import BaseModel
class RGCN(nn.Module):
def __init__(
self,
in_feats,
out_feats,
num_la... |
80a9bd543b679b01658ba920c15d64b44148febc3ce29d92834d849ba4a85b94 | Python | 5,376 | 171 | """Unit tests for the :mod:`networkx.algorithms.cuts` module."""
import networkx as nx
class TestCutSize:
"""Unit tests for the :func:`~networkx.cut_size` function."""
def test_symmetric(self):
"""Tests that the cut size is symmetric."""
G = nx.barbell_graph(3, 0)
S = {0, 1, 4}
... |
1448799842f88708d37b97e97d3145aed92b456c53fb42ab110154f3ada9d374 | Python | 5,377 | 160 | import copy
import os
import shutil
from typing import Literal
import mne
def get_cerebellum_data(cmb_dir: os.PathLike[str] | str | None = None) -> None:
"""Check if the required cerebellum data are available and download if not.
Parameters
----------
cmb_dir : path-like | None
Path to the c... |
184f6eb1ce95c8b0a6b6c57e12b2f40ad576296c72f5289febfc7c7fb9f2e48e | Python | 5,377 | 179 | import logging
import numpy as np
import gunpowder as gp
from .data_sources_base import DataSourcesBase
from ...gunpowder.binarize_labels import BinarizeLabels
from ...gunpowder.merge_labels import MergeLabels
from ...gunpowder.add_background_labels import AddBackgroundLabels
from ...gunpowder.add_mask import AddMask... |
a777e2049fa6e9ae2d8ab66ab0ae13cad5eb101a5eb7f8782a8ff8e5c058e760 | Python | 5,379 | 152 | """
This dependency resolver resolves tool shed dependencies (those defined
tool_dependencies.xml) installed using Platform Homebrew and converted
via shed2tap (e.g. https://github.com/jmchilton/homebrew-toolshed).
"""
import logging
import os
from galaxy.util import parse_xml
from . import (
DependencyResolver,
... |
1f0e1a1ba5c9727fced4c7e3860289c55316a845cd36389072de497dc75f6228 | Python | 5,382 | 182 | """Summarizing functions for DiviK result.
_summary.py
Copyright 2019 Grzegorz Mrukwa
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 require... |
5fdf423e762677cf59cba5da6939a077c517f636d5ecaf6c3a5cb5021c129e94 | Python | 5,387 | 165 | import torch.nn as nn
import torch.nn.functional as F
import torch
import numpy as np
from torchvision.models import resnet18
def weights_init_normal(m):
classname = m.__class__.__name__
if classname.find("Conv") != -1:
torch.nn.init.normal_(m.weight.data, 0.0, 0.02)
elif classname.find("BatchNor... |
2c51f8052aa6aef7762f09520d6bcde801d90d64802dad8959f2522df7a2a08f | Python | 5,388 | 146 | """Generic validation utilities for squidpy."""
from __future__ import annotations
from collections.abc import Hashable, Iterable, Sequence
from typing import TYPE_CHECKING, Any, cast, get_args, overload
from squidpy._utils import _unique_order_preserving
if TYPE_CHECKING:
from anndata import AnnData
from s... |
bdbe39a2463db6336ecd8dc8c57cb8e9fc3b211464a64255f59658b50addfe04 | Python | 5,388 | 170 | """Replace triggers
Revision ID: c716ee82337b
Revises: a91ea1d97111
Create Date: 2025-06-16 12:43:36.193648
"""
from alembic import op
from galaxy.model.migrations.util import (
_is_sqlite,
transaction,
)
# revision identifiers, used by Alembic.
revision = "c716ee82337b"
down_revision = "a91ea1d97111"
bran... |
580c51dcce800e9d2b5f2138f2fb3cebef1310207804406df75bf0e92de06a0e | Python | 5,389 | 142 | import logging
from os import listdir
from os.path import (
basename,
exists,
isdir,
islink,
join,
realpath,
)
from . import (
Dependency,
DependencyResolver,
ListableDependencyResolver,
MappableDependencyResolver,
NullDependency,
)
from .resolver_mixins import UsesToolDepen... |
1cdcfad4949ee95fe9a692b43298036355bd64606bab74b4dfb7b6dcf1172204 | Python | 5,392 | 165 | import math
import random
import numpy as np
import pytest
from rlmolecule.alphazero.alphazero import AlphaZero
from rlmolecule.mcts.mcts import MCTS
from rlmolecule.molecule.builder.builder import MoleculeBuilder
from rlmolecule.tree_search.reward import LinearBoundedRewardFactory
from tests.qed_optimization_problem... |
3c61a359ad4a3a25b813026956a4fbe19e6994153fb30f73f03d7da31c43b445 | Python | 5,393 | 153 | """Tests for pseudodepths.py
Copyright (C) 2021 Ionpath, Inc. All rights reserved."""
import os
import struct
import shutil
import tempfile
import unittest
import numpy as np
from mibidata import pseudodepths
# File variant 1, 8 bins per spectrum, 16 = 4x4 pixels.
NUM_PIXELS = 4
HEADER = (1, 8, NUM_PIXELS)
# Assu... |
2f0a4685ad9aabf00306189995e6686e61e288018c5eeeaf93f741635f8e67cd | Python | 5,396 | 144 | import logging
import os
import numpy as np
import pandas as pd
import pyBigWig
from scipy import stats
from maxatac.utilities.genome_tools import chromosome_blacklist_mask
def get_genomic_stats(bigwig_path: str,
chrom_sizes_dict: dict,
blacklist_path: str,
... |
999d044e43b8d156240cbe1b59676447e58e5b97626637542554ced278ab0ee0 | Python | 5,396 | 121 | """
orbit.datasets.toughc1
"""
import os
import pickle
from orbit.datasets.dataset import BindingSiteDataset
class ToughC1(BindingSiteDataset):
""""""
def __init__(self, engine='fpocket'):
super(ToughC1, self).__init__('TOUGH-C1')
assert engine in ('fpocket', 'lpc'), f'Unknown pocket engine:... |
9f8282e3daef2d1fd26513261f92081c61a53489143cc11ce71c8efebf7f74da | Python | 5,397 | 171 | # 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 os
from ax.benchmark.benchmark_metric import BenchmarkMetric
from ax.benchmark.benchmark_problem import BenchmarkProb... |
ff0637209bc084f389041d7addde6b2a664c65cf4e2e281434161facebc7588e | Python | 5,399 | 158 | # 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... |
eb3e2772f168806abcaa9baca9f8a24ab9b5d6cac8898c36a0a01920ac7820d0 | Python | 5,400 | 185 | import numpy as np
from ... import proc
from ... import seg_utils
from .. import overlap
from .. import score
from . import dataset
def score_w_params(preds, img, seg, lbl,
asynet, patchsz, cc_thresh, sz_thresh,
dist_thr=1000, voxel_res=[4,4,40], to_ignore=[]):
ccs = proc.s... |
8435ccfb2df3516af954e75fec31301107d1cc8a2d9a4fbe1da5ed47e88d7090 | Python | 5,401 | 163 | # 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... |
a78059a3f524a79245d039fa8eba3b7147ea2239d4e9616dba803aa68695e499 | Python | 5,403 | 150 | import errno
from functools import partial
import select
import sys
try:
from time import monotonic
except ImportError:
from time import time as monotonic
__all__ = ["NoWayToWaitForSocketError", "wait_for_read", "wait_for_write"]
class NoWayToWaitForSocketError(Exception):
pass
# How should we wait on ... |
6d4eb65bfb5eb56c86108cbaaf19bc3ec79c330a6d26b395b9ca1f9a449bac87 | Python | 5,406 | 152 | """
Stoer-Wagner minimum cut algorithm.
"""
from itertools import islice
import networkx as nx
from ...utils import BinaryHeap, arbitrary_element, not_implemented_for
__all__ = ["stoer_wagner"]
@not_implemented_for("directed")
@not_implemented_for("multigraph")
@nx._dispatchable(edge_attrs="weight")
def stoer_wag... |
15d729eb0c2e22cebca78d007bc1a4283a51b5bb9caea12ee62b851831b5a30b | Python | 5,409 | 145 | import os, sys, stat
import sys
import optparse
import logging as logger
import configparser
import pickle
import platform
from time import time
from subprocess import call
from os import system, rename
# Framework imports
from serverless.Serverless import *
from serverless.datacenter.AzureDatacenter import *
from ser... |
c3cec49d7e2d0bf2e37a66b3bbd9cb2959a720c2b62323c7add08037f7571ecf | Python | 5,409 | 149 | from hyper_params import get_hyper_params, HyperParams
from tensorflow.keras.callbacks import EarlyStopping
import time
from utils import get_data, set_data_size
import numpy as np
import random
import tensorflow as tf
from scipy.stats import pearsonr
from get_cnn_model import get_model
from tensorflow.keras.models imp... |
2bebe0849e0198ad88f0e25f866ca1d4ae0b05af2e5a0c26bd9fa4828afcb9a1 | Python | 5,411 | 112 | """
Script for the segmentation workflow
"""
import os
from helpers_and_sources.mainflow_helpers import *
import tifffile as tf
import torch
import numpy as np
from helpers_and_sources import image_augmentations, image_operators, image_segmentation_model
from tqdm import tqdm
def segmentation(inputs, ... |
1397123bba2d1f720ee24508e35e06fdf81fc3cd7ceff19f7a06d781fc1612b6 | Python | 5,417 | 110 | import time
import numpy as np
import matplotlib.pyplot as plt
import feedforwardmodel
import figplot
t1 = time.time()
np.random.seed(4)
g_average_list = np.load('data/glist.npy')
def calculate_stdp(g_index, w_initial, pre_neuron, delta_t):
"""
Calculating synaptic weight changes after STDP stimulations... |
b264236a47e0e53db7bb90dcfd24f2baa31c3c4559e46d36dcfb8847034b4072 | Python | 5,417 | 176 | #!/usr/bin/env python3
# /// script
# dependencies = [
# "packaging",
# ]
# ///
from __future__ import annotations
import argparse
import sys
import tomllib
from collections import deque
from contextlib import ExitStack
from functools import cached_property
from pathlib import Path
from typing import TYPE_CHECKING
... |
8d0cbf7ea2e04a11b3f4a69bc52f19a41d3e3fa58fcfd7f7baece5d915af14cc | Python | 5,418 | 180 | import numpy as np
from nilearn import datasets
import nibabel as nib
from ._backend import BACKENDS, use_backend
class TimeDatalogJoin:
"""
Time a four-way join solved through the ``NeurolangDL`` frontend.
Only solving the program is timed; loading the relations and parsing
the program happen in ... |
6e81040a5cb2c9bfeefba20d1cd2e41a2b9cc738de62e90d16e915e8216f6f8c | Python | 5,420 | 140 | #todo: compute jaccard index
from src.utility import *
from src.utility import bin_localisations_v2, get_coords, get_root_path
import matplotlib.patheffects as pe
class NetworkTrainingMetrics():
def __init__(self, path, name):
self.name = name
data = np.load(path,
allow_pickle=True)
... |
ad714c45b0aff8b1b66fbdcae784947f13f6224153115e7b34a5a213d2fe5177 | Python | 5,421 | 183 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
00c212b6adba83cf28b427ab80dc236500d6c2a77e1be34079a7da83d338aa92 | Python | 5,424 | 154 | ############################################################################## Setup
"""
ND Bayesian Optimization Test:
(0) Gaussian process model.
(1) Gemerate ND objective using BO_express autobuilding features.
(2) Run simulations with select acquisition functions.
"""
# Imports
import pandas as pd
from edbo.bro i... |
6ddaec53c61e3523c5a7c0b52016807bc8381eb9f04c1ed20052c01d2886a2aa | Python | 5,424 | 131 | import numpy as np
class LineString3D:
"""" Class for operating on 3D paths
Akin to the 2D LineString class in the shapely package (but not nearly as
fully featured).
Parameters
----------
coords : (N, 3) array
3D coordinates that define the path
"""
def __init__(self, coords... |
ccea95d408adea9bd1e3c841064d1152449a1528cd2f4330068c2df730ebb28b | Python | 5,435 | 168 | __doc__ = """
Independent Implementation of HCBS' Synaptic Partner Candidate Generation
"""
import operator
import itertools
import numpy as np
from scipy import spatial
from scipy import sparse
from scipy.ndimage import distance_transform_edt
from ... import seg_utils
from .. import seg
def extract_prox_candidates... |
899002aeaf38ed6bd107f5138a0fd4a64de22b2f93d8081e725656a57bc46a31 | Python | 5,437 | 157 | import re
from dataclasses import dataclass
from typing import (
Generic,
Optional,
Protocol,
TypeVar,
)
from .auto_identifiers import filename_to_element_identifier
class HasName(Protocol):
name: str
T = TypeVar("T", bound=HasName)
# matches pairing.ts in the client
COMMON_FILTERS: dict[str, ... |
17a278b2bb85a392bfdbb456f5da4dc6c7fa92db533afad1cc05848c05cc5d14 | Python | 5,446 | 129 | #!/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 logging import Logger
import numpy as np
import numpy.typing as npt
from ax.adapter.transforms.b... |
81f8b2bf685bf6074ded19dba9dddb8faf10fbbb480fd99d30cfb62223cb7064 | Python | 5,446 | 137 | # -*- coding: utf-8 -*-
import pandas as pd
import os
import seaborn as sb
from matplotlib import pyplot as plt
import numpy as np
def change_cell_number_to_string(number):
#not needed right now since all cells are just ints
#convert int to string with cellXXXX
#where XXXX is the int filled to ... |
87bfc1c5a2d10009b4e1dbf72e537ec46181deb728b9e3b38ed283ccb6f930a7 | Python | 5,446 | 132 | # 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
from ax.benchmark.benchmark_problem import BenchmarkProblem
from ax.benchmark.problems.regi... |
eda99105d96e4ed281b231b976f6c81406fb4d89effb93703a618a998d497fbc | Python | 5,448 | 135 | #!/usr/bin/env python
#
# Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
import os
import martian
import tenkit.preflight as tk_preflight
from tools import ReferenceManager
from preflights import (check_refdata, check_vmem_for_reference, check_filehandle_limit,
check_sample_id, che... |
dbecf0d91245fbb097cb0b02e04d09d88b65cabb5fc1f8763c1866ac11fedcbd | Python | 5,451 | 151 | import warnings
from abc import ABC
from contextlib import contextmanager
from inspect import signature
import imageio
import numpy as np
import tensorflow as tf
from deprecated import deprecated
from PIL import Image, ImageDraw, ImageFont
from .. import keras
from ..utils import listify
class Callback(ABC):
""... |
f88cbf794e03006bbce930eb50c99b750ff6ecf1e3ecef742ae2fb7ccb63791a | Python | 5,453 | 203 | import fanc
# start snippet check
hic = fanc.load("examples/output/hic/binned/fanc_example_500kb.hic")
isinstance(hic, fanc.matrix.RegionPairsContainer) # True if interface supported
# end snippet check
# start snippet create
# create a few regions
region1 = fanc.GenomicRegion(chromosome='chr1', start=1, end=1000, i... |
5357699f14416635974eec2df8cfc11b62b4e9169766717470a1cb892f6066ba | Python | 5,456 | 170 | from __future__ import annotations
import math
from os import fspath
from pathlib import Path
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
from scverse_misc import Deprecation, deprecated
from anndata._io.utils import no_write_dataset_2d
from .._warnings import WriteWarning
from ..compat ... |
d900d3eb1b2afec1d2009d5f1a5dc6e03a24daa6d193d5ff690e8e53681ed6ee | Python | 5,458 | 143 | # 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
from ax.adapter.base import Adapter
from ax.analysis.analysis import Analysis
from ax.analysis.grap... |
b8dd2af7ed1f7acf7a634e6af2fa9bbcb963c042da0d66e2daf102d0b49a3d41 | Python | 5,462 | 158 | """Unit tests for pydot drawing functions."""
import subprocess
from io import StringIO
import pytest
import networkx as nx
from networkx.utils import graphs_equal
pydot = pytest.importorskip("pydot")
# NOTE: pydot layouts and drawing require graphviz to be installed. Skip these
# tests if they are not found
try:
... |
cca69abc0b36ca5af7e34222703e3ece156d91307ed8e9283c37c55b93b215dd | Python | 5,463 | 213 | from pytest import raises
import typing
from .. import expressions
from ..expression_pattern_matching import (
PatternMatcher, add_match, NeuroLangPatternMatchingNoMatch,
UndeterminedType
)
from ..expressions import Projection, Statement, Query
C_ = expressions.Constant
S_ = expressions.Symbol
F_ = expression... |
2bcd180e0e4004b91750c2db50c751375f2e6a89ad8d754329257bf961ef6865 | Python | 5,464 | 149 | #!/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 math
from collections import defaultdict
from collections.a... |
edc2ccf79653086bdf14831f4e2794f08fc3eb57938f58953ced055f12275845 | Python | 5,464 | 228 | """
Eigenvalue spectrum of graphs.
"""
import networkx as nx
__all__ = [
"laplacian_spectrum",
"adjacency_spectrum",
"modularity_spectrum",
"normalized_laplacian_spectrum",
"bethe_hessian_spectrum",
"magnetic_spectrum",
]
@nx._dispatchable(edge_attrs="weight")
def laplacian_spectrum(G, weigh... |
751bc3bb74c9ab3fd10e209429b41313b4faea97b801ba0da5d4ab284cca4c0f | Python | 5,466 | 154 |
import torch
from torch import nn
from torch.nn import functional as F
from torch_geometric.utils import degree
from torch_geometric.nn import GATConv, global_max_pool
class GAT(nn.Module):
def __init__(self, dim_features, dim_target, model_configs, dataset_configs, max_num_nodes=200):
super().__init__()... |
7454ae4c16ba4517b364829463e83aa2de2efd4e5c1364c481a56b7ca2066d85 | Python | 5,467 | 181 | import argparse
import os
import pickle
import json
import random
import third_party.midi_processor.processor as midi_processor
JSON_FILE = "maestro-v2.0.0.json"
# prep_midi
def prep_maestro_midi(maestro_root, output_dir):
"""
----------
Author: Damon Gwinn
----------
Pre-processes the maestro da... |
36318809d913ce122e211a9abc7274a3a578c1cd8562dd3427b1055606662d59 | Python | 5,468 | 118 | import networkx as nx
import numpy as np
import torch
import torch.utils.data
import util
class GraphSampler(torch.utils.data.Dataset):
''' Sample graphs and nodes in graph
通过G_list遍历每一个图样本,通过公式 L=DAD 求出临接矩阵,图样本的结点特征,图样本标签和图样本结点数
'''
def __init__(self, G_list, features='default', normalize=True, assig... |
7a7ff05cd4b8bd32cd88773c40b6d69729de481d0af60881321bf2c8c705aee9 | Python | 5,469 | 135 | """Tests for MSA to HMM conversion functionality."""
import numpy as np
from learnMSA.hmm.util.transition_index_set import PHMMTransitionIndexSet
def test_index_set() -> None:
"""Test PHMMTransitionIndexSet initialization and structure."""
ind = PHMMTransitionIndexSet(3)
assert ind.L == 3
np.testing... |
f35893d29321131f606610002ea9e8fafcbd21585a2bb91062efcef030c9f231 | Python | 5,469 | 128 | import re
import sys
import os
import math
from pyfaidx import Fasta
#mapping UniprotID with each Protein interface region
UniprotID_interface = {}
with open(r'E:\OneDrive\学术\PPI article\data\mapped data\0.data filter\Uniprot_Genename_All_PPI_sites.txt') as fp:
fp.readline()
for line in fp:
... |
16bc4f1b8f907c3572541a1accbaa779f70ac46fa6ed7f4334253c447bff84a3 | Python | 5,470 | 161 | """
Image basic IO capabilities
"""
import re
import numpy as np
from xml.etree import ElementTree as ET
import tifffile as tf
# OME-TIFF Metadata Processing
def get_namespace(element):
"""Get XML namespace string given an element.
Use get_pixelsettings instead for accessing pixel attributes from TiffFi... |
dfeb765eb789f4fed65aefbf26e2628ec5668be5b842713956c5264292bf0f77 | Python | 5,470 | 169 | # -*- coding: utf-8 -*-
"""
Parameteric rank filters
This module provides rank filters that depend on several parameters.
"""
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE.txt)'
__copyright__ = 'Copyright © 2020 by Christoph Kirst'
... |
7ec17ea99dbc59a936e04338b28d2db5b0722a06f5bb5da5cbe08ab5a9345bdf | Python | 5,471 | 213 | """The "numpy" CPU backend, based on NumPy.
To use this backend, call ``himalaya.backend.set_backend("numpy")``.
"""
import numpy as np
try:
import scipy.linalg as linalg
use_scipy = True
except ImportError:
import numpy.linalg as linalg
use_scipy = False
##############################################... |
bea3e689fbb8d4415b99bb669ea238b8a37d29a64b064eaf2cafb80237e69ca4 | Python | 5,471 | 149 | # TODO: These tests should share code with test_layers, and test_obsmvarm
from __future__ import annotations
import warnings
import joblib
import numpy as np
import pandas as pd
import pytest
from scipy import sparse
from anndata import AnnData
from anndata.tests.helpers import gen_typed_df_t2_size
from anndata.util... |
50acc7fb1854c90076d526aaac2d0169b999dd09e7ce73435dc8c19701af1ef9 | Python | 5,472 | 135 | import fanc
from fanc.registry import class_name_dict
import genomic_regions as gr
import pytest
import pysam
import os
class TestAuto:
def test_auto_identification(self, tmpdir):
for class_name in ('Hic', 'LegacyHic', 'ReadPairs',
'AggregateMatrix', 'ComparisonMatrix',
... |
d64331c8747f86f1a57ddd9b5897572ee948321d085a799d3f51d205b350f758 | Python | 5,475 | 138 | import unittest
from itertools import cycle
from unittest.mock import MagicMock, patch
import numpy as np
import pytest
from divik.cluster import _kmeans as km
from divik.cluster._kmeans import _core as cc
from divik.cluster._kmeans._core import redefine_centroids
from test.cluster.kmeans import data
class Labelin... |
0ad6b685446ead6182883e8982e66fc15af8693557954d7fa0711fbf999fce68 | Python | 5,476 | 170 | import argparse
import os
import numpy as np
import math
import torchvision.transforms as transforms
from torchvision.utils import save_image
from torch.utils.data import DataLoader
from torchvision import datasets
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import torch... |
18d1dc9409a2496482ade758a8c10fb273ed38bafea55d4427b8480e3e12c83f | Python | 5,479 | 87 | from scipy import stats
import scikit_posthocs as sp
import numpy as np
import pandas as pd
import glob
def friedman_test(dataframe):
return stats.friedmanchisquare(*[row for index, row in dataframe.T.iterrows()])
def nemenyi_test(dataframe):
nemenyi = sp.posthoc_nemenyi_friedman(dataframe)
list_index=[]
... |
d096651b55a51430e8b54e1c9f30bb8775844de541fa58517a1aaa465716f87a | Python | 5,485 | 164 | import numpy as np
from ..aabb_tree import AABB, Tree
def _generate_random_box(x_bounds, y_bounds, z_bounds, size_bounds):
lower_bound = np.array([
np.random.uniform(*b) for b in (x_bounds, y_bounds, z_bounds)
])
upper_bound = lower_bound + np.random.uniform(*size_bounds, size=3)
return AABB(... |
8210f4268d5fab0f4564638d8a4574a04c31f9cfd6e2472886d0f634c1bc8975 | Python | 5,489 | 133 | import time, os
import numpy as np
from cellpose import io, transforms, utils, models, dynamics, metrics, resnet_torch, denoise
from cellpose.transforms import normalize_img
from pathlib import Path
import torch
from torch import nn
import time
import argparse
def main():
parser = argparse.ArgumentParser(descripti... |
c3c733a4deae96ff86ce99c9ed518536850ef93f77dcfad9fd4418f5590b1276 | Python | 5,490 | 131 | # 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... |
64077c81a95e45fbe16b38a1085fb682b7a7069a4510bf9e435f9f16ba630532 | Python | 5,492 | 119 | import function as func
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pdb
import os
import math
import pysam
import sys
import random
## Variables
global_var_dict = func.global_variables()
SAMPLE = global_var_dict['SAMPLE']
CNV_CHR = global_var_dict['CNV_CHR']
CNV_START... |
91f132aa1c59f88b64cbaebe752751fb0ef5ed064b06c99cef77fbbae9ecd602 | Python | 5,492 | 112 | # -*- coding: utf-8 -*-
from figureflow import figure
import seaborn as sb
from matplotlib import pyplot as plt
import importlib
import numpy as np
importlib.reload(figure)
import os
Figure = figure.Figure
input_folder = os.path.dirname(os.path.abspath(__file__))
figure = Figure(input_folder,number=6,... |
32cc8eb16f28948bbf9205ec87840648fc1cc8ea9546e4f980933a45581ead89 | Python | 5,494 | 170 | # -*- coding: utf-8 -*-
"""
PlotGraph3d Module
------------------
Plotting routines for 3d display of graphs.
Note
----
This module is using vispy.
"""
__author__ = 'Christoph Kirst <ckirst@rockefeller.edu>'
__license__ = 'MIT License <http://www.opensource.org/licenses/mit-license.php>'
__copyright__ = 'Copyrig... |
43aed75edf8c42a66e965e086a09c1aa1736925478e59d6b280c5cec6aa2c318 | Python | 5,494 | 86 | import time
import numpy as np
import matplotlib.pyplot as plt
import figplot
t1 = time.time()
conv_time = 200000
def plot_timeseries_sd_two(g_1, g_2, g_sd_1, g_sd_2, g_min, g_max, t_min, t_max, aspect, fig, plot_x, plot_y, plot_area):
time_trace = np.arange(t_min - conv_time + 1, t_max - conv_time + 1)
ax... |
96447a362eeafa2d978796f987e45c8bbb18a9e796ca526d2259ab43ea18fc88 | Python | 5,495 | 150 | from simulator.host.Host import *
from simulator.container.Container import *
class Simulator():
# Total Router Bw
# Interval Time in seconds
def __init__(self, RouterBw, Scheduler, Workload, ContainerLimit, IntervalTime, hostinit):
self.totalbw = RouterBw
self.hostlimit = len(hostinit)
self.schedule... |
83f101aecd8d50a9f0f3112d545188a40e03105147fe71593c157e29cac22779 | Python | 5,497 | 147 | #!/usr/bin/env python
#
# Copyright (c) 2019 10X Genomics, Inc. All rights reserved.
#
# Test differential expression
import numpy as np
import scipy.sparse as sp_sparse
import tenkit.test as tk_test
import analysis.diffexp_nb as atac_de
from utils import normalize_matrix
def evaluate_de_res(de_res, de_genes, adj_p_... |
1325a012703f3b1f9e1f0dc19473daf462824b452f098fb4532faa54915f189b | Python | 5,498 | 163 | import tensorflow as tf
from src.custom_layers.cs_layers import CompressedSensingInception, CompressedSensing
from unittest import skip
from tests.test import BaseTest
import matplotlib.pyplot as plt
from tensorflow.keras import backend as K
from tensorflow.keras.layers import Input
from tensorflow.keras.models import... |
a545996d122eee12c503050b8de9135a1ab0d38bea7e017011d9a0af0e59b90e | Python | 5,498 | 125 | import logging
import os
from typing import Iterator, List, Dict, Optional, Callable
import torch
import json
import numpy as np
from overrides import overrides
from allennlp.data import Instance
from allennlp.data.fields import TextField, ArrayField, LabelField, MetadataField
from allennlp.data.dataset_readers import ... |
b6debd6d159f3722886cd54b29f438792db4aaaca43ba6a869ad35bc00f81b0a | Python | 5,499 | 153 | ############################################################################## Setup
"""
ND Build and Bayesian Optimization Test:
(1) Autobuild ND objective.
(2) Initialize with data.
(3) Test predictions, variance estimation, and sampling.
(4) Run single iteration of select acquisition functions.
"""
# Imports
impor... |
d6c7c5e4145bd67118dcf5e9eea23244ae7ffdeafe87919f9453398770d4d6a7 | Python | 5,499 | 152 | import numpy as np
from ..perior_tree import BoundedAABB, Boundary, Tree
def _generate_random_box(x_bounds, y_bounds, boundary, size_bounds):
lower_bound = np.array([np.random.uniform(*b) for b in (x_bounds, y_bounds)])
upper_bound = lower_bound + np.random.uniform(*size_bounds, size=2)
return BoundedAABB... |
8481a0f73238bf29515e4ad8e701ef7ab4d239e2ba76dd469f64ff258bc63675 | Python | 5,500 | 164 | """
Algorithms for asteroidal triples and asteroidal numbers in graphs.
An asteroidal triple in a graph G is a set of three non-adjacent vertices
u, v and w such that there exist a path between any two of them that avoids
closed neighborhood of the third. More formally, v_j, v_k belongs to the same
connected component... |
7ed45ec4cc398c4d73b7b8b977fbac0807de5dff5e476cd3b3617504279250cd | Python | 5,504 | 147 | from django.db import migrations, models
from django.db.models.functions import Cast
from django.db.models.lookups import Exact, In, Lookup
from cvat.apps.engine.utils import take_by
# The requirement types compared by OKS
POINT_ANNOTATION_TYPES = ("points", "skeleton", "skeleton_keypoint")
# The default value at th... |
24c21149d67dcd95278f83265fd919c60d25688130972231827f6a47af1ba5f0 | Python | 5,505 | 193 | # -*- coding: utf-8 -*-
"""Gaussain module
Generates the Gaussian beam shape based on experimental or theoretical parameters
"""
# Created on Thu Mar 21, 2020
# Contributions and Changelog accessed via a private git repository:
# https://github.com/philipwijesinghe/deep-learning-lsm.git
# philip.wijesinghe@gmail.co... |
895553c4d0f8a66b4321edc9a8a834b406c0d14962c496ea745b6495f9dee687 | Python | 5,506 | 211 | def load_images(args, idx_val):
"""Load and preprocess the training, validation and test images.
Parameters
----------
args : Namespace
Input arguments.
idx_val : bool
Indices of the validation images.
Returns
-------
X_train : list of tensor
Training images.
X_val : list of tensor
Validation images.... |
a364cc90c458d22c27fa22f55cc4512054ad314912e22dda8dc79e60d9ed2858 | Python | 5,506 | 156 | from __future__ import absolute_import, division
import time
import os
try:
unicode
except NameError:
unicode = str
from . import LockBase, NotLocked, NotMyLock, LockTimeout, AlreadyLocked
class SQLiteLockFile(LockBase):
"Demonstrate SQL-based locking."
testdb = None
def __init__(self, path, ... |
8e2381b7d351c6b733c4ce10cdbd08d4b33027b88fefb21f36d67c54a684188c | Python | 5,507 | 216 | # -*- coding: utf-8 -*-
"""
SharedMemoryManager
===================
Shared memory array manager for parallel processing using ctype shared
arrays in :mod:`~ClearMap.ParallelProcessing.SharedMemoryArray`.
"""
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Pulic Lic... |
6c884d21afef0a780c094d082f4d7150238b874645d9859bdc16810583794d80 | Python | 5,508 | 170 | #### All original code is copyright of Graham King, Trinity College Institute of Neuroscience.
### Plotting histograms of m-values, the slopes of the regressors
import pandas as pd
import numpy as np
import glob
import os
import matplotlib.pyplot as plt
from scipy import stats
from scipy.stats import bootstrap
import... |
dc79f9f9904231b6c5b564dbd8e355ac17233cd2699ad43ff15304809abf8cbe | Python | 5,509 | 137 | #!/usr/bin/env python
import pystan
cell_genotype_consensus = """
data {
int<lower=0> cells; // number of cells
int<lower=0> loci; // number of loci
int<lower=0> msoup; //number of loci used to estimate soup
int<lower=0> k; // number of clusters
int<lower=1,upper=2> ploidy;
int cluster_allele_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.