sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c21a22d0324893407e8ff5bac0b928b05c1c30a08899a9c79e964a79877e5fd5 | Python | 15,226 | 393 | """Dependency Resolution
The dependency resolution in pip is performed as follows:
for top-level requirements:
a. only one spec allowed per project, regardless of conflicts or not.
otherwise a "double requirement" exception is raised
b. they override sub-dependency requirements.
for sub-dependencies
... |
345bdd98bddafb9ab535e47db5d7f572d1809402975e07ff6a1141e293483328 | Python | 15,229 | 363 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from ax.adapter.discrete import DiscreteAdapter
from ax.adapter.random import RandomAdapter
from ax.ad... |
b52c8107b288c0fe27a7b0d9c646dc24e4e91399f9bcade1b209086660989aee | Python | 15,243 | 385 | import os
import os.path as op
from pathlib import Path
from unittest.mock import MagicMock
import nibabel as nib
import numpy as np
import pytest
from mne.datasets import sample
from pytest import MonkeyPatch
from scipy.ndimage import zoom
from cmb._helpers import load_image_volume
from cmb.segmentation import segme... |
840f3e6c3ef07c90d4cfb997decf81e21e52d5ca1928151cf0d489e55446f625 | Python | 15,247 | 299 | # 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... |
47deead29e767cc0a9bfcd753de733f28f8124f227e391e8432b789b5e7cc088 | Python | 15,258 | 321 | #!/bin/python3
#############################################################################################################
### Brian 2 simulation of a single current-based synapse connecting two leaky integrate-and-fire neurons. ###
### Depending on the neuronal activities, the synapse undergoes calcium-based early-... |
fc953d9c81f8c277871ba3ed10017fab5a0bc32e5450a93ef8591356490c00c8 | Python | 15,258 | 396 | """Fast algorithms for the densest subgraph problem"""
import math
import networkx as nx
__all__ = ["densest_subgraph"]
def _greedy_plus_plus(G, iterations):
if G.number_of_edges() == 0:
return 0.0, set()
if iterations < 1:
raise ValueError(
f"The number of iterations must be an... |
33f263b251216642985b7338a6b920c4dce2f682bca2b020307733c4ff748be5 | Python | 15,267 | 320 |
##########################################################################################
#
# psim_examples.py
#
# - Some examples to illustrate how perturbations work in probiosim
# (defined both explicitly and via the execution of arbitrary Python code)
#
#####################################################... |
68eb555f147cd6bf6a4eb5179f1ea43cfe124154c8c84e8b1f12f8c38bb585de | Python | 15,273 | 450 | import matplotlib.pyplot as plt # To plot
from scipy.optimize import curve_fit
from pylab import *
import numpy as np
import random
import math
import time
import os
import glob
import copy
plottest = False # True
Nrms = 10 # Number of averages
DR_estimates = np.zeros(Nrms)
Dz_es... |
334d76b1f80415da0fc82a74744b88ec49322cefa58a6b15c653ad993e0ee463 | Python | 15,278 | 494 | 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... |
b9f9790c8b01d65467f7fb11e5eb15f6cdbdea44a1475781c67b91afeab61a7a | Python | 15,280 | 371 | import matplotlib
matplotlib.use('Agg')
# above 2 lines set the matplotlib backend to 'Agg', which
# enables matplotlib-plots to also be generated if no X-server
# is defined (e.g., when running in basic Docker-container)
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
from torchv... |
5a15ffcad793ad739d4d92cc5e9916d80e59148064c345ac9c946c3484f262d4 | Python | 15,294 | 409 | import pytest
import networkx as nx
from networkx.algorithms import bipartite
from networkx.utils import edges_equal, nodes_equal
class TestBipartiteProject:
def test_path_projected_graph(self):
G = nx.path_graph(4)
P = bipartite.projected_graph(G, [1, 3])
assert nodes_equal(list(P), [1, ... |
bf703105060bd429587bf7d793ec31fadae069cabe7d83c3541f8ad2679d428b | Python | 15,294 | 366 | import tensorflow as tf
import numpy as np
import learnMSA.tree.tf.initializer as initializer
from learnMSA.tree.tf.util import deserialize
from learnMSA.tree.tf.substitution_model import SubstitutionModel
from learnMSA.tree.tf.tree_model import TreeModel
class AncProbsLayer(tf.keras.layers.Layer):
"""A learnable ... |
75a44a099b029fcdd756b5f9b1afabba1710ec7a0cac72c153aa3d31b07c1086 | Python | 15,306 | 452 | """
Chat clients of the LLM providers.
A client speaks either the OpenAI chat completions API or the Anthropic
messages API with httpx, or runs a local command (e.g. ``claude -p``)
that reads the conversation on its standard input. The conversation is
kept in a provider-neutral form, a list of messages::
{"role":... |
c79c07f030ec256910b05b618275cbb4c637c898ee515057a431c9689a9ff8df | Python | 15,307 | 388 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 5 19:01:33 2018
@author: jacobrosenstein
"""
from chemcpupy import MixtureList,CompoundList
from chemcpupy.tools.misc import *
import numpy as np
import copy
import matplotlib.pyplot as plt
class Container(MixtureList):
def __init__(... |
3761a0f08e92ecfa3e1b7d6c910acf319f8c0c920861b4de3e1ad02ef510bb51 | Python | 15,323 | 458 | from pathlib import Path
from .job_manager import *
from .config.options import ProjectOptions
import os
import parse
import glob
import click
import logging
from .error_handler import exception_handler
from .utils import get_logger
from .status import needs_processing, write_record
# These imports are for the heudic... |
63ba097336b488b671dd25080949d739a8ea0f1f2b73f39dce7a46562e653294 | Python | 15,325 | 393 | """Plot the pairwise decoding analysis results.
Parameters
----------
project_dir : str
Directory of the project folder.
"""
import argparse
import os
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
# =============================================================================
# Input a... |
82c65d9ea4dfa97e5ebdb61485e7d6e7a2ea1fb279133d4eb6fcd67dc67c9e59 | Python | 15,325 | 467 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# readGenoList.py
#
# Copyright 2019 Daniele Raimondi <eddiewrc@vega>
#
# 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 Foundation; either version 2 ... |
6251b0fbdfeb882126489ed63e856c7f8ca598c36418bdfd207e89e3d4732117 | Python | 15,330 | 405 | """test app/mtype_densities"""
import json
import os
import warnings
from copy import deepcopy
from pathlib import Path
import numpy as np
import numpy.testing as npt
import pandas as pd
import pandas.testing as pdt
import pytest
import yaml
from click.testing import CliRunner
from voxcell import VoxelData # type: ig... |
566c489e403acab33d3e7d3851ae3293a9b6698ef2640f25f58a4e74034f36e6 | Python | 15,333 | 253 | #
# Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
#
import os
import tenkit.test as tk_test
import tenkit.fasta as tk_fasta
import martian
from .. import *
martian.test_initialize(tk_test.out_path(""))
IN_PREFIX = tk_test.in_path('combine_and_trim_reads')
IN_RA_ALL = [ tk_test.in_path('combine_and_trim_r... |
7f32b22a4ff373fb94d4d8e2a4dd29d76123596b852981eb325fe7dd20660567 | Python | 15,342 | 394 | import itertools
import numpy as np
from bsb import (
AdapterError,
Chunk,
DatasetNotFoundError,
ResultsError,
SimulationData,
SimulationError,
SimulationResult,
SimulatorAdapter,
multiplex_channels,
report,
)
from neo import AnalogSignal
class NeuronSimulationData(SimulationD... |
cba232598798d5d588a0a6fae31d72177e87f237bf35ead36dd938ee3258a1f0 | Python | 15,345 | 396 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from itertools import product
import numpy as np
from ax.utils.common.testutils import TestCase
from ... |
72126f95b5bfbd7f2bec8fdfdc12884cf1fe2985af2550d887f79e4f19d9c1f0 | Python | 15,377 | 451 | import matplotlib.pyplot as plt # To plot
from scipy.optimize import curve_fit
from pylab import *
import numpy as np
import random
import math
import time
import os
import glob
import copy
plottest = False # True
Nrms = 10 # Number of averages
DR_estimates = np.zeros(Nrms)
Dz_es... |
922d990424d930302766cea7b4352701a74091d5d64da5008da6e0e074ad920b | Python | 15,378 | 426 | """
tensorflow/keras utilities for voxelmorph
If you use this code, please cite one of the voxelmorph papers:
https://github.com/voxelmorph/voxelmorph/blob/master/citations.bib
Contact: adalca [at] csail [dot] mit [dot] edu
License: GPLv3
"""
# internal python imports
import os
# third party imports
import numpy as... |
c01106905095757a37beb0c4ede733dae93855dd940750ee000a8fee8966d0fe | Python | 15,378 | 480 | r"""
Neurolang Datalog grammar definition
and translation to intermediate representation
==============================================
1- defines the Neurolang Datalog syntax
2- code written using this grammar can be parsed
into an Abstract Syntax Tree (AST)
3- the obtained AST can ba walked through to translate it
to... |
88bb923e66c7a4e37b36b0c06c0349676049fe90cd28656067cc2720efd114c9 | Python | 15,387 | 374 | """Define abstraction for capturing the metadata of job's output datasets."""
import abc
import json
import os
import shutil
from logging import getLogger
from typing import (
Any,
Optional,
TYPE_CHECKING,
)
import galaxy.model
from galaxy.model import store
from galaxy.model.metadata import (
FilePar... |
8826950d98515e40b7b3c8548d3975a7042c11236a19a855d672edb40214589d | Python | 15,400 | 405 | # -*- coding: utf-8 -*-
'''
Created on 2020.05.19
@author: Jiahua Rao, Shuangjia Zheng, Hui Yang, Jiancong Xie
'''
from copy import deepcopy
from torch.optim import Adam, SGD
from MolRep.Models.early_stoppers import GLStopper, Patience
from MolRep.Models.sequence_based.MAT import MAT
from MolRep.Models.sequence_base... |
fcf0b2bbbce4a516c9f4b779cd24bf2538371fce68bb45bd74ad1876036498a4 | Python | 15,420 | 434 | """
Configured randomness.
Two things have to be true at once, and they are independent of each other.
Running one configuration repeatedly must give **technical replicates**: runs that
differ only in their randomness. Taking the configuration back out of a run's output
and running it again must **reproduce** that ru... |
e250b2b63e40fa9292d3c4156d0339942c2c9f7d3d86b982ec9cbfe8f75778ea | Python | 15,423 | 413 | from collections import defaultdict
from concurrent.futures import ProcessPoolExecutor, as_completed
from subprocess import run
from typing import Callable, Tuple, Union
import pandas as pd
from ._doc import *
from ._open import open_allc, open_gz
from .utilities import (
binary_count,
genome_region_chunks,
... |
41722dbdf03afb9ca491c45ad5811d6a8c849adfd40c0180bbb8c5a4ccc7e2c9 | Python | 15,425 | 422 | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 2 14:28:44 2019
@author: aaussel
"""
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 *
def generate_deepSI_and_gran_layers(theta_phase,N_SI,N_RS_gran,N_SI_gran,run... |
ea56a13ab830dabff5ddeb0814dd5ea4bd079330cc7345b908a964096429a6ed | Python | 15,425 | 324 | import logging
import os
import shutil
from typing import (
TYPE_CHECKING,
Union,
)
from galaxy.tool_shed.galaxy_install.client import InstallationTarget
from galaxy.tool_shed.util import hg_util
from galaxy.tool_util.data import (
DataTableColumnMismatch,
TabularToolDataTable,
)
from galaxy.util impor... |
61568a0c933251dd2cdd6b38a07e5f17a7a256248b13edd21c42219f6d47ace8 | Python | 15,426 | 502 | """Provides explicit constructions of expander graphs."""
import itertools
import networkx as nx
__all__ = [
"margulis_gabber_galil_graph",
"chordal_cycle_graph",
"paley_graph",
"maybe_regular_expander",
"maybe_regular_expander_graph",
"is_regular_expander",
"random_regular_expander_graph... |
d4b14d1e0911e82757c53a4d4fc8f841d439be7e6bec14f33e5c4562b126eff1 | Python | 15,440 | 396 | import collections
import typing
from dataclasses import dataclass
__all__ = ["Config"]
@dataclass(init=False, eq=False, slots=True, kw_only=True, match_args=False)
class Config:
"""The base class for NetworkX configuration.
There are two ways to use this to create configurations. The recommended way
is... |
8499cc53699224c3c4a5807ea3b1dfbc4332e30c5de43345d21a00d27bb4dc47 | Python | 15,454 | 450 | import matplotlib.pyplot as plt # To plot
from scipy.optimize import curve_fit
from pylab import *
import numpy as np
import random
import math
import time
import os
import glob
import copy
plottest = False # True
Nrms = 10 # Number of averages
DR_estimates = np.zeros(Nrms)
Dz_es... |
dfb4e5a52c2048e5916d3cd16cbaf175d8e49a1f4eddfd85d812733d2138c638 | Python | 15,457 | 436 | """
Initially adapted from
https://github.com/funkey/gunpowder/blob/master/gunpowder/torch/nodes/train.py
Changes before porting into this package are recorded at
https://github.com/kirchhausenlab/gunpowder/blob/patch-1.1.4-logging/gunpowder/torch/nodes/train.py
"""
import logging
from typing import Dict, Union, Opti... |
0b138a020b5dca7c0d5c1b8c677af435fcaa79a061bdebdf1c8831464ccb839b | Python | 15,470 | 456 | # 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... |
6b321f4e86019cf99988267cbe8252272e2c58b0abb824cb3f0d51e485baa605 | Python | 15,486 | 483 | 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... |
baebe3d196a0aa521b3ee5e75f9258aa6b83a177f81846480890810b025ff5f8 | Python | 15,544 | 375 | import os, sys, math, random
import esm, torch, string, time
import numpy as np
from subprocess import Popen, PIPE, STDOUT, run
from Bio import SeqIO
from data import Alphabet
import itertools
from typing import List, Tuple
import argparse
from constants import *
## DBTOOL_FLAG
# db_tool_dir='/storage/htc/bdm/zhiye/DNC... |
2c39ca6d1c9cc8e617dafddfb02fa9d5fd5a0425cc20a81651d023d666f6c6b6 | Python | 15,550 | 391 | #!/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 json
import warnings
from copy import deepcopy
from datacla... |
a4f4705b234bd9020398b6ca03ba21bacaf21f70b2f56fea4978616de58192ad | Python | 15,558 | 405 | """Auxiliary module for bioimageio format export
Example usage:
```bash
#!/bin/bash
# Define default paths and parameters
DEFAULT_CHANNELS="1 0"
DEFAULT_PATH_PRETRAINED_MODEL="/home/qinyu/models/cp/cellpose_residual_on_style_on_concatenation_off_1135_rest_2023_05_04_23_41_31.252995"
DEFAULT_PATH_README="/home/qinyu/... |
55d9cd7e188d900adcb391e0dffd6587efc755528d89426fb6075020c4100589 | Python | 15,567 | 455 | from brian2lava.utils.utils import find_func_args_in_dict
from brian2lava.utils.files import scrap_folder
from importlib.machinery import SourceFileLoader
import numpy as np
from brian2 import get_device
from brian2lava.utils.const import LOIHI2_SPECS, EPSILON
import typing as ty
class F2F:
"""
Static class that ca... |
0295c0ca393004b77e87c3d4f52790fa14a8443e3192c56631b22eb7afb534c7 | Python | 15,569 | 459 | '''
The modules of PIGNPI, with different activation functions
'''
import numpy as np
import torch
from torch import nn
from torch.functional import F
from torch.optim import Adam
from torch_geometric.nn import MetaLayer, MessagePassing
from torch.nn import Sequential as Seq, Linear as Lin, ReLU, GELU, Tanh, Softplus,... |
aba9b0133775dbc64b9d8d8a8a1f9d2cf0667a2afad6c626109e97a1055b2cf8 | Python | 15,594 | 350 | import logomaker
from matplotlib import pyplot as plt
from matplotlib.patches import ArrowStyle
from matplotlib.ticker import FormatStrFormatter
import networkx as nx
import pandas as pd
import numpy as np
import tensorflow as tf
from learnMSA import legacy as msa_hmm # TODO fix import
import itertools
import seaborn a... |
cdca5a32df85d2a5ca3f4e523e90695d60134aa3ed35f089f95526ad2ab0994b | Python | 15,596 | 446 | import pytest
import torch
import torch.nn as nn
from spikingjelly.activation_based import neuron, op_counter
def test_lemaire_energy_report_uses_single_authoritative_total():
model = nn.Sequential(nn.Linear(8, 8, bias=False), neuron.IFNode())
x = torch.rand(4, 8)
report = op_counter.estimate_lemaire_en... |
8c4932f003b2e8e8a72c389e97772351235f6029778bf0f5a458a66029f87579 | Python | 15,619 | 437 | """
Shared code for galaxy and tool shed migrations.
"""
import abc
import logging
import os
import sys
import urllib.parse
from argparse import (
ArgumentParser,
Namespace,
)
from collections.abc import Iterable
from typing import (
cast,
Optional,
Union,
)
import alembic
from alembic import comm... |
a55b576629526ea583c7dc13da9d5c951d6c90adaf56ecf3c516db8169bbf25c | Python | 15,622 | 393 | import logging
import numpy as np
import pandas as pd
import pybedtools
import tensorflow as tf
from maxatac.utilities.constants import INPUT_CHANNELS, INPUT_LENGTH, ALL_CHRS
from maxatac.utilities.system_tools import Mute
with Mute():
from tensorflow.keras.models import load_model
from maxatac.utilities.geno... |
e0446da4d60a8a049d5caada4dc4861dcecc1d16e8a81c49f67f88e40ebd1f8c | Python | 15,645 | 453 | import matplotlib.pyplot as plt # To plot
from scipy.optimize import curve_fit
from pylab import *
import numpy as np
import random
import math
import time
import os
import glob
import copy
plottest = False # True
Nrms = 10 # Number of averages
DR_estimates = np.zeros(Nrms)
Dz_es... |
f07c8f386c8defa5cabbb8c3ec55b010f5fdd4563cfd4b009c731bf25fe249e5 | Python | 15,645 | 442 | from __future__ import annotations
import re
from collections.abc import MutableMapping
from functools import partial
from pathlib import Path
from types import MappingProxyType
from typing import TYPE_CHECKING, cast
import h5py
import numpy as np
import pandas as pd
from scipy import sparse
from anndata._warnings i... |
48a07214b0a4faae2ca63761dc0b72729db8ea042837455cb76c1e77bbd20b45 | Python | 15,646 | 451 | #!/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 Iterator
from dataclasses import dataclass, field
from typing import Any
i... |
176c69e0a36baee27ac8ab744f0ee80b4e6a4c99c6723ab91abc8e427fc63a7b | Python | 15,649 | 380 | import matplotlib
matplotlib.use('Agg')
# above 2 lines set the matplotlib backend to 'Agg', which
# enables matplotlib-plots to also be generated if no X-server
# is defined (e.g., when running in basic Docker-container)
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
from torchv... |
51f86a8d8b19debde9ac4abc7d004815a7f2a43bec5fa4cda86670a361f55cbd | Python | 15,664 | 530 | import pytest
from clpipe.postprocutils.image_workflows import *
from clpipe.postprocutils.confounds_workflows import build_confounds_processing_workflow
def test_spatial_smoothing_wf(
artifact_dir, request, sample_raw_image, sample_raw_image_mask, helpers
):
test_path = helpers.create_test_dir(artifact_dir,... |
40e897ef1561ff542d412ce9917b84db82cb6c3527286b2ff56d91eb3801d7b4 | Python | 15,671 | 354 | import os
import unittest
from os.path import abspath, dirname, getmtime, isfile, join
import nest
import numpy as np
from bsb import Scaffold, parse_configuration_content
from bsb.services import MPI
from bsb_test import NumpyTestCase, RandomStorageFixture
from pynestml.exceptions.invalid_path_exception import Invali... |
4678d418917ed2b150508f3ee12089230d11b254154563353e809555f4ca75db | Python | 15,679 | 501 | import itertools as it
import random
import pytest
import networkx as nx
from networkx.algorithms.connectivity import k_edge_augmentation
from networkx.algorithms.connectivity.edge_augmentation import (
_unpack_available_edges,
collapse,
complement_edges,
is_k_edge_connected,
is_locally_k_edge_con... |
df52315c51127ce0bc3e5b85d54f7587dd0b6f04dc6c966a9e8b91f7d1541350 | Python | 15,685 | 428 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from scipy.linalg import block_diag
from cogdl.layers import SAGELayer
from cogdl.utils import split_dataset_general
from .. import BaseModel
class EntropyLoss(nn.Module):
# Return Scalar
def forward(self, adj, anext, s_l)... |
d2c581ac90e5984fbddb22321d798523a9afc1efa6c61a8daa298370910635ab | Python | 15,688 | 458 | # 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... |
c11fd473d11c5918d5de56fb0b347e170fd0bff476150232c77ddc54acc3ffcd | Python | 15,689 | 463 | import logging
import os
import sys
import json
import yaml
#
import configargparse as argparse
import torch
import numpy as np
import re
import gunpowder as gp
import incasem as fos
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
logging.getLogger('gunp... |
f7af66cd791d999ff6e5ce147bc85f260294b02df5d34f524f21d496dd0b2ef4 | Python | 15,689 | 484 | import os
import numpy as np
import pandas as pd
import scipy as sp
from statsmodels.stats import multitest
import nibabel as nib
import wget
def get_pdist_clusters(coords, labels, method='mean'):
unique, counts = np.unique(labels, return_counts=True)
n_clusters = len(unique)
dist = np.zeros((n_clusters, ... |
eaf4be737c4c7bdeca4253cc3661f5e0e323e186e0256aae897603fec7521823 | Python | 15,692 | 309 | # -*- coding: utf-8 -*-
"""
One-time geocoder for SimBA use-case institutions.
Reads the AUTHOR INSTITUTIONS column from the public studies Google Sheet,
cleans/normalises the free-text names (typos, abbreviations, duplicates),
geocodes the survivors via OpenStreetMap Nominatim (rate-limited + cached),
and writes:
... |
f57a47d10d1280ccd2819dfa09aed65ec4edc950b2455f31be20d971136a6c97 | Python | 15,693 | 459 | # 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... |
9a7ac70cb5af6bae8a527ce891d5f9d1859349b4cca5453646f5e4830262ffd4 | Python | 15,708 | 354 | import os.path
import pytest
from fanc.pairs import SamBamReadPairGenerator, ReadPairs, UnmappedFilter, FragmentReadPair, \
FragmentRead, InwardPairsFilter, OutwardPairsFilter, ContaminantFilter, QualityFilter, \
BwaMemQualityFilter, ReDistanceFilter, SelfLigationFilter, LazyFragment, LazyFragmentRead, \
PC... |
4bdb02b9418fe4cdb514e5cdcbbe4bb7b3a1036328377b45076c8a586476aaa9 | Python | 15,713 | 540 | # -*- coding: utf-8 -*-
"""
Topology3d
==========
Defines basic 3d discrete topology utils.
Note
----
The definitions are compatible with a separable convolutional kernel with
weights along the 3 dimensions given by:
>>> [[(2**(3**d))**k for k in range(3)] for d in range(3)]
"""
__author__ = 'Christoph Kirst... |
456c08c81876b5c6309c58321178c70133ed3f5d22825ea752fb137ef025bd97 | Python | 15,714 | 394 | """test cell_densities"""
import json
import warnings
from pathlib import Path
import numpy as np
import numpy.testing as npt
import pandas as pd
import pandas.testing as pdt
import pytest
import yaml # type: ignore
from click.testing import CliRunner
from voxcell import VoxelData # type: ignore
import atlas_densi... |
07b2d80fe1c927ef5334c4d78a465da84fd55366417def30a21b0f3c5348f4f2 | Python | 15,745 | 554 | '''
Implementation of the type system based on Siek and Vachharajani,
"Gradual Typing with Unification-based Inference", DLS 2008.
'''
import inspect
import operator
import sys
import types
from itertools import islice
from typing import (AbstractSet, Any, Callable, Generic, Iterable, Mapping,
Seq... |
5fff4552eaefb3c0ba39906d755d4e490e063d626d50bcd6a3fd3b896d969f0f | Python | 15,752 | 481 | """ Module containing custom layers
Code taken from -> https://github.com/akanimax/BMSG-GAN
"""
import torch as th
# =========================================================
# Mapping Network for disentangling z-space
# =========================================================
class MappingLayers(th.nn.Module):
... |
4f88ab67f7bf6ed1b489afcef2b9e0ec7217daafc16c208fff10d12f0ff14269 | Python | 15,777 | 479 | """
Translation from First Order Logic to Horn clauses.
This module defines the HornClause expression class and algorithms to translate
First Order Logic expressions to a union of Horn clauses. Between the
algorithms here are implemented a translation from FOL sentences to an
equivalent expression in safe range norma... |
3ffd7828cdb9a30528fcf44e795250998d8df75c00595e402abb2c6c619c0b4d | Python | 15,794 | 467 | """
Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
Data structure and functions for region-based file manipulation, such ad BED, GFF and GTF.
Originally copied from tenkit and simplified.
"""
import bisect
import json
import os
import shutil
import subprocess
import sys
import tempfile
from collections ... |
0c058bc6fdf6f0c53ed5b74c3083b9638bd527c2f8f9927c15f13092bafb56f3 | Python | 15,812 | 393 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 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 Licens... |
fa423ff72f7d230c9bbfa5b2f0817c3ee81597ad4178c04412a1b0ac360d0ae7 | Python | 15,823 | 466 | """
SSL with SNI_-support for Python 2. Follow these instructions if you would
like to verify SSL certificates in Python 2. Note, the default libraries do
*not* do certificate checking; you need to do additional work to validate
certificates yourself.
This needs the following packages installed:
* pyOpenSSL (tested w... |
a7a9577ee4459752216e474894261b8b41bf20f6ae27871c86483182fd848a06 | Python | 15,825 | 412 | import json
import sys
import time
from pathlib import Path
import numpy as np
import tensorflow as tf
from learnMSA.align.align_hits import HitAlignmentMode
import learnMSA.model.training_util as training_util
from learnMSA import Configuration
from learnMSA.align.alignment_model import AlignmentModel
from learnMSA.... |
20a4e5d84bef653eab62c00913fd9a0a410d438df4bc878f5f1104fa2a429abc | Python | 15,826 | 367 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import itertools
import math
from collections.abc import Iterator, Sequence
from typing import TYPE_CHECKING, cast
import attrs
import datumaro as dm
import numpy as np
from shapely import make_valid
from shapely.... |
d4d765857b861205241cfa38ec4a0d4d650c7dd793a62bfb04154cf6dcb68afc | Python | 15,831 | 483 | """Test sequences for graphiness."""
import heapq
import networkx as nx
__all__ = [
"is_graphical",
"is_multigraphical",
"is_pseudographical",
"is_digraphical",
"is_valid_degree_sequence_erdos_gallai",
"is_valid_degree_sequence_havel_hakimi",
]
@nx._dispatchable(graphs=None)
def is_graphica... |
572935b2d4ffde5645d5b5801866228705fe5745a8d4bf34fba1d77ee1d03a37 | Python | 15,842 | 380 | import os
import json
from skopt import gp_minimize
from skopt.utils import use_named_args
from skopt.space import Real, Categorical, Integer
import numpy as np
import concurrent.futures
from copy import deepcopy
from MolRep.Utils.logger import Logger
from MolRep.Utils.config_from_dict import Config
import multipro... |
17f60bb31e38da6463b7cd3f580483cbd7f1e396a8a6af1c8899711d8bf9c194 | Python | 15,847 | 510 | """
For tests using dask
"""
from __future__ import annotations
import re
import warnings
from pathlib import Path
from typing import TYPE_CHECKING, cast
import h5py
import numpy as np
import pandas as pd
import pytest
import zarr
from zarr.storage import MemoryStore
import anndata as ad
from anndata._core.anndata ... |
f0133e1e5fcc7b6371c6332d0dc1ad95a042fce0aa44baa9589a59b0fbb3cc4c | Python | 15,852 | 392 | import numpy as np
from numba import jit
from tqdm import tqdm
from scipy.optimize import linear_sum_assignment
from collections import namedtuple
from csbdeep.utils import _raise
matching_criteria = dict()
def label_are_sequential(y):
""" returns true if y has only sequential labels from 1... """
labels = n... |
70340e96dd4937483b44e01c27e89cc2b3167c2dcf31e986bbe982bdee111d95 | Python | 15,854 | 392 | import numpy as np
from numba import jit
from tqdm import tqdm
from scipy.optimize import linear_sum_assignment
from collections import namedtuple
from csbdeep.utils import _raise
matching_criteria = dict()
def label_are_sequential(y):
""" returns true if y has only sequential labels from 1... """
labels = n... |
e1f163ee733f09e236b72284798efcd22d2c38af06c8e018c18ad1c0a8be4d75 | Python | 15,855 | 363 | # Copyright (C) 2021-22 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
# See: https://spdx.org/licenses/
import numpy as np
from lava.magma.core.model.py.connection import (
LearningConnectionModelFloat,
LearningConnectionModelBitApproximate,
)
from lava.magma.core.sync.protocols.loihi_protocol imp... |
3723a2cb0ce0fff5f63f2f72cdbdf43f88ad4ea97e389f66455ccd1ba6e6fd0d | Python | 15,864 | 481 | 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... |
d585cd6249975b801d3056e4ae8e7c018a63eee5f563801000d99443ba80307c | Python | 15,869 | 469 | import os
import shutil
import subprocess
import sys
import typing
import warnings
from functools import lru_cache, wraps
from pathlib import Path
from shutil import copy2 as copy_file
from shutil import rmtree as rmdir
from importlib_metadata import entry_points
from . import _mpi
from ._fs import (
clear_cache,... |
f2238bc72bcffd391c8b98d610641eddef43cb30f5ba5a74e7e2264080c6165f | Python | 15,871 | 423 | import os
import time
import warnings
from io import BytesIO
from json import JSONDecodeError
from pathlib import Path
from urllib.parse import unquote_plus
from zipfile import ZIP_DEFLATED, ZipFile
import numpy as np
import requests
from alpineer import image_utils, io_utils, load_utils, misc_utils
from tifffile impo... |
ab37bb75381c72e024a19c510dfcf9684a9b0baa7245ee136da4093632601073 | Python | 15,877 | 363 | #!/usr/bin/env python
"""Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
Chunks up the input fastq data into sets of matched R1, R2, SI, and BC fastq files.
Input args:
sample_id - Arbitrary string labeling the sample
input_mode - one of BCL_PROCESSOR or ILMN_BCL2FASTQ. BCL_PROCESSOR uses interleaved read... |
922c4b6a88fb4cfacf28c4484af8e4c91c9e41fd43a265f747dddd369253d2ba | Python | 15,881 | 448 | """This modules contains the functions that drive the tool linting framework.
LintContext: a container for LintMessages
LintMessage: the actual message and level
The idea is to define a LintContext and to apply a linting function ``foo`` on a
``target``. The ``level`` (defined by ``LintLevel``) determines which linti... |
ac06d6d2ee208192552235af4db0dfea827883a0bc4d82d6ea7db07fe881fdd0 | Python | 15,890 | 411 | #!/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 math
from copy import deepcopy
import numpy as np
import numpy.typing as npt
import torch
from... |
6492ae58f334bd59298a6f875ad09699882ee9fba02289e0eea207195de58faf | Python | 15,893 | 390 | #!/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 unittest.mock import patch
from ax.adapter.registry import Generators
from ax.core.arm import A... |
806d9c6599b837b3d0857baae67c59ab54bf3a65bad7ae35add467ac3897ff0b | Python | 15,900 | 466 | """
Functions for constructing matrix-like objects from graph attributes.
"""
import networkx as nx
__all__ = ["attr_matrix", "attr_sparse_matrix"]
def _node_value(G, node_attr):
"""Returns a function that returns a value from G.nodes[u].
We return a function expecting a node as its sole argument. Then, in... |
7b0eee04858811a8a47bcaf536b6c7fa62213775bfcaf9444a122ba1d9ef203a | Python | 15,904 | 483 | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 2 14:28:44 2019
@author: aaussel
"""
from brian2 import *
from scipy import signal
from cells.RS_LIP import *
from cells.FS_LIP import *
from cells.SI_LIP import *
from cells.IB_soma_LIP import *
from cells.IB_axon_LIP import *
from cells.IB_apical_dendrite_LIP import *... |
9322b5d6714322ef8473ffba9881b5fe8984631695cbeb79c3d1ba42594fa151 | Python | 15,905 | 406 | import numpy as np
import networkx as nx
from collections import defaultdict
from gensim.models.keyedvectors import Vocab # Retained for now to ease the loading of older models.
# See: https://radimrehurek.com/gensim/models/keyedvectors.html?highlight=vocab#gensim.models.keyedvectors.CompatVocab
import random
import m... |
983329776033f3e54457af98cce0d2b0d562c5f515784c601475b55bad513b76 | Python | 15,906 | 456 | """
Created on Jun 11, 2018.
Provides different methods for frequency filtering of provided signals.
:author: voodoocode
"""
import scipy.signal
import scipy.fftpack
import scipy.fft
import math
import numpy as np
def butter(data, f_low, f_high, fs, order, zero_phase = True):
"""
Create a butterworth filter... |
69cbb90ba65f8a02adbbb4071eef77a997ecaef5d6505a95de2d0923e57457ac | Python | 15,909 | 445 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import math
from typing import final
import pandas as pd
from ax.adapter.base import Adapter
from ax.analysis.analysis impor... |
72d488c8d8bcf7375d2582a407dfe83093b57e8e407ae4396f79703ced64ea6e | Python | 15,911 | 438 | # 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... |
402546f731249873e11aefd64db119967caa3eccf80fb5aa8d0ea5a68596409e | Python | 15,914 | 483 | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 2 14:28:44 2019
@author: aaussel
"""
from brian2 import *
from scipy import signal
from cells.RS_LIP_altd import *
from cells.FS_LIP_altd import *
from cells.SI_LIP import *
from cells.IB_soma_LIP import *
from cells.IB_axon_LIP import *
from cells.IB_apical_dendrite_LI... |
558391fd8e4131eb257c223b4af6dbb6a0061a9a9386fe1cfbf7664d07fced6f | Python | 15,914 | 483 | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 2 14:28:44 2019
@author: aaussel
"""
from brian2 import *
from scipy import signal
from cells.RS_LIP_alte import *
from cells.FS_LIP_alte import *
from cells.SI_LIP import *
from cells.IB_soma_LIP import *
from cells.IB_axon_LIP import *
from cells.IB_apical_dendrite_LI... |
7eca4fa9e009db17a40ce1b78d6a66db12d27b76ce2f764083e2efa13453d84b | Python | 15,926 | 541 | import itertools
try:
from itertools import izip as zip
except ImportError:
pass
import random
import collections
import progressbar
import tables as t
import re
import os
import errno
from builtins import object
from datetime import datetime
from Bio import Restriction
from Bio.Seq import reverse_complement
fr... |
54eb64817ddafef362e8fb9a7946dc6fe968e2654c1cd9de22117b9f06b5cb21 | Python | 15,930 | 367 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from __future__ import annotations
from typing import TYPE_CHECKING
from ax.adapter.data_utils impor... |
b809311e3c1459db430dd514c69dc6b04115c2a9437882b6c94cf55c27f8fdca | Python | 15,935 | 463 | import pytest
import networkx as nx
comm = nx.community
@pytest.fixture(params=[nx.Graph, nx.MultiGraph])
def G(request):
LFR_graph = nx.LFR_benchmark_graph(
250, 3, 1.5, 0.009, average_degree=5, min_community=20, seed=10
)
G = request.param(LFR_graph)
# duplicate edges if multigraph
G.a... |
1031db0364c3825a803f397235a258b8c0c42c0ee7bbbc009d96b6aaf9fe2325 | Python | 15,937 | 491 | 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... |
af8f183b5177ccf7cbcc8abd2e2dbf428c9695382e66f4538589930a7c27b4b2 | Python | 15,952 | 449 | from pathlib import Path
from typing import Generator
import numpy as np
import pytest
from learnMSA import Configuration
from learnMSA.config import InputOutputConfig, TrainingConfig
from learnMSA.model.context import LearnMSAContext
from learnMSA.model.training_util import get_adaptive_batch_size
from learnMSA.util... |
d3fa09038c8af9473d88f427c521d378a9ff01d8a97d11cfa9dab2ef5583d028 | Python | 15,953 | 459 | import glob
import os
import numpy as np
import torch.utils.data
import logging
import healpy as hp
from orbit_demo.structure import MolecularSurface
from orbit_demo.datasets import ToughM1, ProSPECCTs
import orbit_demo.utils.geometry
import random
logging.getLogger('pyembree').disabled = True
def rotmat(a, b, c, ho... |
7b27845cb6949a8b20d08ff0630fa2c69793c15dc9e1cbc0cc15a773855b5484 | Python | 15,958 | 446 | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 9 16:00:59 2022
@author: Estefany Suarez
"""
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import os
import random
import numbers
random.seed(1111)
import numpy as np
import pandas as pd
import scipy.stats as stats
... |
69baf397be96fe814a034defb3c8a70fa66ceed83981e4960fe7c2a225b6f6c9 | Python | 15,969 | 356 | """Identify genes essential for metabolic tasks in a model.
Python port of the RAVEN checkTasksGenes / getTaskEssentialGenes logic used by
the gene-essentiality workflow. A gene is essential for a task when knocking it
out turns an otherwise-feasible task infeasible.
Performance
-----------
The model is copied exactl... |
f5a453d9210eefbe42dc8f8bde61ee002b4304ff716e4f42f7bbccd646c61c50 | Python | 15,970 | 326 | """
Created on Feb 22, 2024.
@author: voodoocode
"""
import numpy as np
import scipy.sparse
import nibabel.freesurfer
import os
import finnpy.src_rec.utils # @UnresolvedImport
class Subj_to_fsavg_mdl():
"""
Container class, populated with the following items.
trans : numpy.ndarray, shape(valid_su... |
6aff589641f3e7b4559a70f2f0d00b14e0fbbd0f9a944b0c18d170b80d3a3d51 | Python | 15,975 | 360 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from __future__ import annotations
from collections import defaultdict
from typing import TYPE_CHECKI... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.