sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e3ae7f56946f9158afa4595393b547b8996db5b4ce6485b25ca8aed2dd5a6bbc | Python | 1,162 | 29 | import unittest
import pytest
import torch
from reinvent.models import LinkinventTransformerAdapter, SampledSequencesDTO
from reinvent.models.transformer.linkinvent.linkinvent import LinkinventModel
from reinvent.runmodes.utils.helpers import set_torch_device
from tests.test_data import ETHANE, HEXANE, PROPANE, BUTAN... |
ca92b334c6969fe36931b64ff5cc664590fb60a3325843b30221547093960a48 | Python | 1,163 | 35 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
from typing import Dict, Optional, Sequence
from hydra.utils import instantiate
from nequip.data import AtomicDataDict
from nequip.nn import AtomwiseReduce, SequentialGraphNetwork
def _append_energy... |
26193cb5e1e42551d0cb250f4da06b714f7a7e29c53d8729516b63d02f5e2715 | Python | 1,164 | 34 | # ------------------------------------------------------------------------------
# Python program using the library to interface with the arduino sketch above.
# ------------------------------------------------------------------------------
import PyCmdMessenger
# Initialize an ArduinoBoard instance. This is where y... |
f43312b6dd5e6df8c4ff8ab6770d090ce382776c08dac5b6048b12965b110be7 | Python | 1,164 | 30 | import os
import numpy as np
import h5py
from scipy.io import savemat, loadmat
from scipy import sparse
import glob
if __name__ == '__main__':
# Set the path of the 'GT Masks' folder, which contains the manual labels in 3D arrays.
dir_Masks = '../demo/data/GT Masks'
# %%
dir_all = glob.glob(os.path.j... |
18d74635c17d4d5eef14aee2d44714f97af1e5f4f8bb938e3634ef449c5672fc | Python | 1,165 | 37 | import torch
from pymonntorch.NetworkCore.Behavior import Behavior
from pymonntorch.utils import check_is_torch_tensor
class SynapticNormalization(Behavior):
def __init__(self, *args, synapse_type="glutamate", norm_factor=1.0, **kwargs):
super().__init__(
*args, synapse_type=synapse_type, nor... |
cf65c5543b7809be7cda4793e9e22406bd5744583285f6fb0e8a244a657ff4a6 | Python | 1,165 | 47 | # List of input files and output files
input_files = [
"CD16p_Mono.vcf",
"CL_Mono.vcf",
"CM_CD8.vcf",
"DN_B.vcf",
"EM_CD8.vcf",
"Fr_II_eTreg.vcf",
"Fr_III_T.vcf",
"Fr_I_nTreg.vcf",
"Int_Mono.vcf",
"LDG.vcf",
"mDC.vcf",
"Mem_CD4.vcf",
"Mem_CD8.vcf",
"Naive_B.vcf",
... |
f44c0fadcb04965da236504eb4befaf2416eb47dc53d694d71fe23fa666abd1d | Python | 1,166 | 35 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Generic check functions."""
import os
def get_credentials(folder_path):
"""Get credentials from folder by template.
This function retrieves the root certificate, key, and certificate from
the specified folder.
The fil... |
ca72f5cb161e9b5a75abfea5a14d096a14b82037d44db93291fe40104bda5879 | Python | 1,167 | 37 | """
Merge pandas DataFrames based on the values of selected columns.
"""
import argparse
from pathlib import Path
import pandas as pd
from copy import deepcopy
from utils.parse import none_or_path
CLI = argparse.ArgumentParser()
CLI.add_argument("--data", nargs='+', type=Path, required=True,
help="pa... |
d58e7f32b8fecbad202ce1f36361d574610fe58f1e0b6dce03565e38e57e0c6d | Python | 1,168 | 32 | import unittest
import pytest
import torch
from reinvent.models import LinkinventAdapter, SampledSequencesDTO
from reinvent.models.linkinvent.link_invent_model import LinkInventModel
from reinvent.runmodes.utils.helpers import set_torch_device
from tests.test_data import ETHANE, HEXANE, PROPANE, BUTANE
@pytest.mark... |
5f49fcc9c25b5c807b01f5af9e1ed696162a8481f76286b2882f902264ca2ce8 | Python | 1,170 | 44 | from .getEntropy import getEntropy
from numpy import zeros, sin, cos, std, arange
def doKuramoto(N, Tmax, phases, base = 2, nBits = 8):
"""Dynamic Phase-Locking.
This fuction returns the dynamic Phase-Locking for all parcels/voxels
of the input.
Args:
N (int): Number of parcels/voxels of th... |
9058d325c965bbec776a66520518d2de60544862536842ff6629dd01bdb13817 | Python | 1,170 | 53 | from pathlib import Path
import click
import pandas as pd
from nnunetpaper._utils import get_multi_method_dataframe
@click.command()
@click.option(
"-m",
"--methods",
multiple=True,
type=click.Tuple([str, click.Path(exists=True, readable=True, path_type=Path)]),
)
@click.option(
"-o", "--output"... |
329910c68bb916bfc34d036168cb070949d1cfcf96fd269f14909adb47d2d344 | Python | 1,171 | 44 | from .atomic_data import AtomicData
from .hdf5_dataset import HDF5Dataset, dataset_from_sharded_hdf5
from .lmdb_dataset import LMDBDataset
from .neighborhood import get_neighborhood
from .padding_tools import build_fake_padding_graph
from .utils import (
Configuration,
Configurations,
KeySpecification,
... |
6670da16b903abc3a0d48ea917cea453f7da8ddf13a2a5319efb1de4964ae048 | Python | 1,171 | 36 | from dig.threedgraph.dataset import QM93D
import shutil
def test_QM93D():
root = './dataset'
dataset = QM93D(root=root)
target='mu'
dataset.data.y = dataset.data[target]
assert len(dataset) == 130831
assert dataset.__repr__() == 'QM93D(130831)'
assert len(dataset[0]) == 15
assert da... |
b02acd1078da8c28138c2b4fa67204f09a2d16ae706edae39687493b12df92e6 | Python | 1,171 | 42 | from typing import List
import torch
from torch import nn
from .graph.losses import GraphLoss
class WeightedMSELoss(nn.Module):
"""
Weighted multi-component mean squared error loss.
Arguments:
loss_factors: Multiplicative weight factors for each loss component.
"""
def __init__(self, l... |
0d4ac6b483f32128318c892dbf6f08555e5caa823644a97e2cc2b68bb2d0dac0 | Python | 1,173 | 48 | # Copyright 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openfl.federated.task.runner import TaskRunner
import numpy as np
class NoOpTaskRunner(TaskRunner):
"""No-op Task Runner Class.
This class is a no-op implementation of the TaskRunner class. It does not
perform any operations an... |
90e1125cdc5c789bea7e1686bc9d5c1afcf4e28b0b330a704c2f262998a35400 | Python | 1,173 | 37 | """
Merge pandas DataFrames based on the values of selected columns.
"""
import argparse
from pathlib import Path
import pandas as pd
from copy import deepcopy
from utils.parse import none_or_path
CLI = argparse.ArgumentParser()
CLI.add_argument("--data", nargs='+', type=Path, required=True,
help="pa... |
a1d7990c6ae6e2f2d1374d3a176dd74bbcf34c6604ec59c6038130b379e34d6f | Python | 1,173 | 50 | import subprocess
sample_names = [
"CD16p_Mono",
"CL_Mono",
"CM_CD8",
"DN_B",
"EM_CD8",
"Fr_I_nTreg",
"Fr_II_eTreg",
"Fr_III_T",
"Int_Mono",
"LDG",
"mDC",
"Mem_CD4",
"Mem_CD8",
"Naive_B",
"Naive_CD4",
"Naive_CD8",
"NC_Mono",
"Neu",
"NK",
"... |
82a28671fe82a94118c8a1b823b2c8ca448c13a043e73a21aee6d6ffdd0dcfb6 | Python | 1,174 | 36 | import numba
from numba import jit, prange, f4, u1
import math
@jit("void(f4[:,:,:],u1[:,:,:])",nopython=True,parallel=True,cache=True,fastmath=True)
def fastuint(pfloat, puint):
'''Convert an array from float32 to uint8.
Inputs:
pfloat(numpy.ndarray of float32, shape = (T,Lx,Ly)): the video to be c... |
795823f59c58f696c186fc1eabc2a1a87f3e747b3e9e0125737568038ac12127 | Python | 1,175 | 52 | """Identifiers: the five levels, their lifecycle, and the invariants that hold them together.
:mod:`~vdjdb.identity.levels` derives the four content-keyed ids, :mod:`~vdjdb.identity.ids`
allocates ``record_id`` against a registry, :mod:`~vdjdb.identity.lifecycle` records what happened to
an id, and :mod:`~vdjdb.identi... |
aee4ee3dde20aaaae93dee079b71cc0ab0e81661cdf444dc4b11e0ddc4a00c41 | Python | 1,175 | 44 | from numpy.testing import assert_raises
from gemmr.data import *
import gemmr.data.loaders
from gemmr.data.loaders import _check_data_home, load_outcomes, \
_check_outcome_data_exists, load_metaanalysis, generate_example_dataset
def test_set_data_home():
original_data_home = gemmr.data.loaders._default_data... |
d58b4d38c111a890dda9a0f65de91e7b40990f163ef23d43e6f6d59b88d3a1a1 | Python | 1,175 | 33 |
# -*- coding: utf-8 -*-
#
#
# PyRates software framework for flexible implementation of neural
# network models and simulations. See also:
# https://github.com/pyrates-neuroscience/PyRates
#
# Copyright (C) 2017-2018 the original authors (Richard Gast and
# Daniel Rose), the Max-Planck-Institute for Human Cognitive Br... |
2a637d963271719bb4042c58772944e92609e6fff7cad541c6d5297a5830ba91 | Python | 1,176 | 33 | import pytest
from geomstats.test.vectorization import generate_vectorization_data
from geomstats.test_cases.geometry.base import MatrixVectorSpaceTestCase
class MatrixLieAlgebraTestCase(MatrixVectorSpaceTestCase):
def test_baker_campbell_hausdorff(
self, matrix_a, matrix_b, expected, atol, order=2
)... |
b6b1047881fb21959376f10b881d726689562a4e068f7ba05827cc396921ec24 | Python | 1,176 | 42 | """The LibInvent optimization algorithm"""
from __future__ import annotations
__all__ = ["LibinventLearning", "LibinventTransformerLearning"]
from typing import TYPE_CHECKING
import numpy as np
from .learning import Learning
from reinvent.models.model_factory.sample_batch import SmilesState
from reinvent_plugins.no... |
2b564961d308b35b2533692dc605efbe304e4af1dfcf90282db98a8b61852572 | Python | 1,177 | 38 | import tensorflow as tf
import numpy as np
from PIL import Image
from os import sys, path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
import lattice_filter_op_loader
from crf_rnn_layer import crf_rnn_layer
module = lattice_filter_op_loader.module
rgb = np.array(Image.open('permutohedral_latt... |
7e1c31a2d3a4d79a8cf0928cd093f80fa7110baf33ab1d7c00e30dcdf095cb88 | Python | 1,177 | 40 | import torch
from typing import List, Dict
from utils import logger
from . import register_collate_fn
@register_collate_fn(name="default_collate_fn")
def default_collate_fn(batch: List[Dict], opts):
"""Default collate function"""
batch_size = len(batch)
keys = list(batch[0].keys())
new_batch = {k:... |
b97200ef6debc4c2ef2e320b68010896998e46e52c6d252b89e032a7d1af0597 | Python | 1,177 | 33 | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master... |
c03e2776769e63b4ff3e23c64e05dfbaa954db068cd95f5292932031efdf8806 | Python | 1,177 | 38 | from torch import Tensor
import argparse
from utils import logger
from . import BaseCriteria, register_loss_fn
from .classification_loss_fns import get_classification_loss, arguments_cls_loss_fn
@register_loss_fn("classification")
class ClassificationLoss(BaseCriteria):
def __init__(self, opts):
super(Cl... |
d2c0782017ddcce433286301cca9152430ab0b2e5e9a4113603247d74b744771 | Python | 1,177 | 42 | from overrides import override
from typing import Any, Awaitable, Callable, TypeVar
from functools import wraps
from chromadb.rate_limit import RateLimitEnforcer
from chromadb.config import System
T = TypeVar("T", bound=Callable[..., Any])
A = TypeVar("A", bound=Awaitable[Any])
class SimpleRateLimitEnforcer(RateLim... |
55d9029b7c26aeb7dad9c111c267d9a6ca0532493391f12eceef82c094fb7f51 | Python | 1,178 | 42 | import unittest
from reinvent.models.linkinvent.model_vocabulary.model_vocabulary import SMILESTokenizer
from tests.test_data import IBUPROFEN, IBUPROFEN_TOKENIZED
class TestSmilesTokenizer(unittest.TestCase):
def setUp(self):
self.tokenizer = SMILESTokenizer()
def test_tokenize(self):
self.... |
59a6b9e5236d55fcecf3f4d4948bb781ebb9865b5e0989586ad78604c2824ed0 | Python | 1,179 | 43 |
from sleepy.processing.processor import Filter
from sleepy.processing.parameter import Parameter
from scipy.signal import butter, filtfilt
class BandPassFilter(Filter):
def __init__(self):
self.name = "Bandpass"
self.lowCutFrequency = Parameter(
title = "Low cut-off freq... |
0415518993ae3b242b65b73d4751617144eca5426b57a1f3106565251ffbb595 | Python | 1,180 | 43 |
from sleepy.processing.processor import Filter
from sleepy.processing.parameter import Parameter
from scipy.signal import butter, filtfilt
class BandPassFilter(Filter):
def __init__(self):
self.name = "Bandpass"
self.lowCutFrequency = Parameter(
title = "Low cut-off freq... |
35a56ca9e3467ccc7ffa307c86ca4f7de50e56a68d70553b92e383a1f961f05a | Python | 1,180 | 39 | import geomstats.backend as gs
from geomstats.datasets.utils import load_karate_graph
from geomstats.test.data import TestData
class HyperbolicEmbeddingTestData(TestData):
def log_sigmoid_test_data(self):
data = [
dict(point=gs.array([0.1, 0.3]), expected=gs.array([-0.644397, -0.554355]))
... |
486eee188b97e275f49d8c92d392217bca5d71a128e83ec94eebf733e5e368af | Python | 1,182 | 43 |
from .sanpyPlugin import *
# Fix this so I do not need to add each
from .plotRecording import plotRecording
from .sanpyLog import sanpyLog
# from .basePlotTool import basePlotTool
# from .plotTool import plotTool
# from .plotToolPool import plotToolPool
from .plotScatter import plotScatter
from .spikeClips import s... |
15c47e4407c19cbb36b65b911a88ac72974c8c19cc7027b9154066f9e498aa5e | Python | 1,183 | 32 | import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
df = pd.read_excel("compare_test.xlsx")
df = df.sort_values(by='Recall', ascending=False)
model_names = df.iloc[:, 0].tolist()
auc_values = df.iloc[:, 6].tolist()
auprc_values = df.iloc[:, 7].tolist()
recall_values = df.iloc[:, 3].tolist()
cust... |
1412fbe15971da3bbc85847ca511d64a33bb217befe92256cbcdb8e81aaf1f89 | Python | 1,185 | 39 | import networkx as nx
import argparse, csv, pickle, codecs
from rdkit import Chem, RDLogger
import os
RDLogger.DisableLog('rdApp.*')
MAX_ATOMIC_NUM = 100
def save_model(model, path):
with open(path, 'wb') as f:
pickle.dump(model, f, pickle.HIGHEST_PROTOCOL)
def load_model(path):
if os.path.is... |
3d723ea7635c388c0f9ef3dc240ab9b2fc1d7320cd12412935221365fa7f15f9 | Python | 1,185 | 41 | import shutil
from dig.sslgraph.dataset import get_node_dataset
def test_get_node_dataset():
root = './dataset/Planetoid'
# Cora
dataset = get_node_dataset('Cora', norm_feat=False, root=root)
assert len(dataset) == 1
assert dataset.num_features == 1433
assert dataset[0].x.size() =... |
b98541c266bfcb99e60a024ae72df7d53975810039d08ad31d7fa99e721579dd | Python | 1,185 | 33 |
# -*- coding: utf-8 -*-
#
#
# PyRates software framework for flexible implementation of neural
# network models and simulations. See also:
# https://github.com/pyrates-neuroscience/PyRates
#
# Copyright (C) 2017-2018 the original authors (Richard Gast and
# Daniel Rose), the Max-Planck-Institute for Human Cognitive Br... |
514da8555c9de71c97fc279d1c4767baa41bf60fe2e62c18305d46efbee7f0d8 | Python | 1,186 | 42 | import geomstats.backend as gs
from geomstats.test.data import TestData
from ._base import BaseEstimatorTestData
class NeighborClassifierTestData(BaseEstimatorTestData):
trials = 1
def predict_train_test_data(self):
return self.generate_random_data()
def predict_proba_train_test_data(self):
... |
9a5f9978838903ed539c021b90a6a790a7f669113143652419cb4679beddbf6d | Python | 1,186 | 37 | from odl.ufunc_ops.ufunc_ops import log_op
from dival.evaluation import TaskTable
from dival.measure import PSNR, SSIM
from dival.reconstructors.odl_reconstructors import FBPReconstructor
from dival.datasets.standard import get_standard_dataset
from dival.util.constants import MU_MAX
IMPL = 'astra_cpu'
# %% data
data... |
ccd556324ddddf25af982fa2e15de777da8f620ffca5ee8cd24e8a292d0956d2 | Python | 1,187 | 35 | from PymoNNto import *
from PymoNNto.NetworkBehavior.Basics.BasicHomeostasis import *
class NOX_Diffusion(Instant_Homeostasis):
def partition_sum(self, neurons):
neurons._temp_act_sum = neurons.vector()
for sg, sg_rf in zip(self.subgroups, self.subgroups_rf):
sg._temp_act_sum += np.m... |
b939369578976172c64f8161a548662d253daf55be95eaedba482f276d4b5c7a | Python | 1,188 | 36 | #~/miniconda3/bin/python
import pysam
import pandas as pd
import sys
import os
import argparse
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--bam', help='Input BAM file')
parser.add_argument('--out-root', help='Root directory to write output BAMs to')
parser.add_argument('-... |
ed7bba4f9131a7f74596de4190a023f8751f9243fffcb51f8dceef60981c28ab | Python | 1,190 | 45 | import numpy as np
def forward_stop(d):
"""
Find the first exit time from the domain.
Parameters
----------
d : (N,) ndarray of bool
Input trajectory indicating whether each frame is in the domain.
Returns
-------
(N,) ndarray of int
First exit time from the domain fo... |
6ee0ffc98f97c72cea119a928f68173d2e75c57bd1965a4ccf351e233d1e8292 | Python | 1,192 | 39 | import pytest
import geomstats.backend as gs
from geomstats.distributions.lognormal import LogNormal
from geomstats.geometry.euclidean import Euclidean
from geomstats.geometry.spd_matrices import SPDLogEuclideanMetric, SPDMatrices
from geomstats.learning.frechet_mean import FrechetMean
from geomstats.test.parametrizer... |
603b698d351d587f96b8c7f96efb25507dde6e5332c0c22e00a2b18e48e4c070 | Python | 1,193 | 42 | class ProjectionMixinsTestData:
def projection_vec_test_data(self):
return self.generate_vec_data()
def projection_belongs_test_data(self):
return self.generate_random_data()
class GroupExpMixinsTestData:
def exp_vec_test_data(self):
return self.generate_vec_data()
class DistMix... |
978ff947b0321ca8dafd8b97cba86204cd79f2d38159b30cb315e09548d9c9ea | Python | 1,193 | 47 | import numpy as np
import json
def get_current_time():
"""Get current time in the format of %Y-%m-%d_%H-%M-%S
Returns:
time: current time
"""
import datetime
return datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
def timeit(func):
import time
def wrapper(*args, **kwargs):
... |
22f8a92d83ab695cc281bf32d1ed2a8e5b0ddf18a63e38a84ad594b63523cb6f | Python | 1,196 | 42 | FULL_WIDTH = 500.484
TEXT_WIDTH = 500.484
def set_size(width, fraction=1, subplots=(1, 1)):
"""Set figure dimensions to avoid scaling in LaTeX.
Parameters
----------
width: float or string
Document width in points, or string of predined document type
fraction: float, optional
... |
b8d01d500947ef25a4c9b9d3225c28190bc4a235300554d562e5b825b855c3d9 | Python | 1,196 | 35 | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
39601a9941f402db8b172598b2c2877cea28dc4e2679f4e993cb53b082e947bd | Python | 1,197 | 32 | import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
df = pd.read_excel("compare_test_pseudo.xlsx")
df = df.sort_values(by='Recall', ascending=False)
model_names = df.iloc[:, 0].tolist()
auc_values = df.iloc[:, 6].tolist()
auprc_values = df.iloc[:, 7].tolist()
recall_values = df.iloc[:, 3].tolist(... |
d8887da44d150d8a401919ad0d8a2a6574b2dc4de4255f710d55045f8d7bea81 | Python | 1,197 | 38 | import argparse
import pandas as pd
import joblib
# Create an argument parser
parser = argparse.ArgumentParser(description='Load data, make predictions, and save results.')
parser.add_argument('file_name', type=str, help='Path to the data file')
parser.add_argument('model_name', type=str, help='Name of the model')
ar... |
65516969765f6e08d52c4094b84f0facef51d98b382335b894668f3b42fa0ce8 | Python | 1,198 | 41 | """Plot a square on H2 with Klein Disk visualization."""
import matplotlib.pyplot as plt
import geomstats.backend as gs
import geomstats.visualization as visualization
from geomstats.geometry.hyperboloid import Hyperboloid
def main():
"""Plot a square on H2 with Klein Disk visualization."""
square_size = 10... |
7e44bcc1c867e154e57060e6a0507bd877d684d059721afc1c2f7eff01a8fa94 | Python | 1,198 | 35 | #!/usr/bin/env python3
"""Keep the features of a Space Ranger segmentation GeoJSON whose integer
`cell_id` is in a list, and translate every vertex by (-dx, -dy) fullres px.
usage: visiumhd_crop_geojson.py SRC DST IDS_TXT DX DY
IDS_TXT holds one integer cell_id per line. Standard library only.
"""
import json
import s... |
cbe903b24b23df27fc65393f3d4d629d7d474c9a428d40b567cd2df96d67c1ad | Python | 1,199 | 34 | import numpy as np
import torch
class ThreeDEvaluator:
r"""
Evaluator for the 3D datasets, including QM9, MD17.
Metric is Mean Absolute Error.
"""
def __init__(self):
pass
def eval(self, input_dict):
r"""Run evaluation.
Args:
input_dict (dict): A p... |
92c03a203ce23689f4d8d9e930aafb2e9df70853124ef579395c3855b103af64 | Python | 1,200 | 38 | import pytest
import numpy as np
from reinvent_plugins.components.Lilly.comp_lilly_pains import Parameters
from reinvent_plugins.components.Lilly.comp_lilly_pains import LillyPAINS
SMILIES = [
"Cc1ccc(-n2[nH]c(C)c(N=Nc3cccc(-c4cccc(C(=O)O)c4)c3O)c2=O)cc1C",
"CC(=O)Oc1ccccc1C(=O)O",
"Cc1ccc(-c2cc(C(F)(F)F... |
3431617d1ff85c4cd31dc949806f44977eaad22ad28d7ebc8445604381341fa1 | Python | 1,202 | 37 | """
Merge pandas DataFrames based on the values of selected columns.
"""
import argparse
from pathlib import Path
import pandas as pd
from copy import deepcopy
from utils.parse import none_or_path
CLI = argparse.ArgumentParser()
CLI.add_argument("--data", nargs='+', type=Path, required=True,
help="pa... |
4d90a41f368fd42de3b48a8c1c143e11d88514cd48251482e2daf6329057041f | Python | 1,203 | 34 | from ..abstract_dataset import AbstractDataset
import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.tri as mtri
class LidCavity(AbstractDataset):
parametric = True
time_dependent = False
description = "lid cavity problem for increasing top wall velocities"
data_directory = o... |
f2d62a518eb81e24bf51d09a8ea7744cdf1639c8f551534d41f0f869ace37658 | Python | 1,203 | 45 | from tqdm.contrib.concurrent import process_map
from preprocessing import resample
from config import DATASET_PATH
import SimpleITK as sitk
from multiprocessing import cpu_count, Manager
import os
# No. parallel workers
N_PROC = cpu_count() - 1
# create global variable to store failed cases
manager = Manager()
failed... |
f1193e5030b1ee3deffab05ac17c470f3caa2319a5a9a357cd5412c663ce2340 | Python | 1,204 | 40 | import json
import setuptools
with open("README.rst", "r") as fh:
long_description = fh.read()
with open("pipeline_description.json", "r") as fh:
pipeline = json.load(fh)
name = pipeline["GeneratedBy"][0]["Name"]
description = pipeline["Name"]
version = pipeline["GeneratedBy"][0]["Version"]
u... |
1dc9916385dbdc815ccd53ac4134d932a7da5440142773f528197b843d327180 | Python | 1,205 | 34 | """
Subsample the input data to a target rate by selecting only every n-th sample point.
"""
import argparse
import quantities as pq
import numpy as np
from pathlib import Path
from utils.io_utils import load_neo, write_neo
CLI = argparse.ArgumentParser()
CLI.add_argument("--data", nargs='?', type=str, required=True,... |
8b58d49d403eaf4ce0452272010df20e054dd3b3518964f3ccc7744b8a974c88 | Python | 1,205 | 44 | import sys
import pandas as pd
import numpy as np
#Merge is the csv file from the final merge step, err is the error file from liftover, humreffed and chpreffed are the peaks from the respective sides
merge = sys.argv[1]
err = sys.argv[2]
humreffed = sys.argv[3]
chpreffed = sys.argv[4]
#Remove things that became inte... |
66cef43fd684fdee8c037d88ad8a092dc724e7a643182b69596a9a2b6215ad29 | Python | 1,206 | 31 | import pytest
import geomstats.backend as gs
from geomstats.geometry.euclidean import Euclidean
from geomstats.geometry.nfold_manifold import NFoldManifold, NFoldMetric
from geomstats.geometry.scalar_product_metric import ScalarProductMetric
from geomstats.geometry.special_orthogonal import SpecialOrthogonal
from geom... |
6f2c9e84e5b71eb5dd71fa4ac97d8c768fe35de9a49e7ed9968c1be95536cd70 | Python | 1,207 | 34 | """
Subsample the input data to a target rate by selecting only every n-th sample point.
"""
import argparse
import quantities as pq
import numpy as np
from pathlib import Path
from utils.io_utils import load_neo, write_neo
CLI = argparse.ArgumentParser()
CLI.add_argument("--data", nargs='?', type=Path, required=True... |
b2a1eebe9e206ce5aac6283182439cc608c7662c6904603094e476d97f9e3619 | Python | 1,207 | 25 | import matplotlib.pyplot as plt
auc_scores = [0.658, 0.652, 0.647, 0.643, 0.626, 0.626, 0.612, 0.609, 0.608, 0.604, 0.592, 0.590]
auprc_scores = [0.580, 0.545, 0.498, 0.516, 0.487, 0.533, 0.485, 0.452, 0.49, 0.477, 0.487, 0.464]
model_labels = ["sscNOVA", "cnn_pseudo_40", "svm_pseudo_40", "svm_pseudo_150", "cnn_pseudo... |
4d7b10b2c5a89b326926b05c481e2579e8cef72c3a9be357f2275298c49db937 | Python | 1,208 | 42 | """Plot a square on H2 with Poincare Disk visualization."""
import matplotlib.pyplot as plt
import geomstats.backend as gs
import geomstats.visualization as visualization
from geomstats.geometry.hyperboloid import Hyperboloid
def main():
"""Plot a square on H2 with Poincare Disk visualization."""
square_siz... |
7832784000f94174d4decd88601540890dada66b2a277986906ca38536b9386b | Python | 1,208 | 42 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
import torch
import e3nn
import nequip
from ...__init__ import _DISCOVERED_NEQUIP_EXTENSION
from ...utils.logger import RankedLogger
import importlib
from .version_utils import get_version_safe
logge... |
e2606a1d5de875b86cac6dea0b15629f5d25706138098d122973edcfbb040456 | Python | 1,208 | 37 | """
Merge pandas DataFrames based on the values of selected columns.
"""
import argparse
from pathlib import Path
import pandas as pd
from copy import deepcopy
from utils.parse import none_or_path
CLI = argparse.ArgumentParser()
CLI.add_argument("--data", nargs='+', type=Path, required=True,
help="pa... |
0622beab40367e51f08219cd47c78903c3da5133e51b8eb3f9498e7dc1126909 | Python | 1,209 | 25 | """Optional continuous motif indices; hard producer assignments remain authoritative."""
from __future__ import annotations
import numpy as np
def separated(binary: np.ndarray, support: np.ndarray, *, width: float = 1/3) -> np.ndarray:
"""Map noise to [0,width] and members to [1-width,1]; preserve missingness.
... |
0bbf32b7dc328b7000e42b1b87077b598f6accc36c70d4fb542361b7c9bddde4 | Python | 1,209 | 29 | import torch
def symmetric_edge_mask_indirect_graph(edge_index: 'torch.Tensor', edge_mask: 'torch.Tensor') -> 'torch.Tensor':
""" makes the given edge_mask symmetric, provided the given graph is indirect one.
Args:
edge_index (torch.Tensor): edges of the target graph
edge_mask (torch.Tens... |
34217d15c8607f761285f74907b9ba458b65e2883ebc45966702a6c6809875b7 | Python | 1,209 | 45 | #!/usr/bin/env python
from pathlib import Path
from shutil import copy
import hnn_core
from hnn_core.params import convert_to_json
hnn_core_root = Path(hnn_core.__file__).parent
network_configs_path = hnn_core_root / "param"
# This is the "flat JSON" parameter file which all of our "hierarchical JSON"
# network fi... |
b5176b7317ac5582afe5888af6fe8fdac37e2882d9b4e4b7c4bddca9d2f4e29f | Python | 1,210 | 28 | import sys
from PyQt5.QtCore import QRegExp
from PyQt5.QtWidgets import QApplication, QDialog, QPlainTextEdit, QVBoxLayout, QTextEdit
from PyQt5.QtGui import QColor, QTextCharFormat, QSyntaxHighlighter
class TxtHighlighter(QSyntaxHighlighter):
def __init__(self, document, coloration_list={}, base_char_color=QColo... |
ef6ed911281a743e21779011510779d7deb3d2be68313c9b74616796101ba28b | Python | 1,210 | 40 | from nltools.simulator import Simulator
from nltools.analysis import Roc
def test_roc(tmpdir):
sim = Simulator()
sigma = 0.1
y = [0, 1]
n_reps = 10
# output_dir = str(tmpdir)
dat = sim.create_data(y, sigma, reps=n_reps, output_dir=None)
# dat = Brain_Data(data=sim.data, Y=sim.y)
a... |
1c7105a41426ade627e044fdba3bd8e0ccbfffe89029f6fed10c01a33022ba9f | Python | 1,212 | 35 | import pytest
import geomstats.backend as gs
from geomstats.test.test_case import TestCase
from geomstats.test_cases.geometry.manifold import _ManifoldTestCaseMixins
class ComplexManifoldTestCase(_ManifoldTestCaseMixins, TestCase):
@pytest.mark.type
def test_random_point_is_complex(self, n_points):
p... |
1f5c2ac01bb298635d5661ea245aa225cc0e6e726e673abdc46a3abf495118c6 | Python | 1,212 | 36 | import pandas as pd
import numpy as np
import sys
#closest is the file from bedtools closest, enh is the file of enhancer peaks, out_name is the prefix of the out file.
closest = sys.argv[1]
enh = sys.argv[2]
out_name = sys.argv[3]
vvv = pd.read_csv(closest, sep = "\t", header = None)
prev_enh = 0
d = {}
ind = 1
prev... |
696952b55769096416c3cc1c872a7cd70999c18a9940d28ec8d709bfeb61e4f9 | Python | 1,213 | 53 | import pytest
import numpy as np
from reinvent_plugins.components.RDKit.comp_similarity import (
Parameters,
TanimotoSimilarity,
)
@pytest.mark.parametrize(
"smiles, radius, use_counts, use_features, expected_results",
[
(
["c1ccccc1", "Cc1ccccc1"],
2,
Fal... |
7678a67c09ddd2ba6a362f0944f7dcc04bb87fc1c711bb6d3a7579d9558b356b | Python | 1,214 | 45 | import os
import sys
directory = "."
species = sys.argv[1]
min_reads = sys.argv[2]
# All files in directory
allFiles = os.listdir(directory)
# Only the files we care about
files = []
for i in allFiles:
if i.startswith("SNPCounts") and species in i:
files.append(i)
snp_dict = {}
counter = 1
total = str(le... |
d79042551a4731a2b2f000436d3e246baf8b5a7b6a9d612ba10f7a9bceb8ead4 | Python | 1,214 | 29 | import unittest
import pytest
import torch
from reinvent.models import PepinventAdapter, SampledSequencesDTO
from reinvent.models.transformer.pepinvent.pepinvent import PepinventModel
from reinvent.runmodes.utils.helpers import set_torch_device
from tests.test_data import PEPINVENT_INPUT1, PEPINVENT_OUTPUT1, PEPINVEN... |
264a5a658b08af712be79b18285e1683cc82ce1239334de57a56fd9559bae47e | Python | 1,215 | 55 | from rdkit import Chem
from rdkit.Chem import rdMolDescriptors
import numpy as np
import pandas as pd
import deepchem as dc
## Input
df = pd.read_csv("chembl_kkb_multi_task_data.csv.gz")
## Calculate Fingerprints
FP_SIZE=1024
RADIUS=2
descs = [calc_fp(smi, FP_SIZE, RADIUS) for smi in df["Canonical_Smiles"].values... |
4dd857cc9ba5a46a5646dba7bb90cc779c167c30a07d16a61b7196b8d39df23b | Python | 1,216 | 39 | from __future__ import absolute_import
import sys
from argparse import ArgumentParser
import pytest
from configargparse import Namespace
from pytest_mock.plugin import MockerFixture
from snakebids.admin import gen_parser
@pytest.fixture
def parser():
return gen_parser()
class TestAdminCli:
def test_fails... |
698e69e7b350a3dd76a2a8a0f5971c26d688fb940a2b8c43ca11bafb127d5630 | Python | 1,216 | 34 | """
Subsample the input data to a target rate by selecting only every n-th sample point.
"""
import argparse
import quantities as pq
import numpy as np
from pathlib import Path
from utils.io_utils import load_neo, write_neo
CLI = argparse.ArgumentParser()
CLI.add_argument("--data", nargs='?', type=str, required=True,... |
51ad18abfd448737be04df564c47a927ffc89da534ce3aa2b55d189a6369c46c | Python | 1,218 | 32 | # -*- coding: utf-8 -*-
#
#
# PyRates software framework for flexible implementation of neural
# network models and simulations. See also:
# https://github.com/pyrates-neuroscience/PyRates
#
# Copyright (C) 2017-2018 the original authors (Richard Gast and
# Daniel Rose), the Max-Planck-Institute for Human Cognitive Bra... |
a334359b639b9227a8538b91744eda2bc02ab26933edaa914ce6a819883112a6 | Python | 1,218 | 24 | # 2026-09-26 Per-epitope Lumbermark in the tcremp label contract. Shared by the sweeps.
import numpy as np
def lumbermark_labels(X, epitopes, min_cluster_size, m_smooth, gate=None):
"""Per-epitope Lumbermark in the tcremp label contract: -1 noise, unique across epitopes."""
from lumbermark import Lumbermark
... |
435fb07efe2911554df5b12860a7b7c3d01a3e344aea42b678cf2e0b84fd97a2 | Python | 1,220 | 43 | import pandas as pd
# List of input files and output files
input_files = [
"CD16p_Mono_nominal.txt",
"CL_Mono_nominal.txt",
"CM_CD8_nominal.txt",
"DN_B_nominal.txt",
"EM_CD8_nominal.txt",
"Fr_I_nTreg_nominal.txt",
"Fr_II_eTreg_nominal.txt",
"Fr_III_T_nominal.txt",
"Int_Mono_nominal.... |
9698a2222a75902ebfb608110dae3642793a3642816b3960700ed9bbc3f5952a | Python | 1,220 | 50 | # coding:utf-8
__author__ = 'Bob'
from django import template
register = template.Library()
# @register.filter(name='addv')
# def addv(value):
# return value + 1
def increment_var(parser, token):
parts = token.split_contents()
if len(parts) < 2:
raise template.TemplateSyntaxError("'increment'... |
23c1b794c5315d1dae8a472443dc0a78213bec9663823bd4f9aeceab4d2b9252 | Python | 1,221 | 32 | # -*- coding: utf-8 -*-
#
#
# PyRates software framework for flexible implementation of neural
# network models and simulations. See also:
# https://github.com/pyrates-neuroscience/PyRates
#
# Copyright (C) 2017-2018 the original authors (Richard Gast and
# Daniel Rose), the Max-Planck-Institute for Human Cognitive Bra... |
8545d3dcb4daaca6b8e0266bd2090ad77ded95421031c477e80a45cead5c75aa | Python | 1,221 | 38 | import os
import argparse
import h5py
from cloudvolume import CloudVolume
from pathlib import Path
import numpy as np
def cloudvolume_to_h5(cv_path, dst_path):
vol = CloudVolume(cv_path)
shape = (vol.shape[2], 2, vol.shape[0], vol.shape[1])
chunks = (1, 2, vol.shape[0], vol.shape[1])
field = h5py.File(... |
33f9bb022ac880aa4860daad5e3a52d36ece0d68457aeafcb1d73118a5c272d2 | Python | 1,223 | 43 | from sklearn.metrics import confusion_matrix
from sklearn.metrics import accuracy_score
from sklearn.metrics import balanced_accuracy_score
from sklearn.metrics import roc_auc_score
from sklearn.metrics import precision_score
from sklearn.metrics import recall_score
from sklearn.metrics import f1_score
## Calculate c... |
ff883dc75125f4ea4f8c702c02a30f17f73f60f08881d084ec96606c43133c4b | Python | 1,223 | 32 | # -*- coding: utf-8 -*-
#
#
# PyRates software framework for flexible implementation of neural
# network models and simulations. See also:
# https://github.com/pyrates-neuroscience/PyRates
#
# Copyright (C) 2017-2018 the original authors (Richard Gast and
# Daniel Rose), the Max-Planck-Institute for Human Cognitive Bra... |
493c948b8c2452ca97f55c808f2c944cfeb3d2785b6f9fb47a267b38c654fd9a | Python | 1,224 | 42 | import fastdeploy as fd
import cv2
import os
def parse_arguments():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
"--model_dir",
required=True,
help="path of PP-TinyPose model directory")
parser.add_argument(
"--image_file", required=True, help... |
5c2d2021d2a1e5f86d33fc5021ba0c0809951d7a5ceac3bf6145eb8e6bca0801 | Python | 1,224 | 43 | import torch
import torch.nn as nn
# readout function
class Readout(nn.Module):
def __init__(self, k):
super(Readout, self).__init__()
self.k = k
def forward(self, Z):
# calculate cluster-level embedding
Z_tilde = []
# step1: split the nodes into K groups
# st... |
62975b42e4975f3c8d099b11f1bdeda84669b2091f9bc3ca16ecec55bed0de10 | Python | 1,225 | 32 | # -*- coding: utf-8 -*-
#
#
# PyRates software framework for flexible implementation of neural
# network models and simulations. See also:
# https://github.com/pyrates-neuroscience/PyRates
#
# Copyright (C) 2017-2018 the original authors (Richard Gast and
# Daniel Rose), the Max-Planck-Institute for Human Cognitive Bra... |
be02daa47b64f62e306ee75c700859ed0835b68eea8729bb1f1f2d2ada40f0eb | Python | 1,225 | 35 | from pathlib import Path
import pandas as pd
from nnunetpaper.data import read_json
def get_multi_method_dataframe(
methods: list[tuple[str, Path]], auto_collect_anatomies: bool = False
) -> pd.DataFrame:
if auto_collect_anatomies:
tmp = []
for name, path in methods:
print(f"Coll... |
ed7174338d068bcead990d46d29580890bb3160b574da2e62357fc0f53b30d9a | Python | 1,227 | 38 | """Config Validation"""
from typing import Optional
from pydantic import Field, BaseModel, ConfigDict
class GlobalConfig(BaseModel):
model_config = ConfigDict(extra="forbid")
class FilterSection(GlobalConfig):
elements: list[str] = Field(default_factory=list)
transforms: list[str] = Field(default=["sta... |
219bc3360cfcaf81bdeb15c351fa7baf4170ed5405640e1abc0e8434d8546cd5 | Python | 1,228 | 46 | from infomap import infomap
# Notice the --expanded flag to keep the internal higher-order state nodes in the output tree
infomapWrapper = infomap.MemInfomap("--two-level --expanded")
# Trigrams represents a path from node A through B to C.
# Add link weight as an optional fourth argument
infomapWrapper.addTrigram(0,... |
96db6fe7b6d9158537254e6561d5f86e884493bed04601789894e2cbd1d1aa2b | Python | 1,228 | 32 | # -*- coding: utf-8 -*-
#
#
# PyRates software framework for flexible implementation of neural
# network models and simulations. See also:
# https://github.com/pyrates-neuroscience/PyRates
#
# Copyright (C) 2017-2018 the original authors (Richard Gast and
# Daniel Rose), the Max-Planck-Institute for Human Cognitive Bra... |
7e2c4255a9fcc97ba661ae002896228563454ee49b94f44014ea2a2533c6a377 | Python | 1,231 | 40 | import cv2
from overlay import ObserverOverlay, is_point_in_bounds
from bbox import xyxy_to_centroid
class BBoxOverlay(ObserverOverlay):
default_params = {
**ObserverOverlay.default_params,
"show_centroid": True,
"show_bbox": True,
"centroid_color": (255, 0, 0),
"centroid_... |
303c8ce18ed9c0acc5e713e0af93bd0ba94e6cda336e3e6a4f942ebc9b924be2 | Python | 1,232 | 45 | import unittest
from deeprank_gnn.GraphGenMP import GraphHDF5
import os
import multiprocessing as mp
CWD = os.path.dirname(os.path.realpath(__file__))
NPROC = mp.cpu_count() - 1 if mp.cpu_count() > 1 else 1
class TestCreateGraph(unittest.TestCase):
def setUp(self):
self.pdb_path = f"{CWD}/data/pdb/1ATN/"
... |
33c3adc6e3bea8728603c8214872d9935bd99ffaf21c58652d8f561a9e60ec53 | Python | 1,232 | 35 | """
Subsample the input data to a target rate by selecting only every n-th sample point.
"""
import argparse
from pathlib import Path
import quantities as pq
import numpy as np
from pathlib import Path
from utils.io_utils import load_neo, write_neo
CLI = argparse.ArgumentParser()
CLI.add_argument("--data", nargs='?',... |
527b875d37da07b753dbb738219ae5a18e2fd05550e4b0c297fa6402b8e1077f | Python | 1,232 | 41 | # Author: Youzhi Luo (yzluo@tamu.edu)
# Updated by: Anmol Anand (aanand@tamu.edu)
import copy
from dig.auggraph.method.GraphAug.constants import *
base_aug_cls_conf = {
MODEL_NAME: CLSModelType.GCN,
NUM_LAYERS: 4,
HIDDEN_UNITS: 128,
DROPOUT: 0.5,
POOL_TYPE: PoolType.MEAN,
BATCH_SIZE: 32,
I... |
5fbd2f41bcfae6b533dae6a2fd9986c3a89ea65549205cfb653bd831dc02eb58 | Python | 1,232 | 44 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
class SerializationError(Exception):
"""Raised when there is an error in serialization process."""
def __init__(self, *args: object) -> None:
"""Initializes the SerializationError with the provided arguments.
Args:... |
bcbf24e1a2caf39a5cb8d8c05a046ec803be2a4660ed38b7da60a4db174e6e6d | Python | 1,232 | 43 | import pandas as pd
# List of input files and output files
input_files = [
"CD16p_Mono_nominal.txt",
"CL_Mono_nominal.txt",
"CM_CD8_nominal.txt",
"DN_B_nominal.txt",
"EM_CD8_nominal.txt",
"Fr_I_nTreg_nominal.txt",
"Fr_II_eTreg_nominal.txt",
"Fr_III_T_nominal.txt",
"Int_Mono_nominal.... |
1bb97f6ebb3409c984740e515201f546318c838dcae50d7291bc29fa2d0109e8 | Python | 1,233 | 41 | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.