sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
ed12879dde7c0835c942830d0362b7301535ff0ba51cc9cc071a16882cedb006 | Python | 1,074 | 36 | import unittest
import torch
from torcheeg.models import BCDecoder, BCEncoder, BDecoder, BEncoder
class TestVAE(unittest.TestCase):
def test_bvae(self):
encoder = BEncoder(in_channels=4)
decoder = BDecoder(in_channels=64, out_channels=4)
mock_eeg = torch.randn(1, 4, 9, 9)
mu, log... |
246ca797cbf6ecf56887eb73d39a23fafd0288e4d2887cb70d8f464fdcffb86c | Python | 1,075 | 33 | from setuptools import setup, find_packages
with open(file='README.md', mode='r') as fh:
long_description = fh.read()
setup(
name='fba',
version='0.0.10.post0',
author='JD',
description='Tools for feature barcoding analyses',
long_description=long_description,
long_description_content_type... |
306d0d00aecd0289fc03d25369c0b4161fbe406d6201c1e9fd442b007d4a575b | Python | 1,075 | 12 | """posthoc_law_named_sets_2026-10-02.py — POST HOC, descriptive (within the pre-registered C3 data of ONE_INEQUALITY_CONFIRM).
Where each named sign set of both flies sits on the law's scale, and whether its spiking verdict (PHASE_MAP) is on the side the
law says. Explains why BANC's laboratory prior, healthy in FlyWir... |
72ca0db16479f4fd69006f3378bff69d88006f3239ceae6b9d2a19590f9ae5e8 | Python | 1,075 | 27 | import torch
import torch.nn as nn
from model.LowResNet.model import LowResNet
from model.HighResNet.model import HighResNet
from model import const
class TwoResNet(nn.Module):
"""Some Information about TwoResNet"""
def __init__(self, in_feat, LowResNet_kwargs, HighResNet_kwargs):
super(TwoResNet, ... |
7bef50b1ad45bdc5b3446206dd8a43c4bc4ee1bee55bfcb5d3af89ffe3b2ee7f | Python | 1,075 | 14 | # Publication: "Protein Docking Model Evaluation by Graph Neural Networks", Xiao Wang, Sean T Flannery and Daisuke Kihara, (2020)
#GNN-Dove is a computational tool using graph neural network that can evaluate the quality of docking protein-complexes.
#Copyright (C) 2020 Xiao Wang, Sean T Flannery, Daisuke Kihara, and... |
818e0554ee011a63b600cee32f3ddf14dacdb8b494468a420fdc15d417484176 | Python | 1,075 | 33 | from setuptools import setup, find_packages
setup(
name='RAISING',
version='1.0.1',
author='Devashish Tripathi',
author_email='devashishtripathi697@gmail.com',
description='RAISING: A supervised deep learning framework for hyperparameter tuning and feature selection',
long_description=open("REA... |
b13d761412c0c430bac32ac3a2b87c92f719d631b9a889c2456cf33fe5242624 | Python | 1,075 | 37 | import logging
import os
from typing import Optional
from pip._vendor.pyproject_hooks import BuildBackendHookCaller
from pip._internal.utils.subprocess import runner_with_spinner_message
logger = logging.getLogger(__name__)
def build_wheel_pep517(
name: str,
backend: BuildBackendHookCaller,
metadata_di... |
f580d517073e6f5f15b69260c6dc2892c364b3a46a200ed2aa62d4ed3eeb7c60 | Python | 1,075 | 39 | from collections.abc import Iterable
from datetime import datetime
from elasticai.creator.file_generation.resource_utils import read_text
from elasticai.creator.hdl_ir import DataGraph
from elasticai.creator.ir2verilog import (
Code,
Registry,
TemplateDirector,
type_handler_iterable,
)
@type_handler_... |
fcf09fd934f62834dba212259836b1c272331f13f072f8a5010bad18d6c5e944 | Python | 1,075 | 40 | ##
# \file installation_test_fetal_brain_seg.py
# \brief Class to test installation of fetal_brain_seg
# (https://github.com/gift-surg/fetal_brain_seg)
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date March 2019
#
import os
import unittest
import pysitk.python_helper as ph
fr... |
be2f3329f4d68360de35b8590f356e3cee221a79dd3e351aabbb8e1ae3911e9e | Python | 1,076 | 40 | from pathlib import Path
import click
import networkx as nx
from skymap import SkyMap
from skymap.constants import banner
@click.group()
def cli():
print(banner)
@cli.command() # @cli, not @click!
@click.option(
"-g", "--graph", "graph", type=click.Path(exists=True, dir_okay=False), required=True
)
@clic... |
25b5e74853fd95b40b73e180a5466b7b92daea7b6504f024b5f2afd89edd23e8 | Python | 1,077 | 40 | """
AGFusion is a python package to annotate and visualize gene fusions.
"""
import re
from setuptools import find_packages, setup
VERSIONFILE = "agfusion/version.py"
version = open(VERSIONFILE, "rt", encoding="utf8").read()
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
mo = re.search(VSRE, version, re.M)
if mo:
... |
be2db29b6daf9f4af0eb290c6d0553bdcf7d4fee0bae30f75b8337e1bdc321c1 | Python | 1,077 | 28 | from sitetack.app.sequence import Sequence
from sitetack.app.kmer import Kmer
class TestSequence:
@classmethod
def setup_class(cls):
cls.multiple_s = Sequence(sequence_name='RNase_1', sequence='SMASLEKS')
cls.no_s = Sequence(sequence_name='RNase_1', sequence='MALEK')
def test_get_phos... |
f9a75df0b8c2268234d2f73c5af5bb3682ff23e35b0f299989e913bfdd5f22f9 | Python | 1,077 | 39 | from typing import Any, Protocol
import torch
from elasticai.creator.base_modules.math_operations import Add, MatMul, Quantize
class MathOperations(Quantize, Add, MatMul, Protocol): ...
class Linear(torch.nn.Linear):
def __init__(
self,
in_features: int,
out_features: int,
oper... |
2dd4c1e120192b705b18f864eb4eb3143c9fe621d9da5d0a6985d61d1097ad7d | Python | 1,078 | 35 | # -*- coding: utf-8 -*-
from os.path import join as opj
from os import path
from setuptools import setup, find_packages
# Get version and release info, which is all stored in dcm2bids/version.py
ver_file = opj('dcm2bids', 'version.py')
with open(ver_file) as f:
exec(f.read())
# Long description will go up on the... |
95fd353a280969151a7bf3c01fc9be2187e9205804e61200968b6f1e61e7c80e | Python | 1,078 | 42 | from setuptools import setup, find_packages
import acsconv
def readme():
with open('README.md', encoding='utf-8') as f:
content = f.read()
return content
setup(
name='ACSConv',
version=acsconv.__version__,
url='https://github.com/M3DV/ACSConv',
license='Apache-2.0 License',
autho... |
a66091a39394898d80fef45e567e9c5d3a389793de0d85575b98e25849933d89 | Python | 1,078 | 40 | """
Optuna example that optimizes a classifier configuration for cancer dataset using LightGBM tuner.
In this example, we optimize the cross-validated log loss of cancer detection.
"""
import optuna.integration.lightgbm as lgb
from lightgbm import early_stopping
from lightgbm import log_evaluation
import sklearn.da... |
a9694d8a94910d769a30e254267dc2f48488c08ac6f079d7a6260a63a8f8fea9 | Python | 1,078 | 46 | # -*- coding: utf-8 -*-
#
# Helper routines to normalize Fourier spectra
#
import numpy as np
def _norm_spec(ftr, nSamples, fs, mode="bins"):
"""
Normalizes the complex Fourier transform to
power spectral density or 1Hz-bin units.
"""
# frequency bins
if mode == "density":
delta_f =... |
d4606abf8cd595d53d44b065eeb330c262554c319f82f081070a4f65fee17a7d | Python | 1,078 | 39 | import math
import numpy as np
from itertools import permutations
def poly_factory(dim, order, rng=None):
"""Generates a random multi-dimensional polynomial function."""
if rng is None:
rng = np.random.RandomState(1)
coeffs = []
for i in range(order + 1):
tmp = rng.normal(size=(dim,... |
d67b8348813591ed77c62f368172bb5f89f4abbf9cb67a37e3a35b39c286b666 | Python | 1,078 | 16 | #----------------------------------------------------------------------------------------------------------------------------
# Author: Brandon S Coventry CAP Lab Purdue University Weldon School of BME
# Date: 09/02/20
# Revision History: N/A
# Purpose: This is the setup file to get spiking reinforcement learni... |
63c577c69c5a42ed417e9690fc9fb05f152a28f5cb3c29e8731937f62efbe039 | Python | 1,079 | 37 | #!/usr/bin/env python
import sys, re
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
INFILE = sys.argv[1] if (len(sys.argv) == 2) else "expected_outputs/stdout.out"
x_before = []
y_before = []
z_before = []
n = []
for line in open(INFILE) :
tokens = re.split("\s+",line.strip())
if len(t... |
8d7176b0fe88aa2c031de7dedbdf821e465426129d9bca9cc0d198fe658f22fa | Python | 1,079 | 26 | from hed.models.hed_string import HedString
from hed.models.hed_tag import HedTag
from hed.models.hed_group import HedGroup
from hed.errors.error_reporter import get_printable_issue_string
from hed.errors.exceptions import HedFileError, HedExceptions, HedQueryError
from hed.models.spreadsheet_input import SpreadsheetIn... |
a13f37f14a163c865d1bbc96663ab3661011a217190dd17b8aa17cc1b8bf75b0 | Python | 1,079 | 30 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
d48211ca51b7f73e7e773ab4f51fe782e7f1c8f67182574d6ebc4ac541b018a1 | Python | 1,079 | 49 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
from contextlib import contextmanager
from io import StringIO
import sys
import os
class StreamTTY(StringIO):
def isatty(self):
return True
class StreamNonTTY(StringIO):
def isatty(self):
return False
@contextmanager
... |
eeae7aa4885bfa122153d29ef026e5b8e5878a6a5fcbdb3b04525fbaf4fe7c6e | Python | 1,079 | 35 | import re
from pathlib import Path
import PatientEvaluation
do_overlay = 1
# gaussian, rect, noise, both, gauss_noise
mods = 'gaussian'
overlay_widths = [4,7,16]
folder_selected = None
if mods == 'rect':
folder_selected = Path("../../data/rect")
if mods == 'gaussian':
folder_selected = Path(r"../../data/gauss... |
06984dc529b16301acdbc81acebeedd6675ee322cda062b07bb30e43932ec8bf | Python | 1,080 | 24 | ###########################################################################################
# #
# Set up paths for the Object Detection Metrics #
# ... |
3a40ea54d13c5de584339120fc248a1be04d078eb2c270a9356917ad86f599cc | Python | 1,080 | 35 | from __future__ import annotations
from importlib.util import find_spec
from pathlib import Path
from shutil import rmtree
TEST_RESULTS_DIR = Path(__file__).parent / "_test_results"
TEST_SCRATCH_DIR = Path(__file__).parent / "_test_scratch"
TEST_RUNINFO = Path(__file__).parent / "runinfo"
has_parsl = bool(find_spec(... |
57956c1baa55c65cd07304e82adc082ee18120c2e4c5d595538343f3bcf08e52 | Python | 1,080 | 29 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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
#
# ht... |
b7bec0f0607a1c59ec4283348bb0ebdc8552afcac12d7a2d4d4f509ddd338d4b | Python | 1,080 | 48 | ## linear-chirped pulse planewave with higher frequencies at the front (down-chirp)
import numpy as np
import meep as mp
resolution = 40
dpml = 2
pml_layers = [mp.PML(thickness=dpml, direction=mp.X)]
sx = 40
sy = 6
cell_size = mp.Vector3(sx + 2 * dpml, sy)
v0 = 1.0 # pulse center frequency
a = 0.2 # Gaussian env... |
b8e57fafbc5854fabdf273978b2ba9bf7e2a9596969c1040d0158ee6dc0ee5f7 | Python | 1,080 | 40 | from collections.abc import Iterable
from datetime import datetime
from elasticai.creator.file_generation.resource_utils import read_text
from elasticai.creator.hdl_ir import DataGraph
from elasticai.creator.ir2verilog import (
Code,
Registry,
TemplateDirector,
type_handler_iterable,
)
@type_handler_... |
f61f6752c05e26f2134540ad5625827f5b87276b8ff0d101d0983cd666b3f971 | Python | 1,080 | 39 | from collections.abc import Sequence
from elasticai.creator import ir
from elasticai.creator.ir2vhdl import (
Code,
Ir2Vhdl,
IrFactory,
PluginLoader,
)
def _assert_line_structure(code: Code, expected_name: str) -> None:
name, lines = code
assert name == expected_name
assert isinstance(lin... |
3208b9f6163220feb8999593350a1a0617f7a8f00bf813a01affbba67410b8b9 | Python | 1,081 | 29 | """Contains the features' labels. These are used for plotting."""
features_labels = {
"CC_to_C_rate": "$CC$ to $C$ rate",
"CD_to_C_rate": "$CD$ to $C$ rate",
"DC_to_C_rate": "$DC$ to $C$ rate",
"DD_to_C_rate": "$DD$ to $C$ rate",
"SSE": "SSE",
"Makes_use_of_game": "Make use of game",
"Makes... |
e78a7f4a755e4506ecd950051d6ca0cfd39210d840fb59359b681b0313f5dac0 | Python | 1,081 | 33 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from downward.experiment import FastDownwardExperiment
from downward.reports.compare import CompareConfigsReport
import common_setup
REPO = common_setup.get_repo_base()
REV_BASE = 'issue585-base'
REV_V3 = 'issue585-v3'
SUITE = suites.suite_op... |
e14b82cada0f1bf6aac3c38de1badd8bfab2833931cdf7173445982ef4fc61d3 | Python | 1,082 | 37 | import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="cobolt", # Replace with your own username
version="0.0.1",
author="boyinggong",
author_email="boyinggong@berkeley.edu",
description="A package for joint analysis of multi... |
a149536914b827b767e0d19715bc94900efc5753a987ebb0c3933b354c2acf8d | Python | 1,083 | 33 | # import torchvision
import numpy as np
import scipy.signal
from pathlib import Path
import torch
import os
from tqdm import tqdm
import math
from Datasets.MnistExample.dataset_loader import get_mnist
from Datasets.PickleLoader.dataset_loader import get_md
from Utilities.transforms import AVAILABLE_TRANSFORMS
AVA... |
b866f07255f53882570dde3c216efc47dafcca1356cadec4262c12220b5aa986 | Python | 1,083 | 37 | import pytest
import elasticai.creator.nn.fixed_point as nn_creator
from elasticai.creator.arithmetic import FxpArithmetic, FxpParams
from tests.integration_tests.nn.fixed_point.precomputed_routine import (
routine_testing_precomputed_module,
)
@pytest.mark.ghdl
@pytest.mark.parametrize(
"total_bits, frac_bi... |
c02c649d18b0266aa9b6c88b4b2cd1b21fa4e86335868c91872f14c0dfb3f0d7 | Python | 1,083 | 16 | #----------------------------------------------------------------------------------------------------------------------------
# Author: Brandon S Coventry CAP Lab Purdue University Weldon School of BME
# Date: 09/02/20
# Revision History: N/A
# Purpose: This is the setup file to get spiking reinforcement learni... |
06e6beaab8bc2957e4a80b42c74adcb5e91a3848419ddc00c4c27ef190a01692 | Python | 1,084 | 36 | """
Optuna example that optimizes a classifier configuration using OptunaSearchCV.
This example is the same as `sklearn/sklearn_optuna_search_cv_simple.py` except
that you leave termination of the study up to the terminator callback.
"""
import optuna
from optuna.terminator import TerminatorCallback
from sklearn.dat... |
5bf9c2b10220f4f0f4e0ff474ea19504dc699cfe9ec913ee7a46f168760b0490 | Python | 1,084 | 33 | import os
import xlsxwriter
from openpyxl import load_workbook
def check_excel_exist_general(subjects, fname, sheetname, col_names):
# If the excel workbook doesn't exist, create it
if not os.path.isfile(fname):
workbook = xlsxwriter.Workbook(fname)
worksheet = workbook.add_worksheet(name=shee... |
8daead1a0c9c03adba63a5e8304bed61c88334c6849bb049677b37178c13eb71 | Python | 1,084 | 31 | import pandas as pd
def load_data(file_path):
# Load data from a CSV file
return pd.read_csv(file_path)
def clean_data(df):
# Remove any rows with missing values in essential columns
df = df.dropna(subset=['Plaintiff\'s Custody Request', 'Court\'s Ruling', 'Pivotal Arguments'])
# Normaliz... |
e9e541dbcc3dbf08c0ea0acb6332336ab12d7ac2d4b4321dc044d2103e4ffbcb | Python | 1,084 | 40 | from collections.abc import Iterable
from datetime import datetime
from elasticai.creator.file_generation.resource_utils import read_text
from elasticai.creator.hdl_ir import DataGraph
from elasticai.creator.ir2verilog import (
Code,
Registry,
TemplateDirector,
type_handler_iterable,
)
@type_handler_... |
f2a2f27b2e5ef2aa0f9c06edf44206438650dc23c97954c9626509b2e5aaea41 | Python | 1,084 | 43 | import sys
from pybioshell.core.data.io import Pdb
if len(sys.argv) < 2 :
print("""
Reads a PDB file and extracts some basic information from its header
USAGE:
python3 pdb_info.py input.pdb [input2.pdb]
EXAMPLE:
python3 pdb_info.py 2kwi.pdb
CATEGORIES: core/data/io/Pdb
KEYWORDS: PDB input;
GROUP:... |
fef734fed08c398272f3763e85ab225b95dad222077b626298f036912ae95b68 | Python | 1,084 | 45 | # built-in
from math import isclose
# external
import hypothesis
import pytest
# project
import textdistance
ALG = textdistance.Jaccard
@pytest.mark.parametrize('left, right, expected', [
('test', 'text', 3.0 / 5),
('nelson', 'neilsen', 5.0 / 8),
('decide', 'resize', 3.0 / 9),
])
def test_distance(lef... |
a1522d9ab10f13b36cc971e97df1f33e2583b54eb9bfa4c717bc4e65a612b4dd | Python | 1,085 | 28 | from .features_generators import get_available_features_generators, get_features_generator, \
morgan_binary_features_generator, morgan_counts_features_generator, rdkit_2d_features_generator, \
rdkit_2d_normalized_features_generator, register_features_generator
from .featurization import atom_features, bond_feat... |
a646f6b9211e428e278f7724024cb86d7a4dbd6a64321aeb00d5d13bb26a4602 | Python | 1,085 | 39 | import sys
from pybioshell.core.data.io import Pdb, write_pdb
if len(sys.argv) < 2 :
print("""
Reads multiple PDB files and writes C-alpha atom of all structures into a single multimodel pdb file.
The input file is a simple text file providing PDB file names (one string per line).
USAGE:
python3 caon... |
f889c6035fe225357f0af522da0c599a788f1ab98e0b734085c727f096fa0256 | Python | 1,085 | 13 | """posthoc_dominant_thresholds_2026-10-02.py — POST HOC, descriptive (after DOMINANT_INPUTS, 2 Oct night).
Do 'dominant inputs are common' and 'dominant inputs are mostly inhibitory' depend on the thresholds (2% share, 3x lead),
which were set just below the two known keystones?"""
import pandas as pd
R = 'D:/eucys'; P... |
be4c5bd968e7dabb4d9f933e4ee7577f5a06f8f585b2ff7877977a359f2b7499 | Python | 1,086 | 32 | from cloudvolume import CloudVolume
src_path = 'gs://neuroglancer/basil_v0/raw_image_cropped'
dst_path = 'gs://neuroglancer/basil_v0/raw_image_cropped/permuted'
def get_xy_slice(cv):
o = cv.voxel_offset
s = cv.shape
return slice(o[0], o[0]+s[0]), slice(o[1], o[1]+s[1])
for mip in range(9,-1,-1):
src_cv = CloudVo... |
433363b375de9d0a5dd42a969e78a58b31a41924bdc03a0090efa2f400d8d692 | Python | 1,087 | 36 | import os
from torchdrug import data, utils
from torchdrug.core import Registry as R
@R.register("datasets.HIV")
@utils.copy_args(data.MoleculeDataset.load_csv, ignore=("smiles_field", "target_fields"))
class HIV(data.MoleculeDataset):
"""
Experimentally measured abilities to inhibit HIV replication.
St... |
82bb77d3abe7500460797a65fd3e9a1e4db9d1f6f9a645467b06ef50b6c93b9c | Python | 1,087 | 51 | """To see the steady-state activation/inactivation variables and time constants in KQT3"""
import numpy as np
import math
import matplotlib.pyplot as plt
import os
x = np.arange(-90, 90, 0.1)
vhm = 20.4
ka = 7.7
vhh = -7.0
ki = 5.8
atm = 26.6
btm = -33.7
ctm = 15.8
dtm = -33.7
etm = 15.4
ftm = 2.0
ath = 1400
y1 = []
... |
59932b2252f303896977510f4d384a064143d4b465fc5c6aa15798c0a690a87b | Python | 1,088 | 42 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import downward.configs
import downward.suites
CONFIGS = downward.configs.default_configs_satisficing(extended=True)
# The following lines remove some configs that we don't currently
# support because the respective configurations are commented out
DISABLED = [
"se... |
8289f46f91069ca951dc0e30868aa0a77f767e543caa2606cdf4b890357ba41e | Python | 1,088 | 44 | from mysql_conf import db
import pymysql
import numpy as np
class Mysql:
def __init__(self):
self.connection = pymysql.connect(host= db['host'], port= db['port'] , user=db['user'], passwd=db['password'], db=db['database'])
print 'connected to database'
def __del__(self):
self.connection.close()
p... |
9c22257218aed0ff5f53820897d7e87e8b64c223a43a998aca1831da3846b37e | Python | 1,088 | 31 | # Plot effect sizes for all parameters that preferentially activated the I1-wave
# for S1 Appendix Fig G
from os.path import join
from get_paths import *
from TVATPlotting import TVATPlotting
import matplotlib.pyplot as plt
if __name__ == "__main__":
## Load data
fname_regressions = "data_tvat_polyn... |
bffbf00d0c1519f9de17d8672a1c2004be77cbd4613140aab27468dbd2687f5f | Python | 1,088 | 47 | # Configuration file for the Sphinx documentation builder.
# -- Project information
project = 'pyspi'
copyright = '2022, Oliver M. Cliff'
author = 'Oliver M. Cliff'
release = '0.4'
version = '0.4.0'
# -- General configuration
extensions = [
'sphinx.ext.duration',
'sphinx.ext.doctest',
'sphinx.ext.autod... |
fc6a7eaeafdd517a17580a5c65f1b6060e44b7ecffaf73aa749f482446f2212a | Python | 1,088 | 39 | from collections.abc import Iterable
from datetime import datetime
from elasticai.creator.file_generation.resource_utils import read_text
from elasticai.creator.hdl_ir import DataGraph
from elasticai.creator.ir2verilog import (
Code,
Registry,
TemplateDirector,
type_handler_iterable,
)
@type_handler_... |
8ea5855406ad668ff3edce5641cc0aea3886f9895dd6dc8c2a5a1ff9578a2009 | Python | 1,089 | 35 | """
Copyright (C) 2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... |
d3e8feb89b92526db5c76fb73e75414ad941331f00451091e2028488208c4643 | Python | 1,089 | 32 | from __future__ import annotations
import pytest
from ase.build import bulk
from quacc.recipes.emt.elastic import bulk_to_deformations_flow
def test_elastic_jobs(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
atoms = bulk("Cu")
outputs = bulk_to_deformations_flow(atoms, run_static=False)
asse... |
1c88aee4ed9921b5177fff128d325f68350c74b99c2286ec32931782a6c88e38 | Python | 1,090 | 38 | #!/usr/bin/python3
def vcf_to_plink(vcf):
sys.stdout = sys.__stdout__
cmd = ['plink', '--vcf-filter', '--vcf', args.vcf, '--geno', args.geno, \
'--maf', args.maf, '--make-bed', '--const-fid', "--out", args.out]
subprocess.run(cmd)
if __name__ == '__main__':
import argparse
import su... |
7ed2c4abd18d61f5d11aa4f2f386fd1e7ca55a096ce8cfbd5e01ec5826825375 | Python | 1,090 | 40 | from collections.abc import Iterable
from datetime import datetime
from elasticai.creator.file_generation.resource_utils import read_text
from elasticai.creator.hdl_ir import DataGraph
from elasticai.creator.ir2verilog import (
Code,
Registry,
TemplateDirector,
type_handler_iterable,
)
@type_handler_... |
8b3de793e2eb4ec9f7612c0b2b2bd54b46fef37b015c34fa4e9d8e58f62b8376 | Python | 1,090 | 36 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
b2492d161e1197b4895a0aad819c8fbd23c0d7ded77c16130f25dff3c36f095b | Python | 1,090 | 61 | #!/usr/bin/env python
# coding: utf-8
# In[13]:
import pandas as pd
# In[14]:
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
# In[15]:
P=pd.read_csv("beta_matrix_filename", index_col=0) #you will need to put the filename and directory of beta matrix
# In[16]:
class MidpointNo... |
1f320bc64f35baece6213551a65db95b2517846ba0e150a39ad3e16eba74f81d | Python | 1,092 | 32 | from sklearn.mixture import GaussianMixture
from BEBE.models.model_superclass import BehaviorModel
import yaml
import numpy as np
import pickle
import os
class gmm(BehaviorModel):
def __init__(self, config):
super(gmm, self).__init__(config)
self.downsample = self.model_config['downsample']
self.model = ... |
6da7b239b62344c1d4e37a85d40180a861e6593deb5442deaf79c09cb0866892 | Python | 1,092 | 40 | from collections.abc import Iterable
from datetime import datetime
from elasticai.creator.file_generation.resource_utils import read_text
from elasticai.creator.hdl_ir import DataGraph
from elasticai.creator.ir2verilog import (
Code,
Registry,
TemplateDirector,
type_handler_iterable,
)
@type_handler_... |
acd36c7fa9635457767d7d1fa16cdfd0eb42a88e49c603cf9c549b958a265bfa | Python | 1,092 | 40 | from collections.abc import Iterable
from datetime import datetime
from elasticai.creator.file_generation.resource_utils import read_text
from elasticai.creator.hdl_ir import DataGraph
from elasticai.creator.ir2verilog import (
Code,
Registry,
TemplateDirector,
type_handler_iterable,
)
@type_handler_... |
1f1f0dc487f33c2738743a71f1a0131540a5175ad23ba0ec311363fff5c4a5c9 | Python | 1,094 | 41 | import sys
import argparse
from PyQt5 import QtWidgets
from merlin.core import dataset
from merlin.util import binary
from merlin.view.widgets import regionview
temp = '180710_HAECs_NoFlow_HAEC2\Sample1'
def build_parser():
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--data-set', required... |
6010c5ef263d4e16b66f88ac7a7883b35567a946fe4d4da8c50d6c4e29d8d09a | Python | 1,095 | 33 | import asyncio
import os
from flask import request
from okta_jwt_verifier import BaseJWTVerifier, JWTUtils
from cirrocumulus.auth_exception import AuthException
from cirrocumulus.envir import CIRRO_AUTH_CLIENT_ID, CIRRO_AUTH_ISSUER
class OktaAuth:
def __init__(self):
self.loop = asyncio.get_event_loop()... |
8f5a6c4a25b6af8805927a837424ccab0e34617600b1f5d156d9228a42cf0958 | Python | 1,095 | 29 | from examples.drake.generators import get_grasp_gen_fn, get_pose_gen
from examples.drake.utils import get_base_body, get_body_pose, user_input, get_model_name
def test_generators(task, diagram, diagram_context):
mbp = task.mbp
context = diagram.GetMutableSubsystemContext(mbp, diagram_context)
# Test gras... |
62f72261a26cdcf142ceb11007a53969f4d706838c6244170046c5335c628fc6 | Python | 1,096 | 47 | import numpy as np
def notch(n, sigma):
"""Generates a 1D gaussian notch filter `n` pixels long
Parameters
----------
n : int
length of the gaussian notch filter
sigma : float
notch width
Returns
-------
g : ndarray
(n,) array containing the gaussian... |
7d77108239bbb8f9e087856adaaa0152246e57b00ac7f4893a5e4b133f3d5236 | Python | 1,096 | 54 | """To see the steady-state activation/inactivation variables and time constants in UNC2"""
import numpy as np
import math
import matplotlib.pyplot as plt
import os
x = np.arange(-90, 90, 0.1)
vhm = -12.2
ka = 4.0
vhh = -52.5
ki = 5.6
atm = 1.5
btm = -8.2
ctm = 9.1
dtm = 15.4
etm = 0.1
ath = 83.8
bth = 52.9
cth = -3.5
... |
91a6479671740e205030fc9efedb24e14b384f61cc3fcbf5c0b41a8593fc9568 | Python | 1,097 | 42 | """Import tests of the main module treem and it's submodules."""
# pylint: disable=unused-import
# pylint: disable=import-outside-toplevel
def test_import_treem():
"""Tests importing treem."""
import treem
def test_import_node():
"""Tests importing Node from treem."""
from treem import Node
def t... |
090944f5bf4302e2cba4a19dfc8c8f4e63a321d1dc49d575b18ceaf745972997 | Python | 1,098 | 32 | import subprocess
import os
from src.utils import parse_config
args = parse_config()
path = args.run
assert '.txt' in path, f"run argument should be a *.txt, fed {path}"
with open(path, 'r') as f:
runs = f.readlines()
runs = [run.strip() for run in runs]
print(f"Total runs={len(runs)}")
complete_txt = f"out... |
2f356c1918002fefac7436a642c40ebbd9d7a77647e760db7b832080497c1696 | Python | 1,098 | 30 | #----Figure_01_D ---------------------------------------------------------------
#-------------------------------------------------------------------------------
# This is the code for Figure 01 Panel D for the connectivity analysis for
# Reinhard and Fukuda et al. 2024
# This is the code to obtain the clock neuro... |
5366b50b24eb3e222f65d564e4436c339706077fcf72324684d8b7711ef77303 | Python | 1,098 | 38 | import unittest
import torch
from torcheeg.models import BUNet, BCUNet
class TestDDPM(unittest.TestCase):
def test_bddpm(self):
unet = BUNet()
mock_eeg = torch.randn(2, 4, 9, 9)
t = torch.randint(low=1, high=1000, size=(2, ))
fake_X = unet(mock_eeg, t)
self.assertEqual(tup... |
c3f61dd77f884b78d1eb792917ae759d66ae29b7db772829fac3811fa7341b34 | Python | 1,098 | 39 | from collections.abc import Iterable
from datetime import datetime
from elasticai.creator.file_generation.resource_utils import read_text
from elasticai.creator.hdl_ir import DataGraph
from elasticai.creator.ir2verilog import (
Code,
Registry,
TemplateDirector,
type_handler_iterable,
)
@type_handler_... |
d93939b706ff5602c263ed4d100423759a7f4bd385302fa95333f68acb9a3ec4 | Python | 1,098 | 35 | """
Compatibility layer with Python 3.8/3.9
"""
from typing import TYPE_CHECKING, Any, Optional
if TYPE_CHECKING: # pragma: no cover
# Prevent circular imports on runtime.
from . import Distribution, EntryPoint
else:
Distribution = EntryPoint = Any
def normalized_name(dist: Distribution) -> Optional[str... |
e2c3a113385634321cdc885ac6cb3732684d44f240126b255f77efb4a0da19cd | Python | 1,098 | 35 | import torch
from elasticai.creator.nn.integer.quant_utils.scaling_M import scaling_M
def test_scaling_M_basic():
M = torch.tensor([0.12345], dtype=torch.float32)
m_q_shift, m_q = scaling_M(M)
approx_M = m_q * (2 ** (-m_q_shift.item()))
error = torch.abs((M - approx_M) / M)
assert torch.all(error... |
d3b3d55cd204434094b021d6ba4b693e5188c04d7441817a33f61f067f49f0bd | Python | 1,099 | 43 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models as models
class Encoder(nn.Module):
def __init__(self, out_dim=64):
super(Encoder, self).__init__()
self.conv1 = nn.Conv2d(3, 16, kernel_size=3, stride=1, padding=1)
self.conv2 = nn.Conv2d(16, 32, ... |
6465e62994dd7e2a49d92f241c2cfcd81ad2e2838fc76cc5fae21a0ee91d1f1e | Python | 1,100 | 28 | import math
import sys
import os
def is_docker():
path = '/proc/self/cgroup'
return (
os.path.exists('/.dockerenv') or
os.path.isfile(path) and any('docker' in line for line in open(path))
)
def count_docker_cpus(quota_file=None, period_file=None, log_fct=print, default=0):
pri... |
c049307bdac2cde6304d94492ae307899dff9602e5b4ff7f35f46d47de116f2d | Python | 1,100 | 40 | import sys
from pybioshell.core.alignment import SequenceNWAligner, SequenceSWAligner
from pybioshell.core.data.io import read_fasta_file
if len(sys.argv) < 3 :
print("""
Computes pairwise sequence alignment
USAGE:
python3 align_sequences.py input-1.fasta input-2.fasta [gap_open gap_cont]
EXAMPLE:
pyt... |
2409aa352c0df842158f3ad09e9633dc422fe35cc4ce6c04eb6b862eda350597 | Python | 1,101 | 42 | """
Standalone GUI for the U01 cell counting workflow.
Andy Thai
andy.thai@uci.edu
"""
import os
import sys
# Ensure project root is on sys.path for module imports
from regtools import get_project_root
_project_root = get_project_root()
if _project_root not in sys.path:
sys.path.insert(0, _project_... |
996ac61e5f875fc3b002c0ebbd8a6ec6b7084d6d786a00eed094ec4d4d5b24b9 | Python | 1,101 | 40 | import numpy as np
# from PIL import Image
# import torch
# from typing import Callable, List, Tuple, Optional
# from sklearn.decomposition import NMF
# from typing import List, Dict
from scipy import ndimage
def scale_cam_map(cam, target_size=None):
result = []
for img in cam:
img = img - np.min(img)
... |
d4ef5571d619bb961e104a092afa2889ca84754dd1c5a18246eaaa0aa29b5c03 | Python | 1,101 | 38 | import setuptools
import os
import sys
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
version_path = os.path.join(os.path.dirname(__file__), 'src')
sys.path.append(version_path)
from version import __version__
setuptools.setup(
name=__version__,
version="0.1.0",
... |
2aad91d46f01c7b01e5d39a724a080603388a218e3e3c8127a674693fc3a50aa | Python | 1,102 | 41 | from collections.abc import Iterable
from datetime import datetime
from elasticai.creator.file_generation.resource_utils import read_text
from elasticai.creator.hdl_ir import DataGraph
from elasticai.creator.ir2verilog import (
Code,
Registry,
TemplateDirector,
type_handler_iterable,
)
@type_handler_... |
2f88d8814c942a5325fca591d43c4af3177d9ec2fdf187b4815b4c485831ceb0 | Python | 1,102 | 65 | import os
ROOT_DIR = '/Users/maurice/phd/src/psychology/main'
# Data
RAW_DATA_DIR = '/Users/maurice/phd/src/preprocessing/psychology/raw/'
DATA_DIR = os.path.join(ROOT_DIR, 'preprocessing/')
FILENAME_LABELS = 'Data07112018.csv'
LABEL_FORMAT = 'one-per-item'
# training
DATA_AUGMENTATION = False
TRAINING_RESULTS_DIR =... |
39196885a22c53aeae10023833724b0a8d58d562ca62e963b3ca2849281f6596 | Python | 1,102 | 34 | import pytest
@pytest.fixture(scope="module")
def _qapp():
try:
from PySide6.QtWidgets import QApplication
except Exception as exc: # pragma: no cover
pytest.skip(f"PySide6 unavailable: {exc}")
return QApplication.instance() or QApplication([])
def _patch_git(monkeypatch):
... |
55086583cb379d2caf33d96b367a5f1bd543591fe660a897e2d4bff3998b0500 | Python | 1,102 | 39 | from __future__ import annotations
import contextlib
from importlib.util import find_spec
from pathlib import Path
from shutil import rmtree
TEST_RESULTS_DIR = Path(__file__).parent / "_test_results"
TEST_SCRATCH_DIR = Path(__file__).parent / "_test_scratch"
has_distributed = bool(find_spec("dask.distributed"))
if ... |
351c4356845f4a350312b96a99efba433e0e012cce3db951827db38b95d931c2 | Python | 1,103 | 32 | from elasticai.creator.base_modules.identity import Identity
from elasticai.creator.nn.design_creator_module import DesignCreatorModule
from elasticai.creator.vhdl.design.design import Design
from .design import BufferedIdentity as IdentityDesign
from .design import BufferlessDesign
class BufferedIdentity(DesignCrea... |
eaf19c77f3291984c37e866d1d0701f4ef6590a0fa288121e83a3cffd87c29f6 | Python | 1,103 | 46 | import pytest
import numpy as np
from ase import Atoms
from ase.calculators.morse import MorsePotential
from ase.units import kB
from sella import Sella, Constraints
@pytest.mark.parametrize(
"internal,order",
[
(False, 0),
(False, 1),
(True, 0),
(True, 1),
],
)
def test_... |
1493ccfac323d2bdc2a151a787c97baa3ae0bc8e25aff67db544fcc756e136fd | Python | 1,104 | 44 | from enum import Enum, auto
class EdgeFeature(Enum):
'''Enum class for the different edge features to be used.'''
# bond orders
WIBERG_BOND_ORDER = auto()
LMO_BOND_ORDER = auto()
NLMO_BOND_ORDER = auto()
# integer bond orders
# LMO and NLMO bond orders can be negative so that there is n... |
612650b9e8403c8c8492b526492cd51d160daed9b5ef1df0a123a4e7ec9dffe9 | Python | 1,104 | 41 | from ..neuralnodes import utils, NL, func
import numpy as np
from .params import Params
from typing import List, NamedTuple, Union
def run_model(stim: np.ndarray,
p: Union[List, NamedTuple],
fs: float = 1_000.0,
verbose_output: bool = False,
return_dict: bool = ... |
6d4424eb179a4c97336a4a018d3424c5be0e0a4254b0347d7576b37f9c7f1dd5 | Python | 1,104 | 41 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from downward.reports.scatter import ScatterPlotReport
import common_setup
from relativescatter import RelativeScatterPlotReport
SEARCH_REVS = ["issue547-base", "issue547-v2"]
SUITE = suites.suite_optimal_with_ipc11()
CONFIGS = {
'astar... |
cf6d04ece0e8aaa4d93f4cbf23e54ffd09bc1c56ca72454fe4ff860d6816c548 | Python | 1,104 | 34 | # %%
import pandas as pd
from pathlib import Path
import matplotlib.pyplot as plt
# %%
dir = Path(__file__).parent
areas = ["output_and_income", "consumption_and_orders", "prices"]
df_collection = []
for area in areas:
df = pd.read_csv(dir / f"overall_losses_{area}.csv", index_col=[0, 1, 2])
df.index.set_names... |
67099bdb3e4c54e09c4cc0e6badcc8a0301cec7af4a225ece98f3d809b0d49a0 | Python | 1,105 | 47 | from setuptools import setup, find_packages
requirements=['pandas==1.1.5',
'pysam==0.16.0.1',
'numpy==1.19.5',
'scanpy==1.7.2',
'scikit-learn==0.23.1',
'scipy==1.5.4',
'rpy2==3.4.2',
'numba==0.56.4',
'matplotlib==3.6.3',
'anndata==0.7.6']
setup(
name='SCanSNP',
url='https://github.com/GiuseppeTestaLab/SCanSNP',
... |
a9589f988e188868e1609c15a5ede3050b224e6ac2e1287e42712b6a997e5822 | Python | 1,105 | 40 | from collections.abc import Iterable
from datetime import datetime
from elasticai.creator.file_generation.resource_utils import read_text
from elasticai.creator.hdl_ir import DataGraph
from elasticai.creator.ir2verilog import (
Code,
Registry,
TemplateDirector,
type_handler_iterable,
)
@type_handler_... |
1f0d58715202a81e03b0ef0ff3dda8d563e7407c19b3ea9570fbb2636bcf9179 | Python | 1,106 | 33 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
2b84b96e66e92685879d28445819492bdd0109793387d598bd742515702f82b5 | Python | 1,106 | 44 | """The main program that runs gSpan."""
# -*- coding=utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
from .config import parser
from .gspan import gSpan
def main(FLAGS=None):
"""Run gSpan."""
if FLAGS is None:
... |
721a6d4d0b6cce63628b54a4fb885a04963cc0712485977b7d4d675fb7693253 | Python | 1,106 | 46 | # -*- coding: utf-8 -*-
"""
Fixtures for all abagen tests
"""
import os
import pytest
from abagen.datasets import (fetch_desikan_killiany,
fetch_microarray,
fetch_raw_mri,
fetch_rnaseq)
@pytest.fixture(scope='session')
def datadi... |
794dcffaacd33d653f1e60f5db6bd60aa6ed42b7c86d420da3477c079291938a | Python | 1,106 | 41 | from __future__ import annotations
import pytest
from custodian import Custodian
from quacc.calculators.vasp.vasp_custodian import run_custodian
def mock_custodian_run(*args, **kwargs):
# Instead of running Custodian, we will mock it to return True
# when .run() is called
class MockRun:
# Add a... |
c33ecf9fdf06f9c192eeff0eb1e762183679de6f939e432194e5ee676bece676 | Python | 1,106 | 41 | """Return original data."""
import numpy as np
from xarray import DataArray
from hmp.projectors.base import Projector
class Identity(Projector):
"""Returns identity projection.
Attributes
----------
weights : xr.DataArray
DataArray with dimensions [channel, component] and coordinates
... |
e18c67ad8507a83678d789ce67779ad6abab6d1f70c131fa2112c6249cca2213 | Python | 1,106 | 34 | import json
def convert_entries(entries):
converted_entries = []
for entry in entries:
completion_dict = {
"output_reaction_inputs": entry["output_reaction_inputs"],
"output_reaction_conditions": entry["output_reaction_conditions"]
}
completion_str = json.dumps(... |
46e2d4f014ae0d1a1c495266df46e1901389df5dd4443f9a631617aaac6b4281 | Python | 1,107 | 38 | from function import *
front = 'AACTGCATTTTTTTCACATC'
back = 'GGTTACGGCTGTTTCTTAAT'
# ファイルの読み込み
df = pd.read_csv('train_sequences.tsv',
delimiter='\t',
names=['#sequence', '#expression'])
# one_hot と len
seq_li = df['#sequence'].to_list()
seq_80_li = [temp[17:-13] for temp in seq... |
5e950c81a01c4d30ef2e2bae05728e7f3beed9eecaf6fb4cc255051c5ab1e484 | Python | 1,107 | 27 | from map_mni_coords import t1_mri_to_mni
import os.path as osp
from config import Paths
import numpy as np
def test_t1_mri_to_mni(subject):
imaging_root = osp.join(Paths.rhino_root,'data','eeg',subject,'imaging',subject)
t1_coord_file = osp.join(imaging_root,'electrode_coordinates_T1.csv')
name = 'test'
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.