sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
84951cf78721053bbcc36687e02f90023b28499f00970638782b50c8cc48f4ae | Python | 1,310 | 50 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script used on our version of the experiment used by Santoro et al. (2017) to
generate the list of onsets for the interrupter fMRI acquisitions
author: Juan Jesus Torre Tresols
e-mail: juan-jesus.torre-tresols@inria.fr
"""
import os
import numpy as np
import pandas ... |
42c3f01af3ae916696c56e29b9f3b647edaba95db7d5bfb98d7bc301e7ff5ce4 | Python | 1,311 | 48 | def CampyParams():
"""
Default parameters for campy config.
Omitted parameters will revert to these default values.
"""
params = {}
# Recording default parameters
params["videoFolder"] = "./test"
params["frameRate"] = 100
params["recTimeInSec"] = 10
params["numCams"] = 3
params["cameraNames"] = ["Camera1",... |
7b2ed337c3af99635a68c20ba66cca416012666074a6c09b702b293fea40c00a | Python | 1,312 | 42 | from .sequencelayer import SequenceLayer
from .notecluster import NoteCluster
from .synapse import Synapse
class NoteSequenceLayer(SequenceLayer):
'''
classdocs
'''
def __init__(self, neutype):
'''
Constructor
'''
SequenceLayer.__init__(self, neutype)
def addNewGr... |
b13370af0a12ae09f3ebed9234eece0f104a7d22c3483b8c96c22c53c3330a15 | Python | 1,312 | 33 | from agent.learners.ToCMLearner import ToCMLearner
from configs.ToCM.ToCMAgentConfig import ToCMConfig
# train->agent_configs = [ToCMLearnerConfig(ToCMConfig),] -> class ToCMConfig(Config) -> Config
class ToCMLearnerConfig(ToCMConfig): # 从ToCMConfig继承,有输入维度、输出维度、隐层维度、隐层层数、动作维度、动作隐层维度、动作隐层层数、
def __init__(self, e... |
cee3f0802d228c5da80d100e27a23d24a85a26e857140ca00722d06a856d4f9e | Python | 1,312 | 41 | """
This module is home to specific dtypes related functionality and their classes.
For more general information about dtypes, also see `numpy.dtype` and
:ref:`arrays.dtypes`.
Similar to the builtin ``types`` module, this submodule defines types (classes)
that are not widely used directly.
.. versionadded:: NumPy 1.2... |
a222dfd38fb4a0a79f51464a067b54a19dd4cb821d64d2933c0d19d71785ee4c | Python | 1,313 | 40 | import os
import numpy as np
import pandas as pd
def convert_distance_to_adjacency(
dist_df, keep_proportion=None, threshold=None, convert_to_COO=False
):
if keep_proportion is not None:
# Total possible edges = n*(n-1)/2
total_edges = dist_df.shape[0] * (dist_df.shape[0] - 1) / 2
# E... |
744e964536e572ae3424a8572500ec3b0be114f26cb63ffc71e8222ed847d24b | Python | 1,314 | 43 | from pandas.core.arrays.arrow import ArrowExtensionArray
from pandas.core.arrays.base import (
ExtensionArray,
ExtensionOpsMixin,
ExtensionScalarOpsMixin,
)
from pandas.core.arrays.boolean import BooleanArray
from pandas.core.arrays.categorical import Categorical
from pandas.core.arrays.datetimes import Dat... |
8a0f3ca860120504911bbebc044df61cd780a212e7a1e5fc78f96ee1e2d2c3ae | Python | 1,315 | 44 | import glob
import json
import math
import os
import numpy as np
import matplotlib.pyplot as plt
from copy import deepcopy
from . import utils
def get_template_results(cfg):
return {"config": cfg, "results": []}
def save_results(results, label):
del results["config"]["device"]
folder_path = os.path.jo... |
b2ebee73c892bde2dd3c3746d4f22ed0fdad1ba18269125114afd1e15b00406d | Python | 1,315 | 54 | """
Demonstrate the failure of rem when qubit number is much larger than 1/p
"""
from functools import partial
import numpy as np
import tensorcircuit as tc
def simulate_engine(p, ans):
fans = ""
for a in ans:
if p > np.random.uniform():
if a == "0":
fans += "1"
... |
cd237ff4ea73ee6f62b3d797eccb388eb83b2174af1ea312cfba4001f479b510 | Python | 1,315 | 49 | # coding: utf-8
# See notebook:
# https://github.com/paninski-lab/yass-examples/blob/master/batch/reader.ipynb
"""
Reading large files with RecordingsReader
"""
import os
import numpy as np
from yass.batch import RecordingsReader
# generate data
output_folder = os.path.join(os.path.expanduser('~'), 'data/yass')
w... |
f1e9a4f1ff54670f873713eba769acd9605bafb46dff532467f6447fdf2fed5d | Python | 1,316 | 54 | import math
import torch
from torch import nn
class BesselBasis(nn.Module):
r_max: float
prefactor: float
def __init__(self, r_max, num_basis=8, trainable=True):
r"""Radial Bessel Basis, as proposed in DimeNet: https://arxiv.org/abs/2003.03123
Parameters
----------
r_m... |
67c5b72a3f4cf358af066fa65ef1210536b2d8b9a06ec648b0cfccbd2bdfa413 | Python | 1,317 | 49 | from pathlib import Path
import nablaDFT
import pytest
from nablaDFT.dataset import PyGHamiltonianNablaDFT, PyGNablaDFT
from schnetpack.data import ASEAtomsData
from schnetpack.transform import ASENeighborList, CastTo32
@pytest.fixture()
def dataset_pyg():
datapath = Path(nablaDFT.__path__[0]) / "../tests/data"
... |
f327820cb9a5275645ce4cd839974a70f7fd606c8ddc7e12c0c292205de1ba69 | Python | 1,318 | 45 | import torch
from torch import nn
from copy import deepcopy
from spikingjelly.activation_based import layer, functional
class DVSGestureNet(nn.Module):
def __init__(self, channels=128, neuron: callable = None, **kwargs):
super().__init__()
conv = []
for i in range(5):
... |
06eee4aa49a9ba784bb23e710aef204ffdb992da0f5dc4a7c1ef151e4d46989a | Python | 1,320 | 36 | """Verify certificates using native system trust stores"""
import sys as _sys
if _sys.version_info < (3, 10):
raise ImportError("truststore requires Python 3.10 or later")
# Detect Python runtimes which don't implement SSLObject.get_unverified_chain() API
# This API only became public in Python 3.13 but was avai... |
d21770fa14485c00b3078da06a940e7cdb0238e2964b42af540c05b008ba21c5 | Python | 1,320 | 46 | """
This is the generator G for ESPRESO. It learns a PSF and also can apply the PSF.
"""
import torch
import math
from torch import nn
import torch.nn.functional as F
class ConvReLU(nn.Module):
def __init__(self, in_c, out_c, kernel_size):
super().__init__()
self.body = nn.Sequential(
... |
1c9c679d8fa0343514f568e4843ded8f266bbe4bc369b0238518e7d439165706 | Python | 1,321 | 30 | # License: GNU Affero General Public License v3 or later
# A copy of GNU AGPL v3 should have been included in this software package in LICENSE.txt.
# for test files, silence irrelevant and noisy pylint warnings
# pylint: disable=no-self-use,protected-access,missing-docstring
import unittest
from antismash.common imp... |
cec3fe29dfd16b51e064acabd757f873904fcd6b01a1c4414b79429930765839 | Python | 1,322 | 56 | from numpy import tri
import pandas as pd
import sys
import numpy as np
sys.path.append("../")
emotion = None # pd.read_csv("somePath/EMOTION_run1_TAB.txt", sep='\t')
procedures = emotion["Procedure"].to_numpy()
trialOnsetTimes = emotion["ExperimenterWindow.OnsetTime"].to_numpy()
initialOnsets = emotion["SyncSlide.On... |
87b1b8242cf2037097b4d03abc05d3ed894ae6e7fccdaeac1518b56e5513a902 | Python | 1,324 | 36 | import torch
import torch.nn.functional as F
def sample_gumbel(shape, eps=1e-20):
U = torch.rand(shape).cuda()
return -torch.autograd.Variable(torch.log(-torch.log(U + eps) + eps))
def gumbel_softmax_sample(logits, temperature, eps=1e-10):
sample = sample_gumbel(logits.size(), eps=eps)
y = logits + ... |
09938c442e105e4b5e99253d6e5e955df3e64891862845d4c1d76302879d0200 | Python | 1,327 | 43 | from xgboost import XGBClassifier
from shap.datasets import adult
from shap.explainers import ExactExplainer
from shap.maskers import Partition
class ExactSuite:
# Adapted from tests/explainers/test_exact.py
max_samples = 100
def setup(self):
self.model = XGBClassifier(tree_method="exact", base_... |
202ac8001b17f2530592e155b0996887d42cc41aac0d6a8112b8184a6e1e7b41 | Python | 1,327 | 46 | from __future__ import annotations
from ..utils._typed_cache import typed_cache
from ..selections._list_words import list_words
@typed_cache
def count_words(
text: str,
rm_punctuation: bool = True,
split_contractions: bool = False,
split_hyphens: bool = False,
) -> int:
"""Count the number of wor... |
53adca31f37ccc301dfe39ef3244b637e76f3f852249107d09eb36f74a8b357c | Python | 1,327 | 45 | import os
from numpy.distutils.fcompiler import FCompiler
compilers = ['LaheyFCompiler']
class LaheyFCompiler(FCompiler):
compiler_type = 'lahey'
description = 'Lahey/Fujitsu Fortran 95 Compiler'
version_pattern = r'Lahey/Fujitsu Fortran 95 Compiler Release (?P<version>[^\s*]*)'
executables = {
... |
147e2ec30eab7b9d0e513fc17dda1648b08352a93c2ef990dbf8f94611799cb4 | Python | 1,330 | 42 | # http://g95.sourceforge.net/
from numpy.distutils.fcompiler import FCompiler
compilers = ['G95FCompiler']
class G95FCompiler(FCompiler):
compiler_type = 'g95'
description = 'G95 Fortran Compiler'
# version_pattern = r'G95 \((GCC (?P<gccversion>[\d.]+)|.*?) \(g95!\) (?P<version>.*)\).*'
# $ g95 --vers... |
01072213b29b433cce48da7b5342950789537611d0a7e0867f2b99fd0da4bddc | Python | 1,331 | 35 | from rdkit import Chem
import os
elements = set(['B', 'Br', 'C', 'Cl', 'F', 'H', 'I', 'N', 'O', 'P', 'S', 'Si'])
for filename in os.listdir('sources'):
if filename.endswith('.sdf'):
print('Processing', filename)
inputFile = os.path.join('sources', filename)
outputFile = inputFile[:-4]+'.tx... |
3311dac7a97de32aa54d5665780a86efb20b11b5bac14e68b0f707cf127ce67b | Python | 1,331 | 76 | import numpy as np
import numpy.typing as npt
AR_f8: npt.NDArray[np.float64] = np.array([1.0])
AR_i4 = np.array([1], dtype=np.int32)
AR_u1 = np.array([1], dtype=np.uint8)
AR_LIKE_f = [1.5]
AR_LIKE_i = [1]
b_f8 = np.broadcast(AR_f8)
b_i4_f8_f8 = np.broadcast(AR_i4, AR_f8, AR_f8)
next(b_f8)
b_f8.reset()
b_f8.index
b_... |
add00dea05f8db4775e43681847bcc305162724d69aa473f620e2ad7d1491d95 | Python | 1,331 | 46 | from asap.dataloader.bounded import BoundedDataset
from typing import List
class WGDataset(BoundedDataset):
def __init__(
self,
genome: str,
signal_files: str,
chroms: List[int],
window_size: int,
margin_size: int,
step_size: int = None,
bin_size: int... |
0ce65c844f71cb08815542fe5dc1d2531ffa3c262eab7adf175edd3f15dc34ed | Python | 1,332 | 38 | import torch
import torch.nn as nn
import torchvision.models as models
class FeatureMapContrast(nn.Module):
def __init__(self, feature_dim=512):
super(FeatureMapContrast, self).__init__()
backbone = models.resnet18(weights=models.ResNet18_Weights.DEFAULT)
self.feature_extractor = nn... |
c8adf0747a05e6aab6e5472720ce85cd35ec24627175f29afdffffb74e0d7bb3 | Python | 1,333 | 46 | """
fujitsu
Supports Fujitsu compiler function.
This compiler is developed by Fujitsu and is used in A64FX on Fugaku.
"""
from numpy.distutils.fcompiler import FCompiler
compilers = ['FujitsuFCompiler']
class FujitsuFCompiler(FCompiler):
compiler_type = 'fujitsu'
description = 'Fujitsu Fortran Compiler'
... |
c1aca80058d0604452c04e181b023601848d199d9e4cd6c652da2aa901698795 | Python | 1,334 | 51 | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.http.message import Request
from gunicorn.http.unreader import SocketUnreader, IterUnreader
class Parser:
mesg_class = None
def __init__(self, cfg, source, source_addr):
self.cfg =... |
390e43b74f1dfb127eabdb0ed4b9f24db14205fae7e6d3922a21121e0615df1b | Python | 1,335 | 55 |
from molmap import feature
from molmap.utils import summary
import sys
import pandas as pd
import numpy as np
from rdkit import Chem
from tqdm import tqdm
tqdm.pandas(ascii=True)
def savenpy(filename, data):
f = np.memmap(filename, mode = 'w+',
shape = data.shape,
dtype = da... |
ebe62bfa7e09b247ec8db6843c581a44f297e12ed1f8b8503844120bb701c9bc | Python | 1,335 | 53 | import numpy as np
import pytest
from pandas import (
DatetimeIndex,
NaT,
PeriodIndex,
TimedeltaIndex,
)
import pandas._testing as tm
class NATests:
def test_nat(self, index_without_na):
empty_index = index_without_na[:0]
index_with_na = index_without_na.copy(deep=True)
i... |
8484a50bcb2ed040b0fe1878d0870e71df9df944e8ea2121a801ffb6a680088d | Python | 1,338 | 47 | import numpy as np
from .BaseAgent import BaseAgent
class DummyAgent(BaseAgent):
def __init__(self, state_dim: int, action_dim: int):
super().__init__(state_dim, action_dim)
self.params = np.zeros(state_dim * action_dim)
def get_action(self, state: np.ndarray) -> np.ndarray:
r... |
87d308d6c33923f4f86bb9043dd66cd90b974dd95c9ef29025d2398e1ea3e21e | Python | 1,340 | 56 | from datetime import datetime
import pytest
from pandas import (
DatetimeIndex,
Index,
bdate_range,
date_range,
)
import pandas._testing as tm
class TestDatetimeIndexOps:
def test_infer_freq(self, freq_sample):
# GH 11018
idx = date_range("2011-01-01 09:00:00", freq=freq_sample, ... |
2847ef7c1ebae605c965be9894304a23ccf94fc32b9aac5addcba8ecdb005769 | Python | 1,342 | 29 | import numpy as np
def calculate_context_specificity(z_matrix, context_metadata):
"""
Calculates context specificity score as defined in Figure 5A[cite: 130, 426].
Score = Context Stability (Same Context) - Context Generalization (Different Contexts)[cite: 362, 363].
"""
c_ids = context_metadata['c... |
9dc681738f0586ed30fb4b08e5d787397a3f68133cb2cebcf4fed40cb2d3aa79 | Python | 1,345 | 45 | #!/usr/bin/env python3
"""Build a PyTorch wheel on Windows.
Expects vcvarsall env (PATH/LIB/INCLUDE), GPU env (USE_CUDA, CUDA_PATH,
TORCH_CUDA_ARCH_LIST, ...), and pip build deps to already be set up by
the sibling build_env_setup.py + build_install_deps.py + the parent
bash wrapper. This script is the wheel-build ste... |
b0cdb66f7dc2c70ae97399d2840a79407d8a40f3a51298b977c1ba7ccdef548f | Python | 1,345 | 51 | from datetime import (
datetime,
timezone,
)
import dateutil.parser
import dateutil.tz
from dateutil.tz import tzlocal
import numpy as np
from pandas import (
DatetimeIndex,
date_range,
to_datetime,
)
import pandas._testing as tm
from pandas.tests.indexes.datetimes.test_timezones import FixedOffse... |
1f5877d0c45dfe40bc7cca2c410b85fd876d2cd7d15697275ce51778ae92aca2 | Python | 1,347 | 40 | import sys
sys.path.append('.')
from plotting.utils import load_results, set_plotting_defaults, efcolor, pvscolor, ecscolor
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
set_plotting_defaults()
if __name__ == '__main__':
sim_name = sys.argv[1]
mesh_name = sys.argv[2]
results = load_... |
fa7afa1399f013c84820c3e265031b38550b1062e9edfd2ed03ef3af8d1a6fbc | Python | 1,347 | 55 | # -*- coding: utf-8 -*-
import viz
import vizdlg
import vizact
import viztask
class createPanel(vizdlg.Panel):
def __init__(self, fullscreen = False,backgroundColor = viz.GRAY,**kw):
vizdlg.Panel.__init__(self,**kw) # init Dialog class
viz.link(viz.CenterCenter,self) # link the base panel to center of... |
089b96d30e927700cfb659360e5d788347b0b8272c20a3f0b6798830149812e7 | Python | 1,350 | 38 | """Tests for PeriodIndex behaving like a vectorized Period scalar"""
import pytest
from pandas import (
Timedelta,
date_range,
period_range,
)
import pandas._testing as tm
class TestPeriodIndexOps:
def test_start_time(self):
# GH#17157
index = period_range(freq="M", start="2016-01-01... |
3d241a674f14047a8a01c711a664b6ad591941bc5b4d26f9a7e17c8d6a770dbb | Python | 1,350 | 47 | #!/usr/bin/env python3.7
"""Generate heatmaps of activation thresholds, using Seaborn's FacetGrid.
The copyrights of this software are owned by Duke University.
Please refer to the LICENSE and README.md files for licensing instructions.
The source code can be found on the following GitHub repository: https://github.c... |
e7f570f8da935fce33bc75941aa2be6d74ef3d620e573bf849af39885310f226 | Python | 1,352 | 45 | """
These classes wrap the GRUCell and LSTMCell keras layers, allowing weight-tying
between RNNs for each atom. Essentially, Keras expects inputs to an RNN to be
of the shape (batch_size, sequence_length, features), while our inputs are of
shape (num_atoms_per_batch, features).
Peter, 3/20/2018
I should revisit whet... |
825a148d61a8ecc8099ae928ac3abb6710e79d4297c7e0ba0107ebc90b2154ce | Python | 1,353 | 41 | from numpy.distutils.fcompiler import FCompiler
compilers = ['HPUXFCompiler']
class HPUXFCompiler(FCompiler):
compiler_type = 'hpux'
description = 'HP Fortran 90 Compiler'
version_pattern = r'HP F90 (?P<version>[^\s*,]*)'
executables = {
'version_cmd' : ["f90", "+version"],
'compil... |
d747d0eb839c05432e2bb985be1f37eb7feea0ec4f95122d64198acd12438286 | Python | 1,353 | 49 | import textwrap
import typing as t
from contextlib import contextmanager
class TextWrapper(textwrap.TextWrapper):
def _handle_long_word(
self,
reversed_chunks: t.List[str],
cur_line: t.List[str],
cur_len: int,
width: int,
) -> None:
space_left = max(width - cur_... |
e7be1c80bd30d1f8fe6276666bd6f5f3c6349935acf86a3a67307dcd049da409 | Python | 1,353 | 50 | import pytest
import pandas as pd
from pandas import Series
import pandas._testing as tm
def test_take_validate_axis():
# GH#51022
ser = Series([-1, 5, 6, 2, 4])
msg = "No axis named foo for object type Series"
with pytest.raises(ValueError, match=msg):
ser.take([1, 2], axis="foo")
def tes... |
9d93a49d1202d2ed8b5197c80d2148271204d35743b09a4a3667399dc4ac331e | Python | 1,354 | 52 | """Test on asyncio. I need to understand this to use qualisys"""
import asyncio
import numpy as np
async def read_data(queue):
x = 0
y = 0
sd = 10
maxval = 350
for i in range(1000000):
x = x + sd * np.random.randn()
x = min(max(-maxval, x), 0)
y = y + sd * np.random.randn(... |
007e2ecc768dce71efade37c531ecce5817a34cdb4e5bdc903decb0b9b21b58e | Python | 1,356 | 42 | #!/usr/bin/env python3
"""Smoke test for extracted libtorch: fully load libtorch.so via its $ORIGIN RPATH."""
import argparse
import ctypes
import shutil
import tempfile
import zipfile
from pathlib import Path
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
... |
29bc0c9d817a19321d79f43b780090bac34db9e85bb62baacc132ab0e49f0d4d | Python | 1,358 | 46 | from pandas import MultiIndex
class TestIsLexsorted:
def test_is_lexsorted(self):
levels = [[0, 1], [0, 1, 2]]
index = MultiIndex(
levels=levels, codes=[[0, 0, 0, 1, 1, 1], [0, 1, 2, 0, 1, 2]]
)
assert index._is_lexsorted()
index = MultiIndex(
leve... |
729b9097c7ec6aa2613f8aaba0b5342d4423a85434b9a5f7b07aa5d9460e4a0e | Python | 1,358 | 45 | import pytest
from pandas import (
NaT,
date_range,
to_datetime,
)
import pandas._testing as tm
class TestPickle:
def test_pickle(self):
# GH#4606
idx = to_datetime(["2013-01-01", NaT, "2014-01-06"])
idx_p = tm.round_trip_pickle(idx)
assert idx_p[0] == idx[0]
a... |
b2c769445127faeb64fbf98d34eb5acc749ffa9bf98ebde9fc1bb28defe417df | Python | 1,358 | 44 | import numpy as np
import pytest
from arcos4py.tools._cleandata import blockwise_median, remove_image_background
def test_remove_image_background():
image = np.random.rand(50, 5, 5)
# Test with valid input
result = remove_image_background(image, filter_type='gaussian', crop_time_axis=False)
assert r... |
d4947695bff393ff1a22046a9ee5877de5d13d906c16d753e2d4577930cdaac4 | Python | 1,358 | 47 | import pytest
from pandas import (
DatetimeIndex,
Index,
MultiIndex,
Period,
date_range,
)
import pandas._testing as tm
class TestMap:
def test_map(self):
rng = date_range("1/1/2000", periods=10)
f = lambda x: x.strftime("%Y%m%d")
result = rng.map(f)
exp = Ind... |
c0d690aa892a1ec266ad9f4d4086a8e7c653d214a49131f5e08eff3aaf2d003b | Python | 1,359 | 47 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestCombine:
@pytest.mark.parametrize(
"data",
[
pd.date_range("2000", periods=4),
pd.date_range("2000", periods=4, tz="US/Central"),
pd.period_range("2000", periods=4),
... |
0c5a3106c098456aa876635a0cd3e742b6534d789a4afc0d664c2bc9b7bb725d | Python | 1,361 | 52 | import numpy as np
import pytest
from pandas import (
Period,
PeriodIndex,
period_range,
)
import pandas._testing as tm
class TestPeriodRepresentation:
"""
Wish to match NumPy units
"""
@pytest.mark.parametrize(
"freq, base_date",
[
("W-THU", "1970-01-01"),
... |
c79423d50c430db09b922ea0c28b5b9bdbaecda0f94ecd55e1b456a88309d49f | Python | 1,363 | 32 | # License: GNU Affero General Public License v3 or later
# A copy of GNU AGPL v3 should have been included in this software package in LICENSE.txt.
# for test files, silence irrelevant and noisy pylint warnings
# pylint: disable=no-self-use,protected-access,missing-docstring
import unittest
from antismash.common.sec... |
d2e31f40957644195210e7178d0475910122e0e550dd826a3178a7e7fb0cfe32 | Python | 1,363 | 41 | from typing import Optional
from app.config.grimace import GrimaceConfig
class GrimaceConfigValidator:
@classmethod
def _validate(cls, grimace_config: GrimaceConfig) -> Optional[str]:
if grimace_config is None:
return "Config is null"
if grimace_config.grimace_model is None:
... |
19f0fa8044fae8b41e565635f8e76303c2936fce88e6aa3cd91af1c293462752 | Python | 1,364 | 46 | try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.md') as f:
readme = f.read()
setup(
name='joint',
version='0.0.1',
description='JOINT for Large-scale Single-cell RNA-Sequencing Analysis via Soft-clustering and Parallel Computing.',
... |
ebd6bbd63c7a31b8181cb8e90a06b0a3f3200c76fffe835325fa1f02a8d0986f | Python | 1,364 | 40 | import anndata as ad
import scanpy as sc
import pandas as pd
# Open the RNA merged and filtered
base_dir = '/data/CARD_singlecell/SN_atlas/'
rna = sc.read_h5ad(snakemake.input.merged_rna_anndata)
atac = sc.read_h5ad(snakemake.input.merged_atac_anndata)
# Add the consolidated cell-barcode 'atlas_identifier'
rna_sample... |
fc76c6d0e7a117c7708f8517fb157ffed5cbc203eeb3d3a33047f635346a05b1 | Python | 1,364 | 44 | from __future__ import annotations
from typing import TYPE_CHECKING
from pip._vendor.packaging.utils import canonicalize_name
from pip._internal.distributions.base import AbstractDistribution
from pip._internal.metadata import (
BaseDistribution,
FilesystemWheel,
get_wheel_distribution,
)
if TYPE_CHECKI... |
50efb4e918f6836324f6ba6d5d91bf7cbb40dc18523cc545e098532dd4ade403 | Python | 1,366 | 53 | """ support numpy compatibility across versions """
import warnings
import numpy as np
from pandas.util.version import Version
# numpy versioning
_np_version = np.__version__
_nlv = Version(_np_version)
np_version_lt1p23 = _nlv < Version("1.23")
np_version_gte1p24 = _nlv >= Version("1.24")
np_version_gte1p24p3 = _nl... |
f2e293b3eda5d0718db0b3f8d24b1e46098767ca9db700602e5a9589723ccef7 | Python | 1,366 | 41 | import yaml
import nrrd
from CrystalTracer3D.io import *
from CrystalTracer3D.plot import *
with open('config.yml', 'r') as ymlfile:
cfg = yaml.safe_load(ymlfile)
if __name__ == '__main__':
in_img = r"Y:\All Data\Lab Members\Jiaxi Lu\02_Processed Data\20250505_ReviewData\3_invivo_NFkB_recording\3_3_Spatial... |
574cfd6f7106c06c8aa04cd3a58731f31a5e6a29e94a9ca5c89e4478e967bb0c | Python | 1,369 | 40 | import os
import numpy as np
import pandas as pd
def convert_distance_to_adjacency(
dist_df, keep_proportion=None, threshold=None, convert_to_COO=False
):
if keep_proportion is not None: # TODO: need to check this
# Total possible edges = n*(n-1)/2
total_edges = dist_df.shape[0] * (dist_df.s... |
7e08ae9e97dae21102a405ec66bab89c1d5ad73e6dc49c448fd32ac8e048ddf4 | Python | 1,369 | 52 | import numpy as np
import pytest
from pandas import (
DataFrame,
Series,
)
import pandas._testing as tm
from pandas.io.pytables import (
HDFStore,
read_hdf,
)
pytest.importorskip("tables")
class TestHDFStoreSubclass:
# GH 33748
def test_supported_for_subclass_dataframe(self, tmp_path):
... |
9a4f9f71f8659d41ed784cd2e27546bf6f5c603bbb28d66f29e63229fe3407c1 | Python | 1,369 | 52 | """Contains functions for running pyhmmer's hmmalign workflow."""
# from python
from typing import Any
from datetime import datetime
import logging
import tqdm
# from other modules
from big_scape.data import DB
from big_scape.hmm import HMMer
import big_scape.data as bs_data
def run_hmmalign(run: dict[str, Any], gb... |
47a99b303c736148798f9d67b89f183cef7f40c144839204c388759a9bb2e4a5 | Python | 1,370 | 34 | import numpy as np
from yet_another_imod_wrapper.utils.etomo import \
EtomoOutput, get_tilt_angle_offset, get_input_tilt_axis_rotation_angle
from yet_another_imod_wrapper.utils.xf import XF
from yet_another_imod_wrapper.utils.io import read_tlt
def get_specimen_shifts(etomo_output: EtomoOutput) -> np.ndarray:
... |
7978f92f93163ed40782b1cfb09dfaaaaae6047a9cb7d528ba38c90af1e71759 | Python | 1,370 | 36 | from __future__ import annotations
from typing import Any
import numpy as np
AR_LIKE_b = [True, True, True]
AR_LIKE_u = [np.uint32(1), np.uint32(2), np.uint32(3)]
AR_LIKE_i = [1, 2, 3]
AR_LIKE_f = [1.0, 2.0, 3.0]
AR_LIKE_c = [1j, 2j, 3j]
AR_LIKE_U = ["1", "2", "3"]
OUT_f: np.ndarray[Any, np.dtype[np.float64]] = np.... |
4eeb81035942c6354e816b1633d8e181cf8fc86b97cda8cedd459629912ab990 | Python | 1,373 | 33 | import numpy as np
import pandas as pd
import pandas._testing as tm
from pandas.tests.extension.array_with_attr import FloatAttrArray
def test_concat_with_all_na():
# https://github.com/pandas-dev/pandas/pull/47762
# ensure that attribute of the column array is preserved (when it gets
# preserved in rein... |
2a4b4f301f2da6ca883807ea391c99d01cb54ccef05b2c796a0088faf185464c | Python | 1,374 | 46 | from __future__ import annotations
import unicodedata
import MeCab
def make_mecab_analyzer(lang: str) -> MeCab.Tagger:
"""
Get a MeCab analyzer object, given the language code of the language to
analyze.
"""
if lang == "ko":
import mecab_ko_dic
return MeCab.Tagger(mecab_ko_dic.M... |
d6e62d11d7597d11841f1eb83f593f934753232c1efbbe09f2c1dc488040e9e7 | Python | 1,377 | 47 | from __future__ import annotations
from ..utils._typed_cache import typed_cache
from ..counts._count_words import count_words
from ..counts._count_complex_arabic_words import count_complex_arabic_words
from ..counts._count_arabic_long_words import count_arabic_long_words
from ..counts._count_arabic_syllables import co... |
4b8cb4b9c0b0622212535d6a5178148f063e0894144b54a96551324ed6b5d07b | Python | 1,381 | 42 | from .cluster import Cluster
from .notelifneuron import NoteLIFNeuron
from Modal.izhikevichneuron import *
class NoteCluster(Cluster):
'''
classdocs
'''
def __init__(self, neutype, neunum):
'''
Constructor
'''
Cluster.__init__(self, neutype, neunum)
def createClust... |
921f47d52146262a65152b732918314c68a9148f2984620dd99d5dbe1eedb549 | Python | 1,382 | 50 | """
Test script for a download
"""
import time
import argparse
import requests
from requests.auth import HTTPBasicAuth
def test_download(save_path, download_url, username, password, max_attempts=60):
print(f"Downloading {download_url}")
for attempt in range(max_attempts):
response = requests.get(
... |
f65a011544ef58ae76c7dabaacc3aac45fa6d0b529ea19562d6f94e5e4a724cd | Python | 1,382 | 51 | import signal
import logging
class QueueKeyboardInterrupt(object):
'''
Usage:
from campy.utils.utils import HandleKeyboardInterrupt
with QueueKeyboardInterrupt(queue):
# stuff here will not be interrupted by SIGINT
<critical_code()>
'''
def __init__(self, object):
# Insert queue object into k... |
f6b9aac2d62efe58d5916ebfa0ba9b0bb11a5ff6bc613ff22ee9daf9e4b4760a | Python | 1,386 | 48 | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from datetime import datetime, timezone
from typing import TYPE_CHECKING
from pip._vendor.cachecontrol.cache import BaseCache
if TYPE_CHECKING:
from redis import Redis
class RedisCache(BaseCac... |
e611c70c3347724764f22587e7311b8becee215485e616d4da3228e3b47b9531 | Python | 1,391 | 42 | from typing import Any, cast, Set, TYPE_CHECKING
from inspect import isclass
if TYPE_CHECKING:
from pip._vendor.rich.console import RenderableType
_GIBBERISH = """aihwerij235234ljsdnp34ksodfipwoe234234jlskjdf"""
def is_renderable(check_object: Any) -> bool:
"""Check if an object may be rendered by Rich."""
... |
c0a83279a605bc5cb9145317825a6852a91f070e8415f3953558fcebdbb8ca57 | Python | 1,392 | 38 | """Cedalion-specific exceptions."""
class CRSMismatchError(ValueError):
"""Error when coordinate reference systems do not match."""
@classmethod
def unexpected_crs(cls, expected_crs: str, found_crs: str):
"""Construct error for a coordinate system that differs from the expected one.
Args... |
3a877e5dc5a5410924f74498d320e0ed12ac505546c1ab3d4ea23e19b739f3fb | Python | 1,393 | 36 | """This hook should collect all binary files and any hidden modules that numpy
needs.
Our (some-what inadequate) docs for writing PyInstaller hooks are kept here:
https://pyinstaller.readthedocs.io/en/stable/hooks.html
"""
from PyInstaller.compat import is_conda, is_pure_conda
from PyInstaller.utils.hooks import coll... |
d45b9d346827cf91d4cd99238df308156af6cc134c1e6c584980542172257f5a | Python | 1,393 | 37 | import tifffile, os
import torch
from os.path import join
from skimage import exposure
import numpy as np
from torch import nn as nn
import torch
def MaxProject(img):
imgs = []
for z in range(2):
for y in range(2):
for x in range(2):
imgs.append(img[z::2, y::2, x::2])
im... |
00318aa75cadfa4ef414c295ead9ea0aa79c07ead2273a7e590b03ecb3cbfa48 | Python | 1,394 | 69 | from types import TracebackType
from typing import IO, Iterable, Iterator, List, Optional, Type
class NullFile(IO[str]):
def close(self) -> None:
pass
def isatty(self) -> bool:
return False
def read(self, __n: int = 1) -> str:
return ""
def readable(self) -> bool:
re... |
3ddeca5348a9d54231e658c20e7e293c9ac43b65cb206172803a8206765f20ae | Python | 1,394 | 46 | import numpy as np
import scanpy as sc
import scvi
# Open the RNA merged and filtered
adata = sc.read_h5ad(snakemake.input.merged_rna_anndata)
# Make a copy of the AnnData atlas that only contains variable genes
filtered_adata = adata[:, adata.var['highly_variable']].copy()
model = scvi.model.SCVI.load(snakemake.inp... |
945cb241498651467eca7c5367e61b483d8da90e359557318ba4c5bc01130e5a | Python | 1,394 | 59 | """Module to handle parsing features from SeqIO records in GBK files"""
# from python
# from dependencies
# from other modules
import big_scape.enums as bs_enums
from big_scape.dereplicating.gbk_components import CDS
from big_scape.dereplicating.gbk_components import GBK
# from this module
antismash_parser_fun... |
d455ff9ff523848e74d261496d913bd45ed9dbc1ba1c6cd8969c0751a30e8c42 | Python | 1,395 | 59 | import pandas as pd
import sys
import numpy as np
sys.path.append("../")
motor = None # pd.read_csv("somePath/MOTOR_run1_TAB.txt", sep='\t')
procedures = motor["Procedure[Trial]"]
trialTypes = motor["BlockType"]
trialOnsetTimes = motor["ExperimenterWindow.OnsetTime"]
initialOnsets = motor["CountDownSlide.OnsetTime"]
... |
ec9522aed80d1893112f5fa4da07a4aefa2777062e215bee236e78f2fe277c8a | Python | 1,396 | 47 | import numpy as np
from pandas import (
DataFrame,
Index,
Timedelta,
timedelta_range,
)
import pandas._testing as tm
class TestJoin:
def test_append_join_nondatetimeindex(self):
rng = timedelta_range("1 days", periods=10)
idx = Index(["a", "b", "c", "d"])
result = rng.app... |
d71bf4fe53d5bb7835e868080a38e587b4fccd0e8f4a57af0aeabc068731e583 | Python | 1,399 | 40 | import os
from distutils.core import Command
from distutils.ccompiler import new_compiler
from numpy.distutils.misc_util import get_cmd
class install_clib(Command):
description = "Command to install installable C libraries"
user_options = []
def initialize_options(self):
self.install_dir = None
... |
eac6125b0ea7e73411f9bec61ffddc8d6ca8e76ff04c3d9e6bba71a5bdfc9e5d | Python | 1,399 | 54 | from __future__ import annotations
import warnings
from ._typed_cache import typed_cache
from ._get_lang_root import get_lang_root
import sys
if sys.version_info < (3, 9):
import pkg_resources
def _set_words(lang_root: str) -> set[str]:
return {
ln.decode("utf-8").strip()
for... |
69ce21d56607bb1e8b4db0b0cb11f3603390fcba5c882dea79abd8ab4461fc02 | Python | 1,400 | 51 | from __future__ import annotations
from ..utils._typed_cache import typed_cache
from ..utils._get_lang_easy_words import get_lang_easy_words
from ..counts._count_syllables import count_syllables
@typed_cache
def is_difficult_word(word: str, syllable_threshold: int, lang: str) -> bool:
"""Return True if `word` is... |
930c563b0e8582ea26b2b2799a55a2fcbb14fca339ad6f635318140e9701e951 | Python | 1,401 | 49 | import threading
import numpy as np
from PySide6.QtCore import QObject, Signal
from app.dataflow.qqueue import IQueue
class QVariableMeta(type(QObject), type(IQueue)):
pass
class QVariable(QObject, IQueue, metaclass=QVariableMeta):
"""
A thread-safe variable
Sends a signal when the value is set, b... |
766a275893142ac5e0db7cc3fe689b104b5de1be72b3eb047d3f459e7ab4f31f | Python | 1,402 | 60 | from __future__ import annotations
from typing import Any
import numpy as np
AR_LIKE_b = [[True, True], [True, True]]
AR_LIKE_i = [[1, 2], [3, 4]]
AR_LIKE_f = [[1.0, 2.0], [3.0, 4.0]]
AR_LIKE_U = [["1", "2"], ["3", "4"]]
AR_i8: np.ndarray[Any, np.dtype[np.int64]] = np.array(AR_LIKE_i, dtype=np.int64)
np.ndenumerate(... |
f6dc894a36ee840123c28ac5fc09e28c3923bbb4c31c081a586f61fbb4a2da1e | Python | 1,402 | 48 | #!/usr/bin/env python
# Copyright (C) 2008-2012,2017 Bernd Feige
# This file is part of avg_q and released under the GPL v3 (see avg_q/COPYING).
import sys
import voglps
import SVG
# Derived class with SVG plotting operators
class voglSVG(voglps.voglps):
def __init__(self,psfile,scene,width,height):
voglps.voglps.... |
fdb4b8bdb983b9c6e22c06761b3a98edacd1667a5a8a10716a265446c047f1d4 | Python | 1,403 | 50 |
# This code is written for readability rather than efficiency.
#
# - It is aimed to give a set of logical steps explaining how to run the analysis
# in the manner we ran it for this study.
#
import pandas as pd
import numpy as np
from distance3d import distance3d # Cython version of rcpp_distance3d
# 1. Read ... |
ff5730562a4d0d7ef1fe479d983736d929ab43acc335678f0b548e4d5fce7fb7 | Python | 1,403 | 54 | from contextlib import closing
import pysam
from sinto.constants import OUT_FORMAT_CONVERSION
def tagtotag(
bam: str,
output: str,
from_tag: str,
to_tag: str,
delete: bool,
out_format: str = "t",
) -> None:
"""Copy/move tags
Copies BAM entries to a new file while copying a read tag ... |
0dc3fade3b9c0cb449a745e774a576e31df5737a7b925350c5a948befcf9c78d | Python | 1,407 | 50 | #!/usr/bin/env python
# coding: utf-8
"""
BIBSnet
Greg Conan: gconan@umn.edu
Created: 2021-11-12
Barry Tikalsky: tikal004@umn.edu
Updated: 2023-10-04
Lucille A. Moore: lmoore@umn.edu
Updated: 2024-08-21
"""
# Import standard libraries
from datetime import datetime
import os
# Custom local imports
from src.get_args im... |
3fd2f7a07e46b590d6a188e5866369757353f4a319bedfe80a76f2e36507be79 | Python | 1,407 | 33 | import warnings
def handle_deprecated_params(param_mapping, **kwargs):
"""A utility function to handle deprecated parameters in **kwargs.
Arguments:
param_mapping: A dict mapping old parameter names to new ones.
**kwargs: The **kwargs from the calling function.
Returns:
Updated **kwargs with... |
c608bee12e2ed7998e5a41e149e685c2aed7eb24039bd8e4e36db9bafca1db66 | Python | 1,407 | 36 | from learn import *
import torch
from sklearn.metrics import roc_auc_score, precision_recall_curve, auc
def save_model(encoder, dist_encoder, args):
if args.encoder == 'GCN':
torch.save(encoder.state_dict(), 'encoder_gcn.pkl')
torch.save(dist_encoder.state_dict(), 'dist_encoder_gcn.pkl')
elif... |
5b4f32c8b09e72902f6376afa942b25c94730ae532ccbea1df22466a8b65dfa3 | Python | 1,409 | 37 | import numpy as np
import torch
import torch.nn as nn
from ..functional import cutoff_function
"""
computes radial basis functions with Bernstein polynomials
"""
class BernsteinRadialBasisFunctions(nn.Module):
def __init__(self, num_basis_functions, cutoff):
super(BernsteinRadialBasisFunctions, self).__... |
c304f3e6aff7ccb71a01dba793afef4a84adc06a9859edf4ed997f53ceda4453 | Python | 1,409 | 54 | from __future__ import annotations
import base64
import string
import struct
import typing as t
from .exc import BadData
def want_bytes(
s: str | bytes, encoding: str = "utf-8", errors: str = "strict"
) -> bytes:
if isinstance(s, str):
s = s.encode(encoding, errors)
return s
def base64_encode... |
22b08ffd38aa4c9ec2cb2950ed5f228c60c24c54099791b993077dcb3d73e392 | Python | 1,410 | 40 | """
PyTorch Dataset implementation: data loading and feature extraction.
"""
import numpy as np
from scipy.signal import stft
from torch.utils.data import Dataset
class SignalDataset(Dataset):
"""Signal dataset: load preprocessed data and compute STFT features (for CNN models)."""
def __init__(self, opt):
... |
b38450631fe9e399f7ec3263dc89b8472edf3bc94c3fccfeb9bde7750384fb4d | Python | 1,410 | 38 | # License: GNU Affero General Public License v3 or later
# A copy of GNU AGPL v3 should have been included in this software package in LICENSE.txt.
# for test files, silence irrelevant and noisy pylint warnings
# pylint: disable=no-self-use,protected-access,missing-docstring
import unittest
from antismash.common.sec... |
0f3852edcd80a903a193bfc046a292152bc6db645023317d8cfd0d7b086d51fe | Python | 1,411 | 38 | import time
from typing import List
import cv2
import numpy as np
import torch
from grimace.camera_identifier_model import CameraIdentifierModel
from grimace.frame_quality_model import FrameQualityModel
from grimace.preprocessing.image import crop_image_to_square, average_channels
class CameraIdentifier:
def __... |
eba6ee6d93907e4cf3a5c71ad63cf6595932e26c62e2e1b2abc4ec429576f3c9 | Python | 1,411 | 39 | import pytest
import pandas as pd
import pandas._testing as tm
class BaseAccumulateTests:
"""
Accumulation specific tests. Generally these only
make sense for numeric/boolean operations.
"""
def _supports_accumulation(self, ser: pd.Series, op_name: str) -> bool:
# Do we expect this accum... |
ad282be6213a19a70dc28c0c879f3cfa14a59ee51193b6489a851af77073fc6c | Python | 1,414 | 47 | """Plot single or multiple overlaid Single Fiber Action Potentials (SFAP).
The recorded SFAPs are produced for every fiber when a model contains a
recording cuff, identified within the model.json configuration file.
The copyrights of this software are owned by Duke University.
Please refer to the LICENSE and README.m... |
eb1303f727c29b7850eb577c890f4ce92537518427e0a3d6753df6109b7bb2f1 | Python | 1,414 | 47 | # run this script locally to make sure you have downloaded the data correctly
import os
import numpy as np
# check if the stim folder exists
def check_data():
if not os.path.exists('stim/'):
print('Images folder not found. Please download the data first.')
else:
print('Images folder found! Che... |
b57ec0c0537d124d2d741a12be5f72c0e3d9af1168720086a26188104f761ed0 | Python | 1,416 | 44 | #!/usr/bin/python
import sys
import os
import commands
import time
import csv
if len(sys.argv) != 6:
print 'Incorrect number of arguments:', len(sys.argv)
print 'Usage:', sys.argv[0], '<path_to_tf_list_file> <input_path> <path_to_r_script> <output_path> <feature_list_location>'
sys.exit(1)
tf = sys.argv[1... |
14c1ead09c45ee89a43589691fb5022e39fee686c42ec1fb982c3a789f8f523d | Python | 1,417 | 47 | """Generate heatmaps of activation thresholds, using Seaborn's FacetGrid.
The copyrights of this software are owned by Duke University.
Please refer to the LICENSE and README.md files for licensing instructions.
The source code can be found on the following GitHub repository: https://github.com/wmglab-duke/ascent.
RU... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.