sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
62c5af22ece1015e35411728c657d04df298287e7abfd4769e9179d2e1b59400
Python
646
23
""" Z-score the signal of each channel. """ import argparse from pathlib import Path from elephant.signal_processing import zscore from utils.io_utils import load_neo, write_neo CLI = argparse.ArgumentParser() CLI.add_argument("--data", nargs='?', type=Path, required=True, help="path to input data in...
eac4e2e07221383d606f40a9fa41de903994728d370fe24fde3ca4503c2d8899
Python
647
23
""" Z-score the signal of each channel. """ import argparse from pathlib import Path from elephant.signal_processing import zscore from utils.io_utils import load_neo, write_neo CLI = argparse.ArgumentParser() CLI.add_argument("--data", nargs='?', type=Path, required=True, help="path to input data in...
561d0b2804f947ea0cf1dfc15597ae305c115c7cc9d9d887692d614c3cc9a1f5
Python
648
18
import os name_script = "network_perm_equivariant_modular_conv_new_lba.py" string = "#!/usr/bin/env bash \n\n#SBATCH --partition=batch_default\n#SBATCH --cpus-per-task=2\n#SBATCH --gres=gpu:1\n#SBATCH --time=48:00:00\n\nsource ~/.bashrc\nmodule load anaconda/wml\nbootstrap_conda\nmodule load cuda\n\nconda activate p...
d084bf1e0bd1e2b817bbc47f9850e6a12de92c75c17c4997322dae16967eb74f
Python
648
16
import geomstats.backend as gs from geomstats.test.random import RandomDataGenerator from geomstats.test.test_case import TestCase class FiniteDifferenceTestCase(TestCase): def setup_method(self): if not hasattr(self, "data_generator"): self.data_generator = RandomDataGenerator(self.space) ...
667ea9664a05149db90edda573ba11f930708173ca263df1e8bb4f424f4eff6b
Python
649
22
class SimpleLossCompute: "A simple loss compute and train function." def __init__(self, generator, loss_function, opt): self.generator = generator self.loss_function = loss_function self.opt = opt def __call__(self, x, y, norm): x = self.generator(x) loss = ( ...
af15df7b3dc239026a4147c59a774bd30af8f21fad5c27bcb3c1a39f2e145f2d
Python
649
19
import unittest from reinvent.models.reinvent.models.vocabulary import ( Vocabulary, create_vocabulary, SMILESTokenizer, ) from tests.test_data import CELECOXIB, COCAINE, METAMIZOLE, ASPIRIN, SIMPLE_TOKENS class TestCreateVocabulary(unittest.TestCase): def setUp(self): smiles = [ASPIRIN, META...
3a0c381c0c54942045c98abcf58a76145e05d0a7c2c4a62bcb794f3375639840
Python
651
27
import pandas as pd from GeneSGAN.Gene_SGAN_clustering import cross_validated_clustering import os if __name__ == '__main__': output_dir = './genesgan' if not os.path.exists(output_dir): os.makedirs(output_dir) image_data = pd.read_csv('toy_data_imaging.csv') gene_data = pd.read_csv('toy_data_gene.csv') fold_...
5322d25d4df43763b00e409c556879bca3fb873d0b94e22af74d548eded50df7
Python
651
21
try: # importlib.metadata is present in Python 3.8 and later import importlib.metadata as importlib_metadata except ImportError: # use the shim package importlib-metadata pre-3.8 import importlib_metadata as importlib_metadata try: # __package__ allows for the case where __name__ is "__main__" ...
f89c6d7d78d6cef4c014667ed9e7e8eb6f1094274c3a090983e7dfa6aad72d1e
Python
652
18
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Task package.""" from importlib import util from openfl.federated.task.runner import TaskRunner # NOQA if util.find_spec("keras") is not None: from openfl.federated.task.runner_keras import KerasTaskRunner # NOQA if util.find_sp...
64a4ffe0472ed340a494481c4d2da296f816cee4468dd2677fecfc953ca6de7f
Python
653
23
""" Z-score the signal of each channel. """ import argparse from pathlib import Path from elephant.signal_processing import zscore from utils.io_utils import load_neo, write_neo CLI = argparse.ArgumentParser() CLI.add_argument("--data", nargs='?', type=Path, required=True, help="path to input data...
de2262425407d62ca6780dee013692f2693b8a1188f63a7805437288b6ec6d95
Python
653
20
from torch import nn import torch class CrossAttentionModule(nn.Module): def __init__(self, channel_size): super().__init__() self.query = nn.Linear(channel_size, channel_size) self.key = nn.Linear(channel_size, channel_size) self.value = nn.Linear(channel_size, channel_size) d...
5237c6191cc0b1503ca4d5390257aa2054b79f9df4c09ffbe4029f5a5f9a9d75
Python
654
24
from torch import Tensor from typing import Optional from . import register_stats_fn @register_stats_fn(name="top1") @register_stats_fn(name="top5") def top_k_accuracy( output: Tensor, target: Tensor, top_k: Optional[tuple] = (1,) ) -> list: maximum_k = max(top_k) batch_size = target.shape[0] _, pre...
68c74ac531f7284ddacfccd60fc3dfff7bd2cc1c71994c949f500a4ff15e07c1
Python
654
25
import setuptools with open('README.md', 'r') as rmf: readme = rmf.read() with open('VERSION', 'r') as verf: version = verf.read() setuptools.setup( name='live2p', version=version, author='Will Hendricks', author_email='hendricksw@berkeley.edu', description='Real-time calcium imag...
0b48b1a49435ce8945b5c866d0e7f71be4ef3840b00ed11c20c1537b5e0727da
Python
655
24
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # from torch import nn, Tensor from typing import Optional, Tuple from . import register_act_fn @register_act_fn(name="prelu") class PReLU(nn.PReLU): """ Applies the `Parametric Rectified Linear Unit <https...
606fe1dc33ed27cdb6604efff0bdd18892cbf9aefc85f5c2440d26263bfdf92c
Python
655
21
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Data package.""" from importlib import util from openfl.federated.data.loader import DataLoader # NOQA if util.find_spec("keras") is not None: from openfl.federated.data.loader_keras import KerasDataLoader # NOQA if util.find_s...
0353eb22cb77d96ec0016d2d358519cfa30e4ff0212b253e05d1160f330b1b56
Python
656
26
from sklearn.feature_selection import SelectKBest, f_classif import pandas as pd import numpy as np data = pd.read_csv("Feature_3102.csv", sep='\t') feature = data.iloc[:, 5:-1] label = data.iloc[:,-1] model = SelectKBest(f_classif, k=400) feature_new = model.fit_transform(feature, label) feature = pd.DataFrame(fea...
3e6ee8f2779540e806d734b0d1207fb50b5f3aba465e9f3c4f1855df8cb1f1d9
Python
656
26
from sklearn.feature_selection import SelectKBest, f_classif import pandas as pd import numpy as np data = pd.read_csv("Feature_3102.csv", sep='\t') feature = data.iloc[:, 5:-1] label = data.iloc[:,-1] model = SelectKBest(f_classif, k=800) feature_new = model.fit_transform(feature, label) feature = pd.DataFrame(fea...
8be6b637eadcf39f5184077614f7899717f3e393804aa2c056701b6231e2b66e
Python
656
17
from reinvent.chemistry.standardization.filter_types_enum import FilterTypesEnum from tests.chemistry.fixtures.test_data import INVALID from tests.chemistry.standardization.base_rdkit_standardizer import BaseRDKitStandardizer class TestRDKitStandardizerDefaultLongAliphaticOn(BaseRDKitStandardizer): def setUp(self...
924686f8bee2da778c670df95e9810903fa71b4275db7fc900e1c0cdfc25e561
Python
656
26
from sklearn.feature_selection import SelectKBest, f_classif import pandas as pd import numpy as np data = pd.read_csv("Feature_3102.csv", sep='\t') feature = data.iloc[:, 5:-1] label = data.iloc[:,-1] model = SelectKBest(f_classif, k=600) feature_new = model.fit_transform(feature, label) feature = pd.DataFrame(fea...
e27d62430631370defc8f1fdadf9ec6956af2d6f538192fb99fbd686bc6c8db5
Python
656
26
from sklearn.feature_selection import SelectKBest, f_classif import pandas as pd import numpy as np data = pd.read_csv("Feature_3102.csv", sep='\t') feature = data.iloc[:, 5:-1] label = data.iloc[:,-1] model = SelectKBest(f_classif, k=200) feature_new = model.fit_transform(feature, label) feature = pd.DataFrame(fea...
eec303469a7fd266afc2866014cf11f67a5df326739219502283ca17ecba5c17
Python
657
20
# 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 math # Technically, use of this module should probably be guarded by conditional_torchscript_jit # But its use as a drop-in replacement for functions like torch.nn.functional.silu ...
4ba5b0fe8f79f0c0463266cf57a394a0bc19de5db0f5564a26f21ab5ed1d09e8
Python
658
30
from unittest import TestCase import unittest import numpy as np import filecmp import os from smithers.io import STLHandler stl_file = "tests/test_datasets/cube.stl" def test_points(): data = STLHandler.read(stl_file) np.testing.assert_array_almost_equal(data["points"][0], [-0.5] * 3) def test_number_poi...
ed8f152cc9ae86295d979927ef2f47d9099ce918ee874ede4358456af01edf55
Python
658
21
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. from .base_datasets import AtomicDataset from .lmdb_dataset import NequIPLMDBDataset from .ase_dataset import ASEDataset from .npz_dataset import NPZDataset from .hdf5_dataset import HDF5Dataset from .t...
13559c302dabd9bccf4bed00672f2a5bdb7deb9ce693609693d3eb73ce13ffdc
Python
659
18
from nltools.utils import check_brain_data, check_brain_data_is_single from nltools.mask import create_sphere from nltools.data import Brain_Data import numpy as np def test_check_brain_data(sim_brain_data): mask = Brain_Data(create_sphere([15, 10, -8], radius=10)) a = check_brain_data(sim_brain_data) ass...
653b0734fec3b436be1e9741ba90bf3ff5e8e3d329dde43aa9a68280accb26dc
Python
659
26
from sklearn.feature_selection import SelectKBest, f_classif import pandas as pd import numpy as np data = pd.read_csv("Feature_3102.csv", sep='\t') feature = data.iloc[:, 5:-1] label = data.iloc[:,-1] model = SelectKBest(f_classif, k=1000) feature_new = model.fit_transform(feature, label) feature = pd.DataFrame(fe...
315870bad38b633bbd1e8c40f56007e1b1973119a83d84891b3d866ed7dcdb21
Python
660
23
# Generated by Django 4.1.1 on 2023-01-02 11:51 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('celsus', '0046_extraproperties'), ] operations = [ migrations.RemoveField( model_name='socialpl...
abbb7b41be553608672b2c2fdc81caaae17d86982f09d04869dec26584a6805f
Python
661
26
import numpy as np #%% import e3nn_jax as e3nn irreps1 = e3nn.Irreps("1o") irreps2 = e3nn.Irreps("1o") n_samples = (irreps1.dim * irreps2.dim) x = np.random.normal(size=[n_samples, irreps1.dim]) y = np.random.normal(size=[n_samples, irreps2.dim]) M = np.einsum("...i,...j->...ij", x, y) tp = e3nn.tensor_product(e3nn....
ad8ef5957932f51e07f8a207a8eb98ef271cb848640d4ffbf63d2d7c715698fb
Python
662
23
# Generated by Django 4.1.1 on 2022-10-21 10:41 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('celsus', '0013_remove_author_project_project_associated_authors_and_more'), ] operations = [ migrations.Rem...
fb0d14aaf14acaad318e06eea8c2574172761e7fc16efb9ef46c7f34f912cd11
Python
663
26
"""Helper routines A set of common auxiliary functionality. """ from typing import List import torch def collate_fn(encoded_seqs: List[torch.Tensor]) -> torch.Tensor: """Converts a list of encoded sequences into a padded tensor :param encoded_seqs: encodes sequences to be padded with zeroes :return: p...
9e2716ef0a18800865c1f6b161f7cec34aba55a745347b230c7741a75416bd42
Python
665
11
from sleepy.processing.algorithms.massimi import Massimi #rom sleepy.processing.algorithms.core import Algorithm #from sleepy.processing.algorithms.parameter import Parameter from sleepy.processing.algorithms.walkthrough.walkthrough import Walkthrough from sleepy.processing.algorithms.relative.relative import Rel...
c9f0071202e290faf893392fd43235e0d0b1cec0e98fdea3938b2f06633b3bf5
Python
665
23
# Generated by Django 4.1.1 on 2022-12-07 12:26 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('celsus', '0041_curtain_enable_curtain_owners_alter_curtain_link_id_and_more'), ] operations = [ migrations....
5e09ea471a5ca82f1869d89d875b0acb084b10ec49faf922cfbe48d0a8064873
Python
666
29
import torch import warnings def _is_positive_int(x): return (isinstance(x, int) and x > 0) def slow_down_warning(base, property, solution): warnings.warn( ( "In {}, you have {} enabled, this will slow down training. Set to {} to disable it. ".format( base, property, solu...
7b48bdb84abc30471be8877f555593d86f53c2f8767ee369f8bb07b228ce0b7d
Python
666
28
from mlspm.graph._analysis import GraphStats from mlspm.graph._molecule_graph import Atom, MoleculeGraph from mlspm.graph._utils import ( add_rotation_reflection_graph, crop_graph, find_bonds, find_gaussian_peaks, make_box_borders, make_position_distribution, save_graphs_to_xyzs, shift_m...
c6d18595cd32387571a6b1df621719e8fb774050519cba4b9c931566cefed97b
Python
666
29
#!/usr/bin/env python3 from pathlib import Path from snakebids import bidsapp, plugins # For Sphinx doc generation, __file__ may not be defined try: app_path = Path(__file__).resolve().parent except NameError: # Fallback for Sphinx - use current working directory or find snakedwi module import snakedwi ...
fd4537659dbf606ef7cc0e560d7a648768fdaabee3c6dcac80366d8eb0bb1b18
Python
666
18
import os import json from collections import defaultdict from pathlib import Path config_path = Path(__file__).parent / "integration_tests_config.json" if config_path.exists(): with open(config_path, "r") as f: config = json.load(f) else: config = {} MAIN_TEST_PATH = config.get("MAIN_TEST_PATH", "") ...
6966c59ffa7215d6fd90bf961c227ad868428cd37a51769e037cf90871ad17e6
Python
667
26
import pandas as pd import deepchem as dc from sklearn.ensemble import RandomForestClassifier import random ## Split KFold = dc.splits.RandomSplitter() KFold2 = KFold.k_fold_split(dataset, k=10) ## MTRF for train, test in KFold2: trainX = pd.DataFrame(train.X) trainy = pd.DataFrame(train.y) testX = pd.D...
25bb860b6e383bda230912160af55606aaa97418615ead35917326c67ceb2fff
Python
668
22
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'celsusdjango.settings') try: from django.core.management import execute_from_command_line except...
73a216acb330b5996e00a4292762f3c0ff1401a6d327fab2052449e01bdf9c23
Python
668
16
# Copyright (c) 2023 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...
9d006bf29e033b84e6e1d518c7baea75d3a089a962bb6d7b819b1913c69eda7a
Python
668
16
from sleepy.test.data import TestSignal from sleepy.processing.engine import Engine from sleepy.processing.algorithms.massimi import Massimi from sleepy.processing.filters.bandpass.core import BandPassFilter # Prepare the algorithm and filter instances (we keep the standard values) algorithm = Massimi().render...
2f5769ca554aad85bbfb139475afed7711a0de79058ef71f145ad87bf3d10c7c
Python
669
27
# Generated by Django 2.1 on 2018-08-22 07:07 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='markers', fields=[ ('id', models.IntegerField...
072552932be9f55e7d4b80f6872783e6233ea487221655f1ebed93d7fda060d9
Python
670
26
from .geodesic import LogSolverAgainstMetricTestData, LogSolverTestData class LogSolverAgainstClosedFormTestData(LogSolverAgainstMetricTestData): fail_for_not_implemented_errors = False tolerances = { "log": {"atol": 1e-3}, "geodesic_bvp": {"atol": 1e-4}, } class PathStraighteningAgains...
d4985df0847401ff7d6367a731594e1de94715fb10355908aca127e52d1d1d23
Python
670
30
from sleepy.gui.builder import Builder from PyQt5.QtWidgets import QWidget from sleepy.processing.algorithms.parameter import ParameterBase import pdb class Algorithm: def render(self): self.buildTree = ParameterBase.getBuildTree(self) Builder.setAttributesFromJSON(self.buildTree, s...
e228f3ef5b586ed71f86fd0220fe00bb2b5b3c5862e648cc63013f217dd81af8
Python
670
34
SHARES = [ 0.5, 0.6, 0.7, 0.8, 0.9, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1.0 ] def pop(items): return items[0], items[1:] def get_quantiles(records, shares=SHARES): if not shares: return counts = [count for _, count in records] total = sum(counts) acc...
3b42315ed0c4d04fa4bf7d0015620335851a8ef62f515209307d85b00fc7e530
Python
671
18
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # This work is licensed under the Creative Commons Attribution-NonCommercial # 4.0 International License. To view a copy of this license, visit # http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to # Creative Commons, PO Box 1866, Moun...
65386001daa54691a556e5fd54a76ea0a72a8de83c9604312aca1e6a36ea7c2d
Python
671
30
import pytest def _has_ignore_marker(markers): for marker in markers: if marker.name == "ignore": return True return False @pytest.hookimpl(trylast=True) def pytest_collection_modifyitems(session, config, items): selected = [] deselected = [] for item in items: if _h...
df3dbcdd8a01f5c6022552180c904cc9ef1df0ae5342a11d0407d677e9374b5b
Python
672
15
import os from shutil import copytree, ignore_patterns def copy_src(wdir, current_file=None, dst_dir="src", patterns=("*outputs*", "*__pycache__*", "*.pth", "*.pkl", "*.out", "*results*", "*.pdf")): if current_file is None: cwd_root = wdir else: current_file_fullname = os.path.join(wdir, curre...
e15272ef61f81065e22e420d4e6de29466628b3cb9f4b62f44681949926bf287
Python
672
29
import os import numpy as np import crepe # this data contains a sine sweep file = os.path.join(os.path.dirname(__file__), 'sweep.wav') f0_file = os.path.join(os.path.dirname(__file__), 'sweep.f0.csv') def verify_f0(): result = np.loadtxt(f0_file, delimiter=',', skiprows=1) # it should be confident enough a...
f68f363055006223a87aa07f89f919f1f34f78b87f1323ef736632b2d3a8a51a
Python
672
36
import sys from ..glove import ( MB, Glove, iter_read, parse_glove_cooc ) def cooc_count(args): glove = Glove.from_env() glove.cooc( sys.stdin.buffer, sys.stdout.buffer, vocab=args.vocab, memory=args.memory, window=args.window ) def cooc_shuffle(...
fad5912fbd32ee5c09c062576c75c27f46ded462ec2c67e4bd7b3933dbd68d0b
Python
672
25
import numpy as np from typing import Literal def _format_with_SI_postfix(x, decimals=2): postfixes = [(1e9, "b"), (1e6, "M"), (1e3, "k")] postfix = "" for v,p in postfixes: if x >= v: x/= v postfix = p break x = np.round(x, decimals) x = str(x) if "....
2963314bee78de0fd98afa8e1ea3aad7a1134ad5a48ef8fab068ce99eed5cac3
Python
673
24
import jax.numpy as jnp import jax from plasticity import inputs import unittest class TestInputs(unittest.TestCase): def test_inputs(self): mus = jnp.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) sigmas = jnp.array( [ [[1, 0, 0], [0, 1, 0], [0, 0, 1]], [[0...
3cd0c0ea4f33d391da3407c0d008136f8bbfc6cd4e24fded10f73f21b4dc32e8
Python
674
24
"""Define the state""" from __future__ import annotations __all__ = ["ModelState"] from dataclasses import dataclass from typing import TYPE_CHECKING if TYPE_CHECKING: from reinvent.models import ModelAdapter from reinvent.runmodes.RL.memories import DiversityFilter @dataclass class ModelState: """Data...
940b5e665be4f0c179888092cc7430fb7bac188d4d10d00f08c9bcc6ff836a4c
Python
675
28
import pytest from reinvent.runmodes.RL.memories import BucketCounter @pytest.fixture def bucket_counter(): # no special setup yield BucketCounter(max_size=5, A=6, B=5, C=7, D=4) pass # no tear-down def test_bucket_full(bucket_counter): assert bucket_counter.bucket_full("A") assert bucket_coun...
3d04738dd7c36bda7dac86b30686525dda79bf931f3bb46d087386d163477575
Python
676
29
"""Base objects for varifold implementation.""" import abc import geomstats.backend as gs class Pairing(abc.ABC): """Kernel pairing.""" def _get_kernel_prod_args(self, point_a, point_b): return [x for pair in zip(point_a[:-1], point_b[:-1]) for x in pair] + [ point_b[-1] ] ...
9965815172a50c0f8f324341bfa0f72e72dac6f035f92f22b3a3d003af3d2fde
Python
676
23
# Generated by Django 4.1.5 on 2023-01-14 13:15 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('celsus', '0051_alter_rawdata_value'), ] operations = [ migrations.CreateModel( name='KinaseLibraryModel', fields=[ ...
c63135b8806cb0ef09b6eb3fb3e9c8cf035d41a4d677227466e1cd2c4bfe486f
Python
677
24
import unittest import torch.utils.data as tud from reinvent.models.reinvent.models.dataset import Dataset from reinvent.models.reinvent.models.vocabulary import SMILESTokenizer from tests.test_data import ( SIMPLE_TOKENS, HEXANE, PROPANE, ETHANE, BUTANE, ASPIRIN, ) class TestDatasetFunction...
35de465a0c0f460e74fe37eb05ea5db4d3f5e60d50f8ecf4b9bc426ed5b14242
Python
679
23
import geomstats.backend as gs from geomstats.test.data import TestData class FullRankMatrices32TestData(TestData): def belongs_test_data(self): smoke_data = [ dict( point=gs.array( [ [-1.6473486, -1.18240309], ...
0f886e5e6937ebbb464700fad1049cd5434b397e98555f8f3dafa9e4c2d7dde1
Python
680
20
from tkinter import Tk from tkinter.filedialog import askdirectory, askopenfilename, askopenfilenames def openfoldergui(rootdir=None, title=None): return _get_opengui(askdirectory, initialdir=rootdir, title=title) def openfilegui(rootdir=None, title=None): return _get_opengui(askopenfilename, initialdir=rootd...
582187ec47e68367d73d3793792e756ffb5d83d642b02148ec7798d7c4d601ac
Python
680
31
import sys from navec.pq import PQ from ..pq import ( quantize, pad ) from ..glove import ( parse_glove_emb, trans_glove_emb ) from ..log import log_info def pq_fit(args): records = parse_glove_emb(sys.stdin.buffer) words, weights = trans_glove_emb(records) log_info( 'PQ qdim: %...
74a18c410aa7a456fc4715ab75d05fb692ff90da8b2b644886bdf4877ca7eb27
Python
682
33
# type: ignore __version__ = "0.0.0" __submodules__ = ["core", "paths"] from snakebids import _warningformat # noqa: F401 # isort: split # <AUTOGEN_INIT> import lazy_loader __getattr__, __dir__, __all__ = lazy_loader.attach_stub(__name__, __file__) __all__ = [ "BidsComponent", "BidsComponentRow", "Bid...
c5c310743215fea21ca45c3eb9f8dc2b7882772cd7fa920fcf8bd783c3e11e84
Python
682
18
# Set this to the path to Caffe installation on your system caffe_root = "/path/to/your/caffe/python" gpu = True # ------------------------------------- # These settings should work by default # DNN being visualized # These two settings are default, and can be overriden in the act_max.py net_weights = "nets/caffenet/...
c6f3c14c31cc0e77b207f0967ab45bde05a3d9e0a4c2025f7fef8e4c4d3a64ff
Python
682
27
from __future__ import annotations from enum import Enum class DefaultKeys(Enum): ENERGY = "REF_energy" FORCES = "REF_forces" STRESS = "REF_stress" VIRIALS = "REF_virials" DIPOLE = "dipole" POLARIZABILITY = "polarizability" HEAD = "head" CHARGES = "REF_charges" TOTAL_CHARGE = "tot...
c9ee9401ca2fd1587166166af2ca376a6beb32ba48387a2f0e146657b77f6e72
Python
682
25
""" -------------------------------------------------------------------------------- Date: 19/04/2022 @author: Nikolaos Vardalakis -------------------------------------------------------------------------------- Implementation Notes -------------------------------------------------------------------------------- ...
552e45c8f3c885c0f6b57650e90f54ba84aad30d5ec2fd080fbeac0eeea9fc8a
Python
683
12
def get_read_cut_data(df, read_cut=5, post=False): # takes a df_data, and returns data that has been filtered for read counts # either just in the pre selection, or also in the post-selection (post=True) if post == False: df_read = df[(df.pre1>read_cut) &(df.pre2 > read_cut)] else: df_re...
b0d9115ea53a96df1671d63a51491ea35fdb7e7d48d7a78cabe9283ce9572934
Python
683
26
from sklearn.feature_selection import SelectKBest, mutual_info_classif import pandas as pd import numpy as np data = pd.read_csv("Feature_3102.csv", sep='\t') feature = data.iloc[:, 5:-1] label = data.iloc[:,-1] model = SelectKBest(mutual_info_classif, k=50) feature_new = model.fit_transform(feature, label) feature...
2facd6253bf57bd13d886aebe4866f1358ab70fa3948f2746b7c9dfe48b8c361
Python
684
34
import nidaqmx as ni def demo(): sys = ni.system.System.local() # Display the version number of the driver print('\nNI DAQmx driver version: %s\n' % str(sys.driver_version)) # List all connected device print('Connected devices:') n=1 for device in sys.devices: print('%d. %s' % ...
e0ae0966a53e194563fb0abcdaa9df9ccde206cd6140ed518a7db38a4c4257fd
Python
685
19
import torch.nn as nn import torch.nn.functional as F class Generator(nn.Module): "Define standard linear + softmax generation step." def __init__(self, d_model, vocab): super(Generator, self).__init__() self.proj = nn.Linear(d_model, vocab) def forward(self, x, temperature=1.0): ...
5d0546a6cbe63604ac9be76af256cba74fbf1ad719aa1c06229eab3e30ae0cd3
Python
686
17
from typing import Optional from matplotlib import pyplot as plt from dynaphos.cortex_models import get_cortex_coordinates_default, get_cortex_coordinates_grid def plot_coordinates(params: dict, n_electrodes_x: int, n_electrodes_y: int, x_max: Optional[int] = None): coordinates_cortex = get...
8bb198f6ad175bd291a56d1ef947d402afb9b04422d8ea1e98d7b3c4ace8db83
Python
686
26
from sklearn.feature_selection import SelectKBest, mutual_info_classif import pandas as pd import numpy as np data = pd.read_csv("Feature_3102.csv", sep='\t') feature = data.iloc[:, 5:-1] label = data.iloc[:,-1] model = SelectKBest(mutual_info_classif, k=200) feature_new = model.fit_transform(feature, label) featur...
919e0949cf70f4dd9462cb00205a54de530e739cdbdb832cbaad7c25320a28db
Python
686
26
from sklearn.feature_selection import SelectKBest, mutual_info_classif import pandas as pd import numpy as np data = pd.read_csv("Feature_3102.csv", sep='\t') feature = data.iloc[:, 5:-1] label = data.iloc[:,-1] model = SelectKBest(mutual_info_classif, k=400) feature_new = model.fit_transform(feature, label) featur...
a9a57e78e145a8ddb2c4e47448e516ce6a476c6a0b663b850234143e006a9211
Python
686
26
from sklearn.feature_selection import SelectKBest, mutual_info_classif import pandas as pd import numpy as np data = pd.read_csv("Feature_3102.csv", sep='\t') feature = data.iloc[:, 5:-1] label = data.iloc[:,-1] model = SelectKBest(mutual_info_classif, k=600) feature_new = model.fit_transform(feature, label) featur...
b7d307e512890b7bcb4bf5c6c96c33f27734f898295d9acb868caf0f9d216d43
Python
686
26
from sklearn.feature_selection import SelectKBest, mutual_info_classif import pandas as pd import numpy as np data = pd.read_csv("Feature_3102.csv", sep='\t') feature = data.iloc[:, 5:-1] label = data.iloc[:,-1] model = SelectKBest(mutual_info_classif, k=150) feature_new = model.fit_transform(feature, label) featur...
d1869b1d3cf4313ff489c8f31299830bcc083bb50a2220ec6267e6f0f8dcd50a
Python
686
26
from sklearn.feature_selection import SelectKBest, mutual_info_classif import pandas as pd import numpy as np data = pd.read_csv("Feature_3102.csv", sep='\t') feature = data.iloc[:, 5:-1] label = data.iloc[:,-1] model = SelectKBest(mutual_info_classif, k=800) feature_new = model.fit_transform(feature, label) featur...
e07ba0b07e0f03ac9fd34ca5a9e95f3a3226256913265938212bb9c36d6f1962
Python
686
26
from sklearn.feature_selection import SelectKBest, mutual_info_classif import pandas as pd import numpy as np data = pd.read_csv("Feature_3102.csv", sep='\t') feature = data.iloc[:, 5:-1] label = data.iloc[:,-1] model = SelectKBest(mutual_info_classif, k=100) feature_new = model.fit_transform(feature, label) featur...
5809545d91d714606d3e5f10b49ed1f4229ddd378cb5048a234c61464a837533
Python
687
18
# Copyright (c) 2021 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...
7216bd8396884cd89d3a0463f57a4d9e3f5a20e2b886bd51f78fd23d0ba3cc0a
Python
688
27
import sys from pathlib import Path from importlib import import_module from ... import logger def load_config(cfg_module): """ Dynamic loading of a config file module. Parameters ---------- cfg_module : str The absolute path to the config file to load. """ cfg_module = Path(cfg_...
a30100882ad9ca54387d201b8e07030281a5bc0e36d9cbb3b24265c89e6841ad
Python
689
26
from sklearn.feature_selection import SelectKBest, mutual_info_classif import pandas as pd import numpy as np data = pd.read_csv("Feature_3102.csv", sep='\t') feature = data.iloc[:, 5:-1] label = data.iloc[:,-1] model = SelectKBest(mutual_info_classif, k=1000) feature_new = model.fit_transform(feature, label) featu...
4573a750886981aa53998d342e704bfd1a3049c0945d646012606b689db86099
Python
690
20
import pytest from geomstats.geometry.heisenberg import HeisenbergVectors from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test_cases.geometry.heisenberg import HeisenbergVectorsTestCase from .data.heisenberg import HeisenbergVectors3TestData, HeisenbergVectorsTestData class TestHeisenb...
74c546976ab0f71d5251ba9869a93f0b0c06e5c0ccb5f429cce6bd5b5d916067
Python
691
27
# ============================================================================== # Copyright 2025 Technical University of Denmark # Author: Nikolas Borrel-Jensen # # All Rights Reserved. # # Licensed under the MIT License. # ============================================================================== import argparse ...
7c1def19f602698c5a30afc0788cd38a48cc110e0b59ae5354a3d5c6a690c2a6
Python
692
19
from assist.experiment_names_lookup import trained_models import config from shutil import copyfile models_to_move = trained_models['ensembles_isbi'] res_path = config.results / 'model_evaluation' moved_path = config.results / 'tmp_results' moved_path.mkdir(exist_ok=True) for model_name in models_to_move: if 'f...
7bbf92361a578eeeadf1faa31a52b48874640c94e15876918bbe9e0b0a23c7e3
Python
694
38
import utils """ The class MyOwnDatasetClass arguments: files: files to be read in functions: process: main logic of file processing return_data: returns processed data list """ class MyOwnDatasetClass: def __init__(self, files): self.files = files self.data = self.process() def return...
981f0084f31bcfb50ffc9c8e2cd2290b6d78b0dd5214ea154157f51eeea21335
Python
695
21
import click from corgie import scheduling from corgie.log import logger as corgie_logger from corgie.log import configure_logger @click.command() @click.option('--lease_seconds', '-l', nargs=1, type=int, required=True) @scheduling.scheduler_click_options @click.option('-v', '--verbose', count=True, help='Turn on de...
0d42d72b0fa2b8992a0589092c4bd9937c0bb8a3786c37e7f4a2c8e35c17057e
Python
698
19
# Copyright (c) 2022 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...
39a5afe8d265b9576643f7772b834de2a83f288f3aa951b71a7ac64f155fe126
Python
698
35
import tarfile from io import BytesIO from .record import Record class Tar(Record): __attributes__ = ['path'] mode = 'r' def __init__(self, path): self.path = path def __enter__(self): self.tar = tarfile.open(self.path, self.mode) return self def __exit__(self, *args)...
66c56aaad66b32f6676eeb9e3520a937f50e7f25cd5d8200be2c0a60b70e8e56
Python
698
31
from geomstats.test.test_case import TestCase class OptimizerTestCase(TestCase): def test_minimize( self, fun, x0, expected, atol, fun_jac=None, fun_hess=None, hessp=None, ): res = self.optimizer.minimize( fun, x0, fun_jac=fun...
fecf9bb63cf5cf4ab7052245d71caebd8dec9fa27e73added81f0aca610a8e43
Python
698
19
""" -------------------------------------------------------------------------------- Date: 16/06/2022 @author: Nikolaos Vardalakis -------------------------------------------------------------------------------- Implementation Notes -------------------------------------------------------------------------------- ...
273db317627fd92e05ed76e1d29589d95604b9a17d4d28c059eaf5fc1f959069
Python
701
20
import pandas as pd from Code.utils import plot_heatmap import matplotlib.pyplot as plt PATH = 'Baselines/baseline_generalization/' # save data df_auc_hmp = pd.read_pickle(PATH + f'auc_mean.pkl') df_aupr_hmp = pd.read_pickle(PATH + f'aupr_mean.pkl') df_auc_std_hmp = pd.read_pickle(PATH + f'auc_std.pkl') df_aupr_std_h...
35cda004f74cd59caea974b1a8acfdfdddc9f1ed1e92f8db921ada6427d8f4cd
Python
702
27
import numpy as np from smithers.io import VTPHandler as Handler test_file = "tests/test_datasets/cube.vtp" def test_points(): data = Handler.read(test_file) np.testing.assert_array_almost_equal(data["points"][0], [-0.5] * 3) def test_number_points(): data = Handler.read(test_file) np.testing.asser...
7eb6e31e54bc2f67c9dadeb5a9c1694911d6a8808748faaa0088513f0de29c2d
Python
703
27
import numpy as np from reinvent_plugins.components.RDKit.comp_group_count import ( Parameters, GroupCount, ) def test_comp_group_count(): smarts = ["ClccccF"] smiles = ["c1cc(F)ccc1Cl"] params = Parameters(smarts) gc = GroupCount(params) results = gc(smiles) assert results.scores[0] ...
4278eea9b6146d99c1248e747c573ffab38d815d36094d64c7a7ee9f396cf6df
Python
704
20
import numpy as np from smithers.io import VTKHandler poly_file = "tests/test_datasets/cube.vtk" ugrid_file = "tests/test_datasets/cube_grid.vtk" def test_polydata(): data = VTKHandler.read(poly_file) np.testing.assert_array_almost_equal(data["points"][0], [-0.5] * 3) np.testing.assert_equal(data["point...
7c61a17e56d31d67b1e6d24882856a4f4b6f50960768ad0f9d9962819a8cca34
Python
704
30
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. from .torch_versions import ( _TORCH_GE_2_4, _TORCH_GE_2_6, _TORCH_GE_2_7, _TORCH_GE_2_8, _TORCH_GE_2_9, _TORCH_GE_2_10, _TORCH_GE_2_13, _TORCH_IS_2_10_0, _TORCH_IS_...
7cbc3a378dde8551c89bab1bcfc03496faae5cf37836a7ba75cc7f3fcd95d356
Python
704
23
# Generated by Django 4.1.1 on 2023-01-02 11:33 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('auth', '0012_alter_user_first_name_max_length'), ('celsus', '0045_curtain_curtain_t...
52b6b54fe1562f294af9fcaa284eb076afa89fdcbf92c933ab8f5837575d5a78
Python
712
23
import geomstats.backend as gs from geomstats.test.data import TestData from .base import ComplexMatrixVectorSpaceTestData class HermitianMatricesTestData(ComplexMatrixVectorSpaceTestData): pass class HermitianMatrices2TestData(TestData): def belongs_test_data(self): data = [ dict(point...
a82dcf8471e0dbc078ab6c1869770d288e70159e9292a357eff0a93d5044fb7d
Python
712
18
from geomstats.geometry.positive_reals import PositiveReals from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test_cases.geometry.base import VectorSpaceOpenSetTestCase from geomstats.test_cases.geometry.riemannian_metric import RiemannianMetricTestCase from .data.positive_reals import Posi...
d1421a177e65f384417912e8be53cd34fa3c6eab9932f663a81843fd0a1714be
Python
713
25
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # from torch import nn, Tensor from typing import Tuple, Optional from . import register_act_fn @register_act_fn(name="leaky_relu") class LeakyReLU(nn.LeakyReLU): """ Applies a leaky relu function. See `Rec...
8aaf6d5b0970f9c7d409d3f393874d2879b1bf4eaf929d381d3e6d92ae008280
Python
717
26
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # from torch import nn, Tensor from typing import Optional, Tuple class Softmax(nn.Softmax): """ Applies the Softmax function to an input tensor along the specified dimension Args: dim (int): Di...
7bc5afb01715c5df69b9b951f94b63db9ef943627bc90f3ecf355d321b165446
Python
718
28
# Generated by Django 2.1 on 2018-08-27 01:38 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='tcgapatient', fields=[ ('id', models.AutoFiel...
d2eb36158194a01df066dd2919a37de69445caaebe98304640b8149d294a3836
Python
718
20
from PymoNNto.NetworkCore.Behavior import * class Normalization(Behavior): def initialize(self, neurons): self.syn_type = self.parameter('syn_type', 'GLUTAMATE', neurons) self.norm_factor = self.parameter('norm_factor', 1.0, neurons) neurons.temp_weight_sum = neurons.vector() def iter...
214dbdbcd4bde84287bf9faa0b838097cd2599a5b327d1bf5f0bcadd596b5d0a
Python
720
18
# 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 # # Un...
ffd293f6d3e546462e469f340bdb62690063f51e5bba7dcf2ab253abd9b2f3f5
Python
721
39
from StringIO import StringIO import string testcases = r"""1 -> 1 1"2" -> 12 1"2 -> 12 1"\"2" -> 1"2 "1" "2" -> 1, 2 1\" -> 1" 1\\" -> 1\ 1\\\" -> 1\" 1\\\\" -> 1\\ 1" 1 -> 1 1 1\" 1 -> 1", 1 1\1 -> 1\1 1\\1 -> 1\\1 """ #testcases = r"""1\\\\" -> 1\\ #""" t = StringIO(testcases) def quote(s): result = ...
b73de9a353c88e8d5e71769a8d38967c275fe3721a85795e61d598ab6b4e99ae
Python
722
23
# Generated by Django 4.1.1 on 2022-12-19 15:47 from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('celsus', '0043_curtain_description'), ] operatio...