sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
27f96387e4558f687d4a969ec2053d7ae1b22ce33e60a8d0de47acd45f3cef82
Python
1,609
58
import re from typing import List, Union, Dict from ..base_transform import LabelTransform class StringToInt(LabelTransform): r''' Identify numbers in strings and convert strings to numbers. If there is no number in the string, the output corresponding to the string is 0. .. code-block:: python ...
37c3a14e8faa6effcf0196f48d6628cc912dd0915b2f3d96a332341e7b191cd4
Python
1,610
49
import numpy as np from ase import Atoms from sella.internal import Internals def _two_fragment_internals(): """Two water molecules far apart -> per-fragment translations + rotations.""" atoms = Atoms( symbols=['O', 'H', 'H', 'O', 'H', 'H'], positions=[ [0.0, 0.0, 0.0], ...
7d412262c98db81af4fd9def15db8101cc5d1c92fa9b04443cb901ac00667c66
Python
1,610
47
from google.cloud import pubsub_v1 import json def create_preprocessing_task(origin, chunk_dims): args = {} args['inlayer'] = 'gs://neuroglancer/pinky100_v0/image' args['outlayer'] = 'gs://neuroglancer/pinky100_v0/image_corrected' args['contrastlayer'] = 'gs://neuroglancer/pinky100_v0/contrast' arg...
9f9e51653012495e9044b4b1db8fe7eb3364d7bc0c733096903d41ba5db15c83
Python
1,610
42
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' Script to submit to cluster the decoding script''' import os from warnings import filterwarnings from stormdb.cluster import ClusterBatch from stormdb.access import Query project = 'MINDLAB2020_MEG-AuditoryPatternRecognition' os.environ['MINDLABPROJ']=project os.envir...
bf456d6a91c202f7798fb526aeecc5e4695b7ae91d2909d14f950fc9018ce372
Python
1,610
37
# Define here the paths to your OneDrive and other personal paths that you need to redefine for your code to work # The code will later use the file generated from this code to replace the paths in the code with your own custom ones. import json def set_path_mapping(path_mapping_json): # parse json: # path_di...
dcaf49bb4271e873e186a0fc20d937cb0551dcb39910c6fc0fa04027d440444d
Python
1,610
58
import os def create_makefile(destination_dir, stop_time="4000ns"): makefile_content = f"""# automatically generates a Makefile for GHDL # vhdl files FILES = $(shell find -type f -name "*.vhd") VHDLEX = .vhd # testbench TESTBENCHFILE = ${{TESTBENCH}}_tb TESTBENCHPATH = $(shell find -type f -name "${{TESTBENCH}}...
053a13dd8915c586a0ea33856e57b0847cd380c3769e72ad6d452dfd5b64cc21
Python
1,611
33
import sys, os, h5py from numpy.random import choice import numpy as np from optparse import OptionParser def main(): usage = 'usage: %prog [options] <subsamples> <indir> <outdir>' parser = OptionParser(usage) (options,args) = parser.parse_args() if len(args) != 3: print(args) ...
189268cf1c388a7a69b049365b25bb5c54cbe47e97cf8d5b8be95317d16b978f
Python
1,611
57
#!/usr/bin/env python import os import time import boto import boto.ec2 # Environment variables you MUST set (either here or by passing them in). # ----------------------------------------------------------------------- # # os.environ['AWS_ACCESS_KEY_ID'] = '...' # os.environ['AWS_SECRET_ACCESS_KEY'] = '...' # Opt...
8554992acf2bd9d8510235a8d6eb4cf6f31c6a57bf1f2a9ef805b4850c33cbd0
Python
1,611
39
import sys import argparse import os import subprocess def main(argv): parser = argparse.ArgumentParser() parser.add_argument("cmd",help="cmd to run",nargs='*') parser.add_argument('-name',dest='name',help='name for the singularity files',default='default') parser.add_argument('-dir',dest='dir',help='d...
f7a7e57254cc865db8d250115f29124c970590829b0d31e0636b34403f28f2ca
Python
1,611
55
""" The cell area click command """ import configparser import glob import os import click import pandas as pd def concate_area_dataframes(file_lists, rf_prediction=False): """ conctact dataframe locatated in a directory """ frames = [] for file_list in file_lists: for file in file_list...
614bcc571a60320af30a7b443d40988391169ece44d36bd6aa0b91e2decfd8cf
Python
1,612
51
import os from torch.utils import data as torch_data from torchdrug import data, utils from torchdrug.core import Registry as R @R.register("datasets.Solubility") @utils.copy_args(data.ProteinDataset.load_lmdbs, ignore=("target_fields",)) class Solubility(data.ProteinDataset): """ Proteins with binary label...
875d6db22fb4a969d3df96b7df94a8ec0d7dec2e27a10ea1b889b886f33f66e6
Python
1,612
47
import numpy as np import pandas as pd from scipy import stats, optimize import warnings # logarithmic function (https://stats.stackexchange.com/questions/190107/curve-fit-with-logarithmic-regression-in-python) # exponential equation + offset def func(x, a, b, offset): return a*(1.0 - np.exp(-(x)/b)) + off...
c132e71270211db0ecc969206e7cfdac53c1659d6df96f57fc6e6bc96252bc1d
Python
1,612
42
"""This tests aims at checking the integrity of the circuit built from the snakemake.""" import filecmp from pathlib import Path CURRENT_RESULT_DIR = Path(__file__).resolve().parent / "arch_results" EXPECTED_DIR = Path(__file__).resolve().parent / "expected" def test_densities(): assert filecmp.cmp( CUR...
c3be3d260a8a8bc72504570e6dd71b655aac985e2827f401ca16754866d414dc
Python
1,612
51
import re SPLIT_RE = re.compile(r'[\.\[\]]+') class JsonSchemaException(ValueError): """ Base exception of ``fastjsonschema`` library. """ class JsonSchemaValueException(JsonSchemaException): """ Exception raised by validation function. Available properties: * ``message`` containing huma...
39bd5c3f4317593ce3ba5e4348912c1cef32238a6a68676a84d865f879beab84
Python
1,613
50
# 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...
465a28c166d76da852cc5f7c67398c5b8a0b5720cc827615f8fa4670dffce96b
Python
1,613
35
import torch import math class CosineWarmupDecay(torch.optim.lr_scheduler._LRScheduler): def __init__(self, optimizer, warmup_step, total_step, multi, print_step, last_epoch=-1, verbose=False): self.initial_lr = [group['lr'] for group in optimizer.param_groups] self.min_lr = [lr * 0.0001 for lr in ...
1d6f386757169a0e1be9a309be5308f68eac1994841ff6963139432acb4bf256
Python
1,614
55
""" Backward compatibility for homebrew builds on macOS. """ import sys import os import functools import subprocess import sysconfig @functools.lru_cache() def enabled(): """ Only enabled for Python 3.9 framework homebrew builds except ensurepip and venv. """ PY39 = (3, 9) < sys.version_info < ...
f019b4d5342af573137b9de9f11b09f466a4e2959fb1957219aeb6ec612e49a2
Python
1,614
44
import torch import numpy as np from random import randrange def process_dynamic_fc(timeseries, window_size, window_stride, dynamic_length=None, sampling_init=None, self_loop=True): # Size of timeseries: batch x time x node # Size of output: batch x time x node x node if dynamic_length is None: dyn...
f9c261ae4fb5cb4902bd902217ada40807f92ccaef667bae29dc23f3f083860d
Python
1,614
52
import numpy as np from pydicom.pixel_data_handlers.util import apply_voi_lut, apply_modality_lut from skimage.morphology import remove_small_objects from skimage.measure import label from skimage.measure import regionprops def reset_mask_stack(current_labels): new_labels = {} for k, v in current_labels.it...
107a5c4c180c09dd819241b231e85f9a833c1c1bbb1c0fb990dfd340a5b9c8cb
Python
1,615
39
"""Test functions for acquisition parameter.""" from copy import copy import pytest from console.interfaces.acquisition_parameter import AcquisitionParameter from console.interfaces.enums import DDCMethod def test_save_load(acquisition_parameter: AcquisitionParameter) -> None: """Check if saved acquisition para...
4d496ec27bcb5ff9f0109548695dd6c71c83242fc81d5e8d14512e4c693e78c6
Python
1,615
68
import apps # import reram_register def userTask(myapp): userTask_6(myapp) def userTask_1(myapp): pulseWidth = 100 # 20 * 100 = 2000us pulseGap = 46 # 20 * 46 = 920us voltage_0 = 32 * [3] voltage_1 = 32 * [3] voltage_2 = 32 * [3] voltage_0[1] = voltage_1[1] = voltage_2[1]...
b9e61cffb46f6f74d0d3f3251a40cb03d21258b7ea2883d64dd10c1e08ffb995
Python
1,615
60
import pytest from elasticai.creator.testing.cocotb_pytest import create_name_for_build_test_subdir def simple_function(): pass def test_create_name_for_simple_function(): actual = create_name_for_build_test_subdir(simple_function) expected = "simple_function" assert actual == expected def functi...
ef3e2554f8d5b58c4b4317289785678700f97744607df352c19bfb446c7ee7a1
Python
1,616
66
#! /usr/bin/env python # -*- coding: utf-8 -*- """ Before you can run the experiment you need to create duplicates of the two tasks we want to test: cd ../benchmarks/trucks-strips for i in {00..19}; do cp p16.pddl p16-$i.pddl; done for i in {00..19}; do cp domain_p16.pddl domain_p16-$i.pddl; done cd ../freecell for i...
ae4922407fbe6e8c1c5809b9d5bf9ea8fdb935c8d217ca47ca743ecfa7b0e519
Python
1,617
49
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DI...
f5486085e6406979496e42d924a5585eb91916b41dbe0b176176409dbf8e4ea7
Python
1,617
64
import sys def seq2kmer(seq, k): """ Convert original sequence to kmers Arguments: seq -- str, original sequence. k -- int, kmer of length k specified. Returns: kmers -- str, kmers separated by space """ kmer = [seq[x:x+k] for x in range(len(seq)+1-k)] kmers = " ".joi...
451a44efc9f528de435ccbc01226a3b3b7a90c3825202b27bc8f4fabd104a90a
Python
1,618
60
# EyeNED OCT-ONH segmentation and feature extraction # Copyright (C) 2024 Erasmus MC # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your optio...
717bc2ad716836c3fedff9c726aa8eff55d472a8103a6070bdc6f87941936708
Python
1,618
47
import torch import torch.nn as nn from typing import List from ..prixfixe import FirstLayersBlock from .add_blocks import ConvBlock import torch.nn.functional as F class BHIFirstLayersBlock(FirstLayersBlock): """ The firstLayersBlock of the BHI model. Consists of multiple ConvBlocks with different ke...
9e8eddd03865ca2651a94ff3bc696612e3e9228554717ebc690f867cfb6cee23
Python
1,618
42
from __future__ import annotations import pytest from ase.build import bulk from quacc.recipes.emt.elastic import elastic_tensor_flow def test_elastic_jobs(tmp_path, monkeypatch): monkeypatch.chdir(tmp_path) atoms = bulk("Cu") outputs = elastic_tensor_flow(atoms, run_static=False) assert outputs["...
aea8a7d655a9250aeeef2862b8b5ecac5ed7d70320b2c8f43e27a698727bf54a
Python
1,618
51
import pytest import torch import elasticai.creator.nn.fixed_point as nn from elasticai.creator.arithmetic import FxpParams from elasticai.creator.nn import Sequential class SimpleHardTanh(torch.nn.Module): def __init__(self, total_width: int, frac_width: int, vrange: tuple[float, float]): super().__init...
3a876310b03c7496ac14a90dca38639d6245e8a60dbd5451a3a2c04b04bf1a52
Python
1,619
23
import argparse # iGWOS description and version parser = argparse.ArgumentParser(prog='iGWOS', description="Predict genome-wide CRISPR-Cas9 off-target sites with iGWOS.") parser.add_argument('-v','--version', action='version', version='%(prog)s 1.0') # gRNAs file input for off-target prediction parser.add_argument('-gR...
8cbbe33e312bd4df6a63f3f3dde662c3896ce274d87bdd2c98da602164121517
Python
1,619
47
import torch from bisect import bisect_right class WarmupMultiStepLR(torch.optim.lr_scheduler._LRScheduler): def __init__( self, optimizer, milestones, gamma=0.1, warmup_factor=1.0 / 3, warmup_epochs=5, warmup_method="linear", ...
a8916fa04d1d56a53fa3fd96a504cbea60872311e01ec5aefcab96e692c18a41
Python
1,620
52
#!/usr/bin/env python #================================================================ # Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved. # # Filename : crop.py # Author : Yufeng Liu # Date : 2023-01-24 # Description : # #==========================...
490fd06038d5c8cde4c9a5ca68c3197be210d44d9ad22be96f7bc6bd8f96f591
Python
1,621
51
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport def main(revisions=None): suite = suites.suite_optimal_with_ipc11() configs = { IssueConfig('astar-cegar-original', [...
ae20ea5e4ab647d21253f007936dd6671b07ff5edc496d74d5cee6fc7239904a
Python
1,621
50
from .task import Task from .property_prediction import PropertyPrediction, MultipleBinaryClassification, \ NodePropertyPrediction, InteractionPrediction, Unsupervised from .pretrain import EdgePrediction, AttributeMasking, ContextPrediction, DistancePrediction, \ AnglePrediction, DihedralPrediction from .gene...
e1394f37b077fc736a4c21fd3d01489345863a64c05472570edbcd15ba500d51
Python
1,621
45
import pandas as pd import os import tempfile from tests.mock_data import MockCvOutput from cuppa.performance.performance_stats import PerformanceStatsBuilder, PerformanceStats from cuppa.performance.confusion_matrix import ConfusionMatrix class TestPerformanceStatsBuilder: def test_can_build_from_pred_summ(self...
36cfbc77c81f8f58767dd679de9da1b0f2bfe8a8853ffd727613346c3d27f2cd
Python
1,622
39
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DI...
d0ddc61c017a482253630301d09fc8cc5c4382c614fb5e901e1b7511fa62d687
Python
1,622
51
import os from torch.utils import data as torch_data from torchdrug import data, utils from torchdrug.core import Registry as R @R.register("datasets.Fluorescence") @utils.copy_args(data.ProteinDataset.load_lmdbs, ignore=("target_fields",)) class Fluorescence(data.ProteinDataset): """ The fitness values of ...
f0c75ea2617706a4fe6391ff2dc615c14cd69bf7e1026e1cb9d758c8b4211322
Python
1,622
52
from collections.abc import Iterable, Iterator import pytest from elasticai.creator.hw_function_id import HwFunctionIdUpdater pytestmark = pytest.mark.slow def test_compute_id_ignores_target_file_contents(tmp_path) -> None: build_dir = tmp_path / "build" build_dir.mkdir() source_file = build_dir / "sou...
022f9d3b922ac1718981c7f26e4860841aeab83b27c24227c124c2ed0a32891e
Python
1,623
32
# Copyright (c) OpenMMLab. All rights reserved. from .aspp import ASPP from .contextual_attention import ContextualAttentionModule from .conv import * # noqa: F401, F403 from .downsample import pixel_unshuffle from .ensemble import SpatialTemporalEnsemble from .flow_warp import flow_warp from .gated_conv_module import...
e89a5eeccde5eed8fd7d246db00ecd1db26d52cfef20bfe0cb31350f822bceb7
Python
1,623
56
from typing import Iterable from elasticai.creator import graph as g class Graph: def __init__(self, wrapped: g.Graph[str], data: dict[str, str]): self.wrapped = wrapped self.data = data @property def nodes(self): return self.wrapped.nodes @property def edges(self): ...
a8e4341bb3f1c30fda9e1391dee9e64af486909151be8e494be6ffe118cae5e5
Python
1,624
53
# -*- coding: utf-8 -*- """ Created on Fri Jul 12 16:00:48 2024 @author: mpolonen """ import numpy as np from glob import glob import os import shutil from expyfun.io import read_hdf5, write_hdf5 # %% speech path_in = 'C:/code/peaky_pitch/stimuli/speech_regress/' path_out = 'C:/code/peaky_pitch/stim...
8bc8ece18aaf54da62547d9e47ea99a33707710c9be487879fea1c16ee006230
Python
1,625
60
# 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...
a3a3e650a469836056f46ed6b2366e1d3983199881b3b4d61202f7ff5fe490ad
Python
1,625
58
import os import tiffile import h5py import matplotlib.pyplot as plt import numpy as np import cv2 as cv from PIL import Image, ImageOps from tiffile import imsave from skimage.measure import label from skimage.color import label2rgb def denoise(img: np.ndarray, h: int, templateWindowSize=7, searchWindowSize=21): ...
8562746c5352f462041a2bfce69355b472937dd2a090aa8b510c89a0dc7eacc0
Python
1,626
53
import pytest import torch import elasticai.creator.nn.fixed_point as nn_fxp from elasticai.creator.arithmetic import FxpParams from elasticai.creator.nn import Sequential class SimpleTanh(torch.nn.Module): def __init__( self, total_width: int, frac_width: int, num_steps: int, ...
a5db40a3b40d368b7fd6fe1f8d4818819e0138884d4c944f23cd67b364822e68
Python
1,626
40
# # MIT License # # Copyright (c) 2022 GT4SD team # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge,...
df387027cfded13e35bc8285f530bd66ae5f94f5c6932d9179552c7d6abfb21e
Python
1,626
56
"""I/O utilities for the Vasp calculator.""" from __future__ import annotations from typing import TYPE_CHECKING from quacc.utils.files import load_yaml_calc if TYPE_CHECKING: from pathlib import Path from typing import Any def load_vasp_yaml_calc(yaml_path: str | Path) -> dict[str, Any]: """ Load...
3d18c9fa186c54e7d1db7ed15174086a3ac58683d1f6ff56165731cf5a472331
Python
1,627
73
"""Common defect workflows.""" from __future__ import annotations from importlib.util import find_spec from typing import TYPE_CHECKING from monty.dev import requires from quacc import subflow from quacc.atoms.defects import make_defects_from_bulk has_pmg_defects = bool(find_spec("pymatgen.analysis.defects")) has_...
9c29be4ef7d44839f9e3ba71a6055af65b8069c123a09d9391cf6f5eba5332bb
Python
1,627
43
from pybioshell.simulations.systems.ising import Ising2D_unsigned_char_unsigned_short_t as Ising2DBB from pybioshell.simulations.movers.ising import SingleFlip2D_unsigned_char_unsigned_short_t from pybioshell.simulations.movers.ising import WolffMove2D_unsigned_char_unsigned_short_t from pybioshell.simulations.movers i...
9ed1e6ea71bd9da166cdda324d99b84bcdf87faae02a9aeb102ec4bcf594d15a
Python
1,627
47
import torch import torch.nn as nn from utils.params import ParamsPack param_pack = ParamsPack() import math class WingLoss(nn.Module): def __init__(self, omega=10, epsilon=2): super(WingLoss, self).__init__() self.omega = omega self.epsilon = epsilon self.log_term = math.log(1 + s...
867fcebda6d88cf035c0e5a9154e1cfd6ee560bbdfc05ccbb74862a5c78ec701
Python
1,628
47
# # MIT License # # Copyright (c) 2022 GT4SD team # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge,...
b181764ae493fe73ce9d0cb0b11933fde5c593b7b7f1c5d2ce447d27dc2e3a6a
Python
1,628
53
from collections.abc import Iterator from elasticai.creator.ir2vhdl import DataGraph from .vhdl_nodes.node_factory import InstanceFactoryForCombinatorial from .wiring import ( connect_data_signals, ) def wrap_node(n): return InstanceFactoryForCombinatorial(n) def build_declarations_for_combinatorial(impl:...
be601b03bca00d6ee8faac1f3337b92e451d9527a39f450dff7ce3eaf6f6fd8e
Python
1,628
24
"""posthoc_sff_landscape_2026-09-28.py (post hoc, descriptive). SIGN_FROM_FUNCTION Test 2 ended with 100x lower loss but fewer correct signs. Is that a search that got stuck (truth fits far better) or a recording that cannot tell (end point fits as well as the truth)? Losses on the same 20-odour panel, candidate seeds ...
d86dd95400faba6b43ff45b9bdb917f5ad858f0a33ee22cb78e9aac0fcbc8cd1
Python
1,628
42
try: # Python 2 from StringIO import StringIO except ImportError: # Python 3 from io import StringIO import pddl from pddl_to_prolog import Rule, PrologProgram def test_normalization(): prog = PrologProgram() prog.add_fact(pddl.Atom("at", ["foo", "bar"])) prog.add_fact(pddl.Atom("truck", [...
faf23cf90d8258ab9d790a6b6d8f8b737d8f43c6a4d1ba3e87d42639ac50678b
Python
1,628
34
""" Main run function for finding consensus assemblies last modified: András Ecker 01.2023 """ import logging from assemblyfire.utils import load_assemblies_from_h5, get_nrn_df from assemblyfire.spikes import SpikeMatrixGroup from assemblyfire.clustering import cluster_spikes, detect_assemblies from assemblyfire.asse...
1d1219d194bebd59c6a2ac064de5f29e5fe0c4e371fcea32b757c7fc00d94966
Python
1,629
43
# 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...
1fbaa3c43eae0df776b16f5693b129a5c70b6d32fa3d320ca6dec715672cd078
Python
1,629
49
# 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...
79bde428abf5b5da4fc9b6d6230d3c3499f3fdb099fdf61df4001ade6a5a4dd2
Python
1,629
42
#!/usr/bin/env python # Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB). # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module provide BasicMetric, the basic class of all the metrics. """ ...
931dea580ec0d1910f8554adfae471b044785c5f082d98084b79a179c7af44f0
Python
1,629
50
'''precompute MUA as spike rate per spatiotemporal bin''' import os import h5py import numpy as np import mesocircuit.analysis.spike_analysis as sana from mesocircuit.helpers.io import load_h5_to_sparse_X def write_mua_file(circuit, PS, path_lfp_data, networkSim): ''' Parameters -------...
1468c906e3094ea38603f0103d6001d2d271eebb667d096ae53b8dd69d6329a0
Python
1,630
43
from elasticai.creator.arithmetic import ( FxpArithmetic, FxpParams, ) from elasticai.creator.base_modules.hard_tanh import HardTanh as HardTanhBase from elasticai.creator.nn.design_creator_module import DesignCreatorModule from .design import HardTanh as HardTanhDesign class HardTanh(DesignCreatorModule, Ha...
62b57ad7567396d54843241f1915abb0e1e5cc5f04afb495602b00734893fa6e
Python
1,631
49
from itertools import chain from typing import TypeAlias from elasticai.creator import ir from elasticai.creator.ir2vhdl import Code, DataGraph, type_handler from .language import Port, VHDLEntity IOPair: TypeAlias = tuple[tuple[int, ...], tuple[int, ...]] @type_handler() def lutron(lowered: DataGraph, registry: i...
78a0787885b5ace7a460be0f1343b96c16b0f5f4bc2659114e37f0bc97ac1bb9
Python
1,631
59
import sys from pybioshell.core.data.io import Pdb if len(sys.argv) < 2 : print(""" Extracts PDB clusters from clustering results produced by ap_cluster_ligands output SEE: ap_cluster_ligands program to see how to run clustering USAGE: python3 pdb_from_clusters.py clustering_output.txt ligand_code EXAMP...
fa0a0e080d6b85029094d43f00e49492e48874377a37626aa189bbcc8ba2eac9
Python
1,631
50
import numpy as np from config import MODEL_PATH, DATA_DIR, LABEL_FORMAT from model import CNN import csv from dataloader import DATA # TODO: adapt such that it works for all formats ('one-per-item', ...), currently only works for 'one' # restore commit in result.txt to ensure loading model parameters works def rest...
744166a498f5b9d89908794768584ea7bf25ee55ecad9db2f03569fe5335faa0
Python
1,633
76
import plotly import plotly.graph_objs as go import numpy as np import pandas as pd import os #Example shape # Wall time,Step,Value # 1698314503.5367975,1,0.6933741569519043 val_loss = pd.read_csv('val_loss.csv') train_loss = pd.read_csv('train_loss.csv') val_loss = val_loss.drop(['Wall time'], axis=1) train_loss = ...
0c8c6f833e51f7da2779427b0eca0f6bb4a7295a9541bea1759e4e539ec59ac8
Python
1,634
48
""" Optuna example that optimizes a classifier configuration for Iris dataset using sklearn. This example is the same as `sklearn_simple.py` except that it uses a callable class for implementing the objective function. It takes the Iris dataset by a constructor's argument instead of loading it in each trial execution....
41e2fe9d5a2c2a989d7990c90dc1902aeb945ce46ba911a11f66bcf7c3b867a8
Python
1,634
55
import os from collections.abc import Iterable, Iterator from pathlib import Path from elasticai.creator.hw_function_id import HwFunctionIdUpdater as _generalUpdater class HwFunctionIdUpdater: def __init__( self, build_dir: Path, ): target_file_name = "skeleton_pkg.vhd" target...
7cd0af2f14420a82be9458540de12e3cd4ca523803373467a09f0611aa562b1c
Python
1,634
54
import csv from functools import partial import tkinter as tk from tkinter import filedialog from pathlib import Path import os import napari from napari.utils.notifications import show_info # this is where data will be written currdir = os.getcwd() tempdir = filedialog.askdirectory(parent= tk.Tk(), initialdir=currdi...
de63dc6058397141dc868b5348365f29da9bc4865fbbf841f4a90d5fb620c38a
Python
1,634
47
from typing import Optional from .savable import File, Path from .template import Template, TemplateExpander class InMemoryFile(File): def __init__(self, name: str) -> None: self.text: list[str] = [] self.name = name def write(self, template: Template) -> None: expander = TemplateExp...
28e89c353d7b0860a065d1f4b7a211d027c184de942bc44fbfbc60eec97e3f97
Python
1,635
93
""" Provides default parameters used in the analysis. """ params = {} params['mplstyles'] = 'misc/mplstyles/report_plots_master.mplstyle' params['extension'] = 'png' params['seed'] = 2106 params['python_sort'] = True params['rate_histogram'] = { 'binsize': 1., # in ms 't_start': 500., # in ms 't_stop':...
93fd52222daa61bea5fc35b5130367c12a706d159c06b8f214efe9b9beb171e8
Python
1,635
52
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from lab.reports import Attribute, gm from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport def main(revisions=None): suite = suites.suite_satisficing_with_ipc11() configs = { ...
963ac950743fca7853a715b99717d9da45a66e57cdd78ddb3917a9fb617d8239
Python
1,635
51
#!/usr/bin/env python3 import logging import argparse # https://stackoverflow.com/questions/2130016/splitting-a-list-into-n-parts-of-approximately-equal-length def split(a, n): k, m = divmod(len(a), n) return (a[i * k + min(i, m) : (i + 1) * k + min(i + 1, m)] for i in range(n)) def parse(): ...
2a5254f7d119db66218be7d29c0b5729416c611f9d9d3eee4736597597956778
Python
1,636
43
from REACTRL.env_modules.net_framework_curr import * from REACTRL.env_modules.signal_conv import * from REACTRL.img_modules.curr_data import train_loader, test_loader from boss.bo.bo_main import BOMain from boss.pp.pp_main import PPMain from datetime import datetime import pandas as pd def func(X, model=None, method=...
557c583b7910910d5b2bca3381bf11a47ecde12c2b7dc4129c201f5c28341054
Python
1,636
59
from __future__ import annotations import pytest redun = pytest.importorskip("redun") from ase.build import bulk @pytest.fixture def scheduler(): return redun.Scheduler() from quacc import flow, job from quacc.recipes.emt.core import relax_job from quacc.recipes.emt.slabs import bulk_to_slabs_flow # skipcq: ...
5e0ad0dc9fb0af7701fed4255696f85ee20ef35bac04cdcebc754da5ce5c2f62
Python
1,636
47
"""Regression: pipeline._git_commit_short must not flash a console window. Like the hub's updater._git, the pipeline's best-effort commit-stamp shells out to git; on Windows it must pass CREATE_NO_WINDOW so it doesn't pop a console window when the caller has no console. """ import sys import subprocess d...
8952709c2832972eca8030e36a3ca847caa1da297a13c1ca0c6091c71dbc1255
Python
1,637
58
from __future__ import annotations from enum import StrEnum from typing import TYPE_CHECKING import torch_sim as ts if TYPE_CHECKING: from collections.abc import Callable class TSModelType(StrEnum): """Enum for model types.""" FAIRCHEMV1 = "FairChemV1Model" FAIRCHEM = "FairChemModel" GRAPHPESW...
ca653a28fada92fd22b30b64e6ecfc83ceb85114f748e2e5974e98ea2a4ea606
Python
1,637
57
import unittest import torch.nn.functional as F import torch from torcheeg.models import BGlow, BCGlow class TestFlow(unittest.TestCase): def test_bglow(self): model = BGlow() # forward to calculate loss function mock_eeg = torch.randn(2, 4, 32, 32) nll_loss = model(mock_eeg) ...
0cb0c3cf525bb77093ae743ad0e685c4d52e4bedc2fb9350dab40e322ba310b7
Python
1,638
53
import pytest import torch import elasticai.creator.nn.fixed_point as nn_creator from elasticai.creator.arithmetic import FxpParams from elasticai.creator.nn import Sequential class SimpleSiLU(torch.nn.Module): def __init__( self, total_width: int, frac_width: int, num_steps: int,...
50a5f8763e4be05d6bb7335a418a5e8bafb4fea86a48b3b96b6c4cd26336ed3c
Python
1,641
53
# 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...
89cd820a018ad911ce48677e4634afb9650a3951c9395c1177de6148f83fac8a
Python
1,641
62
# Node group "CA Value Float" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # Shared by several assets, which import it; not an asset itself. # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerat...
9c3735032650394d755bc7e009111fb135be6e502ee7e345072532cb8776a9c0
Python
1,641
57
import os from torch.utils import data as torch_data from torchdrug import data, utils from torchdrug.core import Registry as R @R.register("datasets.Hetionet") class Hetionet(data.KnowledgeGraphDataset): """ Hetionet for knowledge graph reasoning. Statistics: - #Entity: 45,158 - #Relat...
c4178d90213c5ddd779195365f433dcaf34e6c75c860a1318d7580dcb36e233a
Python
1,641
43
from pathlib import Path import argparse import dolfin as d from smart import mesh_tools import cru_args def main(input_mesh_file, output_mesh_file, num_refinements): if not Path(input_mesh_file).is_file(): raise FileNotFoundError(f"File {input_mesh_file} does not exists") cru_mesh = d.Mesh(Path(inpu...
ccd06adff9377214d3550cb3d27f1f2c5e4cf97f5cc839cc794f418667b23820
Python
1,641
44
#----Figure_05_G_preparation---------------------------------------------------- #------------------------------------------------------------------------------- # This is the code which has to be run in preparation for Figure 05 G # for the connectivity analysis for Reinhard and Fukuda et al. 2024 #---------------...
03376dc62888beabae1d61f22a0b804af59cbed6e690a99e7493b044458125c7
Python
1,642
48
import torch import torch.nn.functional as F from diff_frech_mean.frechetmean.frechet import frechet_mean def frechet_agg(x, adj, man,B=None): """ Compute Frechet Graph Aggregation Args ---- x (tensor): batched tensor of hyperbolic values. Batch size is size of adjacency matrix. adj (...
b4b60d96e988527e20921d2c87ee85457083aaf09f3a85c0b8818503d423bf51
Python
1,642
59
import prosper_nn.utils.generate_time_series_data as gtsd import prosper_nn.utils.create_input_ecnn_hcnn as ci from prosper_nn.models.hcnn_known_u import hcnn_known_u import torch # Define network parameters n_features_U = 10 # setting this to zero reverts to vanilla HCNN with tf batchsize = 5 past_horizon = 15 forec...
8532f8cc1762ad9ba60ac6a42d4905a0a46b456e60c25f5d0d6d13486380b21a
Python
1,643
57
from typing import Any, Protocol from torch import Tensor from torch.nn import Conv1d as _Conv1d from torch.nn.functional import conv1d from elasticai.creator.base_modules.math_operations import Quantize class MathOperations(Quantize, Protocol): ... class Conv1d(_Conv1d): def __init__( self, o...
be6c9dfd52b74c9009520472f61e4570430c0b223df7707467080c7048959752
Python
1,643
60
# -*- coding: utf-8 -*- # # Basic checkers to facilitate direct Dask interface # import subprocess from time import sleep # Syncopy imports from syncopy.shared.errors import SPYWarning, SPYInfo from .log import get_logger def check_slurm_available(): """ Returns `True` if a SLURM instance could be reached v...
c3fa2888deff0016f5840f38689943ce5ca0e0a103c6f3e443969a91fc2fb304
Python
1,643
42
import numpy as np from model import CNN import csv import time from dataloader import DATA_TEST def restore(pathname): model = CNN('restored', 0) model.restore_model(pathname) return model def ensemble_predict(data, modelpaths,run): final = np.empty((data.images.shape[0], 10)) for i, modelp...
e65bd9f1972ee20842a03c1b056654661aab983765981e2f65ff3faa6b417532
Python
1,643
53
#!/usr/bin/env python # -*- coding: utf-8 -*- import matplotlib.pyplot as plt import numpy as np x = np.arange(-1,2,0.001) binary_threshold = 0.5 f_act = 1 * (x > binary_threshold) f_surrogate = np.minimum(np.maximum(x, 0),1) f_prime = np.zeros_like(f_act) f_prime[np.where(x>binary_threshold)[0][0]]=1 H_of_x = 1*(x...
f4219d73d9ffec86dd7c14d3615d4dda971d97406294a14672b27ff30e8e37b6
Python
1,643
33
# 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...
1a11b73a8809c9815f3204b2bbef8099f98a4ecbe1bc082a89fa6a339629e71e
Python
1,644
43
"""Sub-family help fallback: DevCCF developmental-stage families (kim_devccf_<stage>) inherit the base kim_devccf tooltip without a per-stage OptionHelp entry.""" import pytest def _hw(): return pytest.importorskip("regtools.registration.gui.help_widgets") class _Opt: def __init__(self, key): ...
2cf2c5389ab95413cd334f64d61c2792b3d55d9f434d672e2785c48fafc5b363
Python
1,644
55
#! /usr/bin/env python # -*- coding: utf-8 -*- import itertools import os from lab.environments import LocalEnvironment, MaiaEnvironment from downward.reports.compare import ComparativeReport import common_setup from common_setup import IssueConfig, IssueExperiment, RelativeScatterPlotReport DIR = os.path.dirname...
441a4a6af9cd44d09d2ca35d8b76e88f59fe2eafb0dc2ec025ded20eaf9b0e29
Python
1,644
55
#! /usr/bin/env python # -*- coding: utf-8 -*- import itertools import os from lab.environments import LocalEnvironment, MaiaEnvironment from downward.reports.compare import ComparativeReport import common_setup from common_setup import IssueConfig, IssueExperiment, RelativeScatterPlotReport DIR = os.path.dirname...
45919a97066541fa34451332f9f2636ca167cf2916c463f4d74390d82042cce4
Python
1,644
50
# # MIT License # # Copyright (c) 2022 GT4SD team # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge,...
8081e76d27957beac51289843c82772d9e2bfd8e40d65f6bbf3b9e4c6e654dfa
Python
1,644
48
"""ANSI-to-segments translation for the embedded log view.""" from regtools.registration.gui.log_view import parse_ansi, ANSI_COLORS, _DEFAULT_FG def _texts(segs): return [s[0] for s in segs] def test_plain_text_is_one_default_segment(): segs, _ = parse_ansi("hello world") assert segs == [("...
285d7bfa7f927e4ff5cbc790ab85b7f67f04abe50ab29b5dd51fc716ba2c8a17
Python
1,645
48
"""Test remove trend.""" import numpy as np import pyprep.removeTrend as removeTrend def test_highpass(): """Test for checking high pass filters.""" srate = 100 t = np.arange(0, 30, 1 / srate) lowfreq_signal = np.sin(2 * np.pi * 0.1 * t) highfreq_signal = np.sin(2 * np.pi * 8 * t) signal = lo...
3319a39c7e1b99c59941a54d400ca6432c77c0ae29424ee055b10d923fa619b7
Python
1,645
53
import pytest import torch import elasticai.creator.nn.fixed_point as nn_fxp from elasticai.creator.arithmetic import FxpParams from elasticai.creator.nn import Sequential class SimpleAdaptSiLU(torch.nn.Module): def __init__( self, total_width: int, frac_width: int, num_steps: int...
3a41904299bb78ef9f276d88afa84c2046086803aae84f2d34808337eb5b3644
Python
1,645
47
from typing import Dict, Union import numpy as np import torch from ..base_transform import EEGTransform class ToTensor(EEGTransform): r''' Convert a :obj:`numpy.ndarray` to tensor. Different from :obj:`torchvision`, tensors are returned without scaling. .. code-block:: python from torcheeg i...
ebb29d916dce4b03d22b911d242731f2c2f559e6f2f2d4b8eb492bfd9230f68e
Python
1,645
62
import os, sys sys.path.append('../../4K_HETU/app') import arrayexp import globals.global_func as gf import numpy as np import arrayparams if __name__ == '__main__': on_chip=True np.set_printoptions(formatter={'float': '{: 0.3f}'.format}) if on_chip: array = arrayexp.ArrayExp() else...
44c77ace987f5d267b3ae451495b779f4852514c32aa4d8949615da2488b586a
Python
1,646
55
extensions = dict( extra_params=[('verbose', 'FALSE')], module=""" #' Determines whether an XGBoost model can be built #' #' Ask the H2O server whether a XGBoost model can be built. (Depends on availability of native backend.) #' Returns True if a XGBoost model can be built, or False otherwise. #' @export h2o.x...
8adac054ffe2ca5d5728f017e723a97c2ec15d043157f8cd7033ebcde4135e57
Python
1,646
41
from stable_baselines.common.callbacks import EvalCallback from stable_baselines.common.policies import MlpPolicy from stable_baselines import PPO1 as RL from Env import make_env import os os.environ["CUDA_VISIBLE_DEVICES"] = "7" if __name__ == '__main__': # SimulationMode: # True - use memristor...
0b3a224ad33f9052f43a433f125b68ccc7a7cd8b270a2a9c1d7bbce3284736bf
Python
1,647
53
# Diana Giraldo # May, 2023 import torch import torch.nn as nn from torch.utils.data import DataLoader from torchvision.transforms.functional import resize from tqdm import tqdm INTERP_MODE = 'bicubic' ALIGN_CORNERS = False def apply_model_dataset( model, data_set, device, batch_size = 5, scale_f...