sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
f4d394bb0df8c8ac23115c1c1f7e99577422c65c92484113681cbbc1e76b5f37
Python
2,141
82
# -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Base module variables """ from ._version import get_versions __version__ = get_versions()["version"] del get_versions __author__ = "tedana developers" __copyright__ = "Copyrig...
2ba937745a31bd81f7d35ce305d979364e5b469c720859237d79989c6b6cde42
Python
2,142
79
import random from torchvision.transforms import functional as F class Compose(object): def __init__(self, transforms): self.transforms = transforms def __call__(self, image): for t in self.transforms: image = t(image) return image def __repr__(self): format_st...
930f4043f5022bbc56b6a0c817415f327d208107ed0d42e209d6160f5f2e2772
Python
2,142
80
"""Core recipes for Psi4.""" from __future__ import annotations from importlib.util import find_spec from typing import TYPE_CHECKING from monty.dev import requires from quacc import job from quacc.recipes.psi4._base import run_and_summarize has_psi4 = bool(find_spec("psi4")) if TYPE_CHECKING: from typing imp...
a68dbdfc5d4cb7ca99a6c1635fb115c004f4c9d0bf35b5626bd8158bb47fc170
Python
2,142
59
# Copyright 2017 Elisey Zanko # # 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 writing, sof...
c0679c66d0a9a85a349c0b4e7b31da8c2e84a145be79f55acc3941c8744d4543
Python
2,142
70
import os import toml import logging import jobflow as jf from ase.io import read from quacc import get_settings from quacc.recipes.newtonnet.ts import ts_job, irc_job, neb_job # Load configuration from TOML file config = toml.load('inputs_using_newtonnet.toml') # Constants from TOML file REACTANT_XYZ_FILE = config['...
cce7c65c22d39fe291126ce597981af7fde899ac91791a855a437e8ee2f31416
Python
2,142
72
import torch import pandas as pd class SubsetDataset(torch.utils.data.Dataset): def __init__(self, X:pd.DataFrame, y:pd.DataFrame): super().__init__() self.X= X self.y= y def __len__(self): return len(self.X) def __getitem__(self, index): return self.X[index], se...
ce9e605584c15c14eb360bf77ba5d5c63ac80bb12e7a64cb4e48bfb2096433ee
Python
2,142
73
# %% import os os.environ['CUDA_VISIBLE_DEVICES'] = "0" import numpy as np import torch import torch.nn as nn from torch_geometric.data import DataLoader import argparse from scipy.stats import spearmanr from metrics import get_cindex from dataset import * from model import MGraphDTA from utils import * def val(model...
d0061dfd2d8ee66d8aed752780b516250c638d669392fe2cad22b33adbfeccb2
Python
2,142
76
"""Processes ECoG and LFP data to generate Granger causality values.""" import os import sys from pathlib import Path cd_path = Path(__file__).absolute().parent.parent sys.path.append(os.path.join(cd_path, "coherence")) from coh_connectivity_processing import granger_processing from coh_handle_files import load_file...
3ee7f3cd2ad5334fd4b9aa3dfb70305ac3197199a79513e2d0865c50fa80baba
Python
2,143
72
"""This module contains functions to evaluate the training results.""" import numpy as np import pandas as pd from sklearn.metrics import accuracy_score from sklearn.tree import DecisionTreeClassifier def _proc_data(df, continuous_cols, label_name=None): """Transform dataframe into matrix of features and its lab...
b0a20cb2a75df54ea98086e7b555f8956f1e28370401d2bbaa4eecb798d088f2
Python
2,143
61
import os import unittest import tempfile from torcheeg.io import MetaInfoIO class TestMetaInfoIO(unittest.TestCase): def setUp(self): self._directory = tempfile.TemporaryDirectory() self.addCleanup(self._directory.cleanup) self._io_path = self._directory.name def test_init(self): ...
b338d05b30b0613c0b741a21ec3c3ffb8af9c9f90896a45616b8e377769dcdf8
Python
2,143
62
import warnings from elasticai.creator.ir2vhdl import Node as VhdlNode from .clocked_combinatorial import ClockedInstance from .node_factory import ( InstanceFactoryForCombinatorial, ) @InstanceFactoryForCombinatorial.register() def sliding_window(node): return SlidingWindowNode(node) def _check_input_out...
b4c3c60cf1ef1a704df5e1be958d65fe8ea7759b73e467ec71059c3491413dea
Python
2,143
71
import os import toml import logging import jobflow as jf from ase.io import read from quacc import get_settings from quacc.recipes.newtonnet.ts import ts_job, irc_job, geodesic_job # Load configuration from TOML file config = toml.load('inputs_using_newtonnet.toml') # Constants from TOML file REACTANT_XYZ_FILE = co...
c2ff9e514d42ed2bef39d0962ad4f085b1ee279dd58cbc7a9d63caf339d57277
Python
2,143
65
import os import numpy as np import pandas as pd from click.testing import CliRunner from scbs.cli import cli from scbs.diff import parse_cell_groups def test_parse_cell_groups(): group_df, groups = parse_cell_groups( "tests/data/tiny_diff/cell_groups.csv", "tests/data/tiny_diff/" ) assert len(g...
d77b562c1cb742117c6e087b5d00dbe7ece258b350d4795031ca60ace6aa62a4
Python
2,143
91
# Node-group asset "LCh to Color" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECKING ...
db162f050d31e4768f6c481b02a695352ef0214029cee07fcc30aa1dcbde0c91
Python
2,143
55
from dataset import TCGA_Project_Dataset, TCGA_Program_Dataset, METABRIC_Dataset from utils.logger import setup_logging from pathlib import Path from utils import set_random_seed SEED = 1126 set_random_seed(SEED) if __name__ == '__main__': setup_logging(Path('./Logs/Tests/')) project_id = 'TCGA-PRAD' dow...
fe2f7a386333d9fce8e1722940eaa313b82f61e3e5a1fb8c4795aefd9bb2943a
Python
2,143
26
"""posthoc_rival_disagreements_2026-09-30.py (descriptive, post hoc). The rival counts 1,208 neurons with a literature GABA/glutamate identity that are excitatory in Shiu et al.'s file and 1,399 literature-cholinergic neurons that are inhibitory. How many of them are the default (no transmitter call -> the file's rule)...
0ef3355a81d9b5ec0a9b000bf9181d6df7627ae5c091c31e00700a6f26b00a11
Python
2,144
89
# Node-group asset "Force Gravity" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECKING...
f55966e7c555e643ed7deb5c8488f963ea0077e1103cb12c59ab80f60db03d13
Python
2,144
58
# 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...
8605dfb54f9e6aee0c5b11d22eab933337a962ae413c2db3842921377825072f
Python
2,145
69
"""HTTP cache implementation. """ import os from contextlib import contextmanager from typing import Generator, Optional from pip._vendor.cachecontrol.cache import BaseCache from pip._vendor.cachecontrol.caches import FileCache from pip._vendor.requests.models import Response from pip._internal.utils.filesystem impo...
bec88125662d5eca028456d03f5e6afcba23ea90cf284337e8bac1421e984778
Python
2,145
70
import numpy as np import scipy.stats as stats def multregr(_X, _y, a = 0.05, opts = None): # function [hatb, bci, haty, hatM, covM, hats2, t, rsq, F, pF, r] = multregr(X, y, a); # # Performs multivariate regression of input data X for output vector y, assuming a linear # relationship y = Xb, giving confidence...
ef85dbef8276993bc4c4099dac081ae11b8784c6ecd338b66030b74d3376eb4f
Python
2,145
69
#!/usr/bin/env python # -*- coding: utf-8 -*- """ A very generic case where the same morphology on different file formats is loaded in LFPy using a generic template specification, defined by file LFPyCellTemplate.hoc Execution: python example_LFPyCellTemplate.py Copyright (C) 2017 Computational Neuroscience Grou...
eff8bc57107fce573f22fb9c6193d934dbb329042e3276433d57cbd30c9f2f56
Python
2,145
64
import torch from torch import nn from torch.nn import functional as F from torchdrug import layers class ConditionalFlow(nn.Module): """ Conditional flow transformation from `Masked Autoregressive Flow for Density Estimation`_. .. _Masked Autoregressive Flow for Density Estimation: https://arxi...
a1e996407757f4120273001acea0f7830b4e07629b650f5e0ceb3fd19cb65997
Python
2,146
59
import numpy as np import pytest from scipy import sparse from pertpy.tools.core import _is_raw_counts @pytest.mark.parametrize( "data,expected", [ # Dense arrays - positive cases (np.array([[1, 2, 3], [4, 0, 5]]), True), # integers with zeros (np.array([[0, 0], [0, 0]]), True), # a...
62c6f1309e1593f5a8245e1f8647a5c02c130ff84ee768209ea1c70274bdd1c5
Python
2,147
83
# Syncopy benchmark suite. # See "Writing benchmarks" in the asv docs for more information. import syncopy as spy from syncopy.synthdata.analog import white_noise class SelectionSuite: """ Benchmark selections on AnalogData objects. """ def setup(self): self.adata = white_noise(nSamples=25000...
a9b3a85d10ddc54e70545359b9ceeafba9de092156edc1a9b581c540c8a5e5f9
Python
2,147
81
"""VHDL implementation of HDL abstractions.""" from elasticai.creator.hdl_ir import Node from elasticai.creator.ir2vhdl import ( EntityTemplateDirector, Instance, LogicSignal, LogicVectorSignal, NullDefinedLogicSignal, Signal, ) from .protocols import HDLInstance, HDLTemplateDirector, Template...
d8e316b629c7cc73f8d99d5bcc5cb77dd4940903f895a93776f87f5b977d5660
Python
2,147
76
import pytest import torch import elasticai.creator.nn.fixed_point as nn_creator from elasticai.creator.arithmetic import FxpArithmetic, FxpParams from elasticai.creator.nn import Sequential from elasticai.creator.nn.fixed_point.math_operations import ( MathOperations, ) from tests.integration_tests.nn.fixed_point...
dcf81709b8103fc0774efb50c696d24dafc00984554a093c5cb51d8b56efa210
Python
2,147
78
# 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...
e2f287acbb6be4c744eddc9b588e1fe86e572549781600ad3d8486ab9217bf90
Python
2,148
48
# coding: utf-8 from .config import cfg import torch from itertools import product as product from math import ceil class PriorBox(object): def __init__(self, image_size=None): super(PriorBox, self).__init__() # self.aspect_ratios = cfg['aspect_ratios'] self.min_sizes = cfg['min_sizes'] ...
09629e0a2632653f7e67ad272dee6c608a027474e63b0b87baf0efc0f6661de5
Python
2,149
49
import pandas as pd import numpy as np import os import pysam # Step2: Get hg38 Reference and Altered SNC fa files of DA-cCREs fa = pysam.FastaFile("../hg38.fa") SNCs_df = pd.read_csv('../SNCs_hg38_995-matched.txt', sep='\t') SNCs_df['Ref'] = SNCs_df['Ref'].map(str.upper) SNCs_df['Anc'] = SNCs_df['Anc'].map(str.uppe...
0c8a75f7781b79269ca2bb571e08b2ff7fc596e88d669bbc9cfc7b538e698f53
Python
2,149
58
"""Bookmark add / remove / activate slots for the viewer. Small cohesive cluster - pulled into a mixin so viewer.py doesn't have to carry it. Consumer class must provide ``self._bookmarks`` (a ``set[int]``), ``self._bookmark_list`` (a QListWidget), ``self._slice_slider`` (QSlider), ``self.annotation``, ``self.cu...
f52cc445015059f152f077cfb8fe90e4b48a248ec40514bcba8eb6c4becbe337
Python
2,149
56
"""Adapter for lifelines survival predictions.""" from __future__ import annotations from abc import ABC import pandas as pd from SurvivalEVAL.evaluations.custom_types import NumericArrayLike from .pycox_evaluator import PycoxEvaluator class LifelinesEvaluator(PycoxEvaluator, ABC): def __init__( self...
a237f5ad3dec3755ab0d8acb57107dc764203e9f22bfa8e43e5feeec2ec73bd4
Python
2,151
76
## # \file write_random_motion_transforms.py # \brief Create and write random motion transforms # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date November 2017 # import numpy as np from niftymic.utilities.input_arparser import InputArgparser import niftymic.validation.motion_simulator as m...
a4d8b153abdfefe6c3e3ebe30890ad52f47d35197f1e7e347cb76464e1fae0f1
Python
2,151
54
# read in the data import numpy as np import torch def ReconstructFrame(data, mask, shape, fill_value = np.nan ): temp_data = np.empty((*shape,data.shape[-1])) temp_data[:] = fill_value temp_data[mask] = data return temp_data def pass_through_model_batch(coords, latents, model, x_normalizer, y_normal...
b1fdef7389c40d21906211c2f6f48e6a0a9a1a657863d60983a62bda31315473
Python
2,151
53
from unittest import TestCase from pyseg.vtk_ext import vtkFilterRedundacyAlgorithm from pyseg.globals import * import vtk __author__ = 'martinez' class TestVtkFilterRedundacyAlgorithm(TestCase): def test_Execute(self): reader = vtk.vtkXMLPolyDataReader() # reader.SetFileName('../data/anchors.v...
d27c771023e7425793889abe3438e12523d93947dd54322a4d2e0e81a70ff8e2
Python
2,151
64
# 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...
0961185467f45ff98287029f60e58b0e934381ee7950f4ccdbc3d41d8fd0a609
Python
2,152
71
import inspect import types import typing from typing import TYPE_CHECKING import bpy from PIL import Image if TYPE_CHECKING: from ..entities.molecule import MoleculeAnnotationManager from ..session import MNSession def get_all_class_annotations(cls) -> dict: """Get all the annotations from the class inc...
975f0ed97a553ff12dcd7ed8c4481836eb77f2f88e81b3cff366644b0d99a276
Python
2,152
83
import os import pandas as pd from calvados.cfg import Config, Job, Components import subprocess import numpy as np from argparse import ArgumentParser parser = ArgumentParser() parser.add_argument('--name',nargs='?',required=True,type=str) parser.add_argument('--pH',nargs='?',required=True,type=float) args = parser.p...
c5e303fcb0a7b2328006b76bf1a8c011e3de53ef5942e102ed1db5e6c92d20ff
Python
2,153
78
import pytest import torch import elasticai.creator.nn.fixed_point as nn_creator from elasticai.creator.arithmetic import FxpArithmetic, FxpParams from elasticai.creator.nn import Sequential from elasticai.creator.nn.fixed_point.math_operations import ( MathOperations, ) from tests.integration_tests.nn.fixed_point...
08602aedf5c35b5e5ece816bac13d051cd1eb359456da3f9e4f3c209558c3d2b
Python
2,154
60
import pandas as pd import torch import torch.nn as nn import argparse # Parse command-line arguments with default values parser = argparse.ArgumentParser(description='Run MLP model on input data.') parser.add_argument('--input_file_path', type=str, default='./validation/intact_positive_PPI_2024-07-11-08-09.GNN_input....
66371b57fedb6fb84ea7832de629c96d48c10dd90d947522223cb29811dd5d28
Python
2,154
55
# 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...
505f7625d9de3c692301f4601e86c2232a0f05f5f0fa453803097285127e5486
Python
2,155
59
import numpy as np import scipy.sparse as sp import torch import torch.utils.data as data_utils import networkx as nx import random class EdgeSampler(data_utils.Dataset): ''' The framework code for class EdgeSampler is borrowed from https://github.com/shchur/overlapping-community-detection/blob/master/nocd/sa...
f6c17b181870034ccbd6be798abd90f29695b110b8603051a156a6b2228483ce
Python
2,155
72
# Special token ID for End-of-Sequence EOS_TOKEN_ID = 0 # Offset is the index at which ordinary vocabulary tokens start VOCAB_OFFSET = 1 class Tokenizer(object): """Docstring for Vocab.""" def __init__(self, config): """Mapping from symbols to numbers :vocab: dict-like from str to int ...
ff7954a7569a4a3c5602cc05370ba1ba9098531e19c6c1085f8b39c83ba5afb4
Python
2,155
82
"""Constructor for spin-echo spectrum sequence.""" from math import pi import pypulseq as pp from console.utilities.sequences.system_settings import system as default_system def constructor( rf_duration: float = 200e-6, dead_time: float = 0., num_samples: int = 256, acq_bandwidth: float | int = 20e3...
423e413e760cdfcd2a50060b17024b6258041d43f568cf614533d0ee972461dc
Python
2,156
69
# 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...
b6373ccee6f70f75042afa935497aa255b61cbed6dbfe8a9ee3e5dd7e0ef3ff2
Python
2,156
60
from typing import Any from torch import Tensor from torch.nn import Conv1d as TorchConv1d from torch.nn import Module from torch.nn.utils import parametrize as P class Conv1d(TorchConv1d): """A 1d convolution. The weights and bias are fake quantized during initialization. Make sure that math_ops is a mo...
2003fd49b3b86e4ad3926e69ee9c48513f751016f070612916dd6a598ea1d746
Python
2,157
61
from typing import Any from torch import Tensor from torch.nn import Conv2d as TorchConv2d from torch.nn import Module from torch.nn.utils import parametrize as P class Conv2d(TorchConv2d): """A 2d convolution. The weights and bias are fake quantized during initialization. Make sure that math_ops is a mo...
8e5b3f4759c631a3b56f0ae51d1bfb876174e0a4951c91217b9abfef02be2619
Python
2,157
34
"""posthoc_brian2_gap_2026-10-02.py (POST HOC, after R1 of PREREG-2026-10-02-KEYSTONE-ROBUST failed) Why does one v2LN30 (root ...5919) break 29 of 48 channels in my spiking cut-out but only 1 of 8 in Shiu's Brian2 code on the whole brain? Same 8 channels: (a) my simulator on the cut-out, 2 trials and 5 trials; (b) my ...
ab939a397e833055f328f076b68b6c45d8734d58092d06c39f2ba0c89fde4612
Python
2,158
76
import pytest import torch import elasticai.creator.nn.fixed_point as nn_creator from elasticai.creator.arithmetic import FxpArithmetic, FxpParams from elasticai.creator.nn import Sequential from elasticai.creator.nn.fixed_point.math_operations import ( MathOperations, ) from tests.integration_tests.nn.fixed_point...
bfcfaa2c3a4b663ee70f937f2e7a19bb98e7074fde6322c7ebe83912b7fb70a3
Python
2,158
54
from collections import defaultdict def assign_names_from_annotations(neuron_data): token_to_cell_counts = defaultdict(int) cell_to_potential_names = defaultdict(list) for rid, nd in neuron_data.items(): token_to_cell_counts[nd["group"]] += 1 cell_to_potential_names[rid].append(nd["group"...
262514cad5e64481d9d5112364a3732fe86c33f5a464aa4f54ae1894669e5309
Python
2,159
36
""" Created on Tue Jun 28 02:32:18 2022 @author: Haotian Teng """ import toml import numpy as np import seaborn as sns from matplotlib import pyplot as plt from xron.nrhmm.hmm_relabel import get_effective_kmers chunk_control = np.load("/home/heavens/bridge_scratch/ime4_Yearst/IVT/control/rep1/kmers_xron_4000_noise/c...
54487a0e1b525a75fab9427a27d6bfde0e2246a506521bc0ba1adc8342cb160d
Python
2,159
51
"""Shared non-PIR test fixtures. The orientation/permutation bugs this repo has hit (``_reorient_voxel_points``) all stayed hidden because the default fixtures are PIR (the Allen CCF ships PIR, which is the identity permutation). A test suite that only exercises the symmetric default certifies exactly the configu...
6bc6ea68181b033c56342feeb01514baa6fe31a94e2a0d5dcb76a83bae3fa900
Python
2,159
59
#!/usr/bin/env python """The setup script.""" from setuptools import setup, find_packages with open("README.rst") as readme_file: readme = readme_file.read() with open("HISTORY.rst") as history_file: history = history_file.read() requirements = [] test_requirements = [] setup( author="Mitchell Robert...
6df2f07b48d4348789c6c59552d4928cade5adacb1279dc9a9c1aaf725b11e02
Python
2,159
61
# MIT License # Copyright (c) 2023 Qiyun Wu # 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...
0934fb10034e7abde381af5ab22f5fa0172c5046106e3967d0d0bdd1f48c6d4d
Python
2,160
76
import pytest import torch import elasticai.creator.nn.fixed_point as nn_creator from elasticai.creator.arithmetic import FxpArithmetic, FxpParams from elasticai.creator.nn import Sequential from elasticai.creator.nn.fixed_point.math_operations import ( MathOperations, ) from tests.integration_tests.nn.fixed_point...
bcaaf30611a863013263e18bd8a6e6aa0f141a7d27de8ed7d7d24a44e00b920e
Python
2,161
58
from itertools import combinations, product, permutations from scipy.spatial.kdtree import KDTree import numpy as np from motion_planners.utils import INF, compute_path_cost, get_distance def compute_median_distance(path1, path2): differences = [get_distance(q1, q2) for q1, q2 in product(path1, path2)] retur...
348b9380fea5bb9282fc21e76dcc1a5071913bb2c7c82cd1bc7b6d4dc4e09315
Python
2,162
73
""" Tests module distance # Author: Vladan Lucic # $Id$ """ from __future__ import absolute_import __version__ = "$Revision$" from copy import copy, deepcopy import unittest import numpy import numpy.testing as np_test import scipy #from pyto.segmentation.test import common from pyto.segmentation.distance import...
717efb8e7a2a83b8474ac1bc107e70d07d84942d1eab563450492b2d06e39da7
Python
2,162
64
"""Run mean-field theory ------------------------ This example script shows a mean-field theoretical analysis using for network parameters using NNMT - the Neuronal Network Meanfield Toolbox (https://github.com/INM-6/nnmt). """ import os import numpy as np from mesocircuit import mesocircuit_framework as mesoframe im...
254de89e75226333d5ad3164f572286b9a2e260f08402e9682172d0113840f30
Python
2,163
76
import tensorflow as tf import numpy as np import pytest from pinn.networks.pinet import PiNet from pinn.networks.pinet2 import PiNet2 from utils import rotate class TestEquivar: def test_pinet(self, mocked_data): pinet = PiNet( atom_types=[0, 1], ) for batch in mocked_data: ...
3c47ef33f7e4bd3f8965a9e9651f1bce7307250288ca21c1d1aa74447129d94f
Python
2,163
91
# Node-group asset "OKLab to LCh" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECKING ...
9558752b2fc33a186ac769a93be17d1d65984932b8a90107706313cb4b995029
Python
2,163
71
# 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...
4114d86d447014284f5694c76cfebdb72882dc2163ddc76bb39aed11c6d2d7df
Python
2,164
71
import sys, math,copy from pybioshell.core.data.io import find_pdb from pybioshell.core.data.basic import Vec3Cubic from pybioshell.std import vector_core_data_basic_Vec3Cubic if len(sys.argv) < 3 : print(""" Reads PDB file with wrapped coordinates (from simulation with periodic boundary conditions), unwraps th...
477819ab5ee4d195e159982d6d0d0df2820152a6fa63f15b551199e82ddd86b6
Python
2,164
63
from elasticai.creator.file_generation.savable import Path from elasticai.creator.file_generation.template import ( InProjectTemplate, module_to_package, ) from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_port from elasticai.creator.vhdl.design.design import Design from elasticai.c...
ad1c86cae379cd3117ac5c04dfb50c2ddd15804858f407428967f965d419763e
Python
2,164
74
"""VICReg loss module. Copyright (c) 2024 University of Michigan. All rights reserved. Licensed under the MIT License. See LICENSE for license information. """ import torch from torch import nn import torch.nn.functional as F def off_diagonal(x): n, m = x.shape assert n == m return x.flatten()[:-1].view...
8fd9976dd3b5f802b858ff2a18ca506efd38918ca5cb712fbfecf02ecc836e69
Python
2,165
73
# 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...
c452b03e5f93eb543a9c60249e068d2f483e881975b5a70763bd57f1528693dd
Python
2,165
86
import os import sys import ast import tempfile from contextlib import contextmanager from rdkit import RDLogger def input_choice(prompt, choice=("y", "n")): """ Print a prompt on the command line and wait for a choice. Parameters: prompt (str): prompt string choice (tuple of str, opti...
1c2b0592c66924b7933f734493f9e0ac079755146d4ebb7287d78e001a113f80
Python
2,166
99
import re from ._functools import method_cache # from jaraco.text 3.5 class FoldedCase(str): """ A case insensitive string class; behaves just like str except compares equal when the only variation is case. >>> s = FoldedCase('hello world') >>> s == 'Hello World' True >>> 'Hello World'...
72bd912e4cdfcb57456d64396fe5d7a05fdf0b46c911bf9996dae4d77572621b
Python
2,166
68
import matplotlib matplotlib.use("Agg") import torch device = torch.device("cuda" if torch.cuda.is_available() else "cpu") import yaml, io with open("./config/simul_study_config.yaml", 'r') as stream: config= yaml.safe_load(stream) config["default_path"]= str(config["default_path"]) config["split"]= float(c...
e109dcab5688dd7b985ab63699004c3d8d9909806c96e1197ad0583e38284f3a
Python
2,168
46
import os import pandas as pd import numpy as np import unittest import sys sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../src") from hornet.model import standardize class TestStandardize(unittest.TestCase): def setUp(self): self.df = pd.DataFrame({ 'etot': [1, 2, 3]...
2ed7df7a62ce162e654c29f71b06411e7398155e581cd0fa68b9de658820f318
Python
2,170
75
""" Script for loading Google's Open Images dataset into FiftyOne and saving as a persistent Dataset. | Copyright 2017-2022, Voxel51, Inc. | `voxel51.com <https://voxel51.com/>`_ | """ import argparse from pathlib import Path import sys sys.path.append(str(Path(__file__).resolve().parent.parent)) from error_analysis...
f607fb1febdfd221fe447162c8a5d3f3f95a7283ddf2f2ae9035b13c6adc1577
Python
2,170
74
import pytest import requests from pertpy.data import _dataloader @pytest.fixture(autouse=True) def _no_sleep(monkeypatch): """Keep retries instant so the tests never actually wait.""" monkeypatch.setattr(_dataloader.time, "sleep", lambda _seconds: None) def test_download_retries_on_transient_error_then_su...
da6ed9443d748ed42eb6205842db2b9e1320cdeb15f81b0073ec3133649783d9
Python
2,171
70
#! /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...
079fb1466fe136952e047df86ea591d7afa68536dd4b02a68239ea1ccd5a7c41
Python
2,172
102
from __future__ import annotations from quacc import flow, job, subflow def test_decorators(tmp_path, monkeypatch): monkeypatch.chdir(tmp_path) @job def add(a, b): return a + b @job def mult(a, b): return a * b @job def make_more(val): return [val] * 3 @sub...
6639b62068aa99d260dbeed192823e869934e503533eba2d606ab2b8acd7820d
Python
2,172
60
# # 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,...
778c9ef99c754672ff05ca857bc4635ded946cfd0f480e8590dd0c15530847f8
Python
2,172
61
import sys import os import re def CenterPrint(tmp_filenm,tmp_rep): os.chdir('distances') fly_list = [] for file_nm in os.listdir('.'): if file_nm.startswith('fly-'): fly_list.append(file_nm) fly_list = sorted(fly_list) f_out_nm = '_'.join([tmp_filenm,str(tmp_rep),'centroid.txt'...
f4deb42739085b257ba577e54528366c10e9cedafa910a02663678d5b1015b8d
Python
2,173
68
""" Optuna example that demonstrates a pruner. In this example, we optimize a classifier configuration using scikit-learn. Note that, to enable the pruning feature, the following 2 methods are invoked after each step of the iterative training. (1) :func:`optuna.trial.Trial.report` (2) :func:`optuna.trial.Trial.should...
59d55ea3070539b42de7e0c542b281408f93508c1d234d3a3b07085bce105cde
Python
2,174
74
# Import libraries import numpy as np import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import Dataset, DataLoader import torch.nn.functional as F import matplotlib.pyplot as plt import os import pickle import numpy as np from sklearn import metrics from sklearn.model_...
928f1bfd17e1689e6cb23b034cbbf73555145d58da20f6a0c48399b6c1179727
Python
2,175
77
#!/usr/bin/env python from __future__ import print_function import numpy as np from pddlstream.algorithms.focused import solve_focused from pddlstream.language.generator import from_fn, from_constant, from_test, universe_test, empty_test from pddlstream.language.stream import StreamInfo from pddlstream.utils import ...
9377bfc56367e57eb093ab704ee7e8f8ddf954ad34b1001b3d34e6fa26a71b3f
Python
2,175
58
from __future__ import absolute_import, division, print_function, unicode_literals import argparse import logging import os import sys import tensorflow as tf import matplotlib.pylab as plt from tensorflow.keras import layers from tensorflow.keras import models import numpy as np import PIL.Image as Image import glob ...
5cb572eb8703fa2b0e79919b09b56ff2adff808d3b5127db088e8d430483eef4
Python
2,176
61
# 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...
83d502f4f937be7c1ac09bcfc142883fcf5fd7423cdbb20de056e57baa85dac2
Python
2,176
64
{ "connectome":{ "data_dir": "../../data", "name": "MICrONS" }, "save_path":"../../data", "analyses":{ "simplex_counts":{ "save_suffix":"", "kwargs":{"threads": 8}, "controls":{ "seeds":[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...
0c4d17574e0125815ca982a572db75b1a5bcbf004a4af77f619de795e8f1c74d
Python
2,177
70
''' Script that generates the ECFPs. NOTE: It's very important that the ML table that you use lines up with the ECFPs. So each line number in the ML table should correspond to the line number in the ECFPs .npy file. This is incorporated in the ML-table generation script. Therefore, generate the ML-table after the EC...
f16b532875d403fb81e641dfaa87ec2260741ff2f9a4db5f1597655b1720927d
Python
2,177
78
# 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...
0b4eef3d39ced419a39393878fd1ad65ed2d9e132a0ffed25d10c5e09dd2cd0b
Python
2,178
58
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from common_setup import IssueConfig, IssueExperiment, is_test_run BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"] REVISIONS = ["issue657-v1-base", "issue657-v1"] CONFIGS = [ IssueConfig(h...
b10c3411cd6ae96b748c4271eb79d5d13cdf14a702c2987e2f9a4e5fcdca1f14
Python
2,179
83
################################################################################ # Copyright (c) 2021-2024, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # Written by D. Jones <djones@llnl.gov> and UCSD collaborators in listed in CONTRIB.md # # All rights reserved....
b9bb3a6bbb318f72433512960b2094da3e6bd4207bae0c8e360673619aba0ffe
Python
2,179
76
# Copyright 2016 Julien Danjou # Copyright 2016 Joshua Harlow # Copyright 2013-2014 Ray Holder # # 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 #...
fc86403dc5b95d5de73092db743cdbddc4b33a5d1e655d0f98329465954bbb6f
Python
2,179
60
import torch import torch.nn as nn class RevIN(nn.Module): def __init__(self, num_features: int, eps=1e-5, affine=True, target_dim=None): """ :param num_features: the number of features or channels :param eps: a value added for numerical stability :param affine: if True, RevIN has ...
9839db095fe72556b597ff87c4db8742249084be790d870fbee6c5169c2a69e8
Python
2,180
72
from pathlib import Path from random import randint from typing import Any import elasticai.creator.ir2verilog as ir from elasticai.creator.file_generation import find_project_root as get_path_to_build from elasticai.creator.ir import Registry, attribute from elasticai.creator.ir2verilog import Ir2Verilog, factory d...
a19adc54e2f662b97784e00bdb7bceada40cda5bd874219718d0edd784c1c819
Python
2,180
68
# -*- coding: utf-8 -*- import tensorflow as tf from .. import _logging as logging from .core import * __all__ = [ 'PReluLayer', ] class PReluLayer(Layer): """ The :class:`PReluLayer` class is Parametric Rectified Linear layer. Parameters ---------- layer : :class:`Layer` Previous ...
c0e9e3c5b5c3939981aad2dfcac50da0cdbeac0c64499bcf778615214f7dadd9
Python
2,180
47
import os import pandas as pd def main(): results_dir = '/home/grads/tasnina/Projects/BIONIC-evals/bioniceval/results/' pombe_coann_file = results_dir + 'icon_pombe_hyperparam_coannotation.tsv' pombe_func_file = results_dir + 'icon_pombe_hyperparam_function_prediction.tsv' pombe_module_file = re...
cf1956c54a7391d648d0a7c78cd8746a9dc35e5dfc52eb9fdd52f0362b71d5b8
Python
2,180
42
# script to replace values of the @chrs, @StartSites, @StopSites perl variables with suzukii contig information import os import re env_vars = ['Altitude', \ 'Annual_mean_wind_speed', \ 'Annual_Precipitation', 'Precipitation_Seasonality', \ 'Mean_Diurnal_Range', 'Mean_Temperature_of_Coldest_Quarter', 'Mea...
a174b0b3dca4db56a482b896a68a3b72d5ee9db71991719b7b150ad5378deaac
Python
2,181
59
#!/usr/bin/env/python # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. class EarlyStoppingCriterion(object): """ Arguments: patience (int): The maximum numb...
03fd7e83d3037b7440000101924fa0b8804ae242851970dfc25345898f2f3c35
Python
2,182
71
import pytest from pupil_recording_interface.base import BaseConfigurable from pupil_recording_interface.device.video import BaseVideoDevice @pytest.fixture() def configurable(): class Configurable(BaseConfigurable): _config_attrs = {"configurable_type": "test"} _ignore_args = ("arg3",) ...
92e6c49575f76ffc9c7675ccae921a75599dfe2b4d8a7adc3aa21b3b9686cd05
Python
2,182
97
# morphoglia/io/image.py from __future__ import annotations from pathlib import Path from functools import lru_cache from typing import Iterable import cv2 from ..core.models import ImageRecord, DatasetIndex from ..metadata.nomenclature import NomenclatureExtractor class ImageIndexer: """ Discovers image file...
ac6f16f3b87b8b7aef87ad9b608d68110d06563838d544a8c78da620a3c14c80
Python
2,182
61
import os import torch def update_params(params, epoch, freeze_epoch): """ update parameters based on epoch freeze_epoch (>=1): until which we only learn autoencoder, after which we reset alpha to the one specifed in param files """ loss_params = params["loss_param"] # pretrain_ratio = 0.0 ...
9074df49ddc78a73318e4df1bc83f267ad750286bf142cd3fd68c47497aa7ab4
Python
2,183
83
#!/usr/bin/env python # coding: utf-8 import pandas as pd import math import numpy as np from scipy import stats from skimage import data from skimage.transform import resize import argparse import sys # parser = argparse.ArgumentParser(description= 'Preprocess .vcf files') # parser.add_argument('number', type=int,...
00a05b102462befad4391235f95681832b621d6bcbf803db2931ada60049e98a
Python
2,184
69
#!/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 metric calculates the distance between the ego vehicle and another a...
2bb3285bc1d0a7da75fadd9c0961fb97357151ec88607e7906a66a9d5ebda434
Python
2,184
70
# 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...
4e364fb2177e5f05919abbbfd9b2403323d88fcbd15a50eeca0b50cbcf9d44b4
Python
2,184
76
import argparse import numpy as np import torch import trimesh from tqdm import tqdm def load_poses(path): poses = [] with open(path, "r") as f: lines = f.readlines() for line in lines: c2w = np.array(list(map(float, line.split()))).reshape(4, 4) c2w[:3, 1] *= -1 c2w[:3, 2...
3cfc498d62bbf2ec58e9b127a422bf971e288f7a3bc8360627c12c538d0a3009
Python
2,185
79
# Node-group asset "Residue Name" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECKING ...
5deb542c426a89c00838ec282ba8c12a910738eba59aea2c06ba8f90e659a5bb
Python
2,185
48
# -*- coding: utf-8 -*- import numpy as np from scipy import interp from matplotlib import pyplot as plt from sklearn.metrics import auc TARGET = ("CVD", "HF", "AFib", "CAD", "MI", "Stroke", "DENOVO") ITERATION = tuple(range(100)) FEATURE = ("ALL", "LAB", "ECHO") RESULT = np.load("result.npy") AUROC = RE...