sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
6e59fa68de0872cbb662e48e804cf7cc064754dafa3ec1047c1efbf0f7179e51
Python
3,477
123
# 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...
b94ddf7ed840279b59e8343ae0f4e8046ca717d14dafb6b228e66191cbeb2931
Python
3,477
109
import os import toml import glob import shutil import logging from ase.io import read from ase.atoms import Atoms from quacc import get_settings from quacc import strip_decorator from typing import List, Dict, Any from quacc.recipes.newtonnet.ts import ts_job, irc_job, geodesic_job def geodesic_ts_no_hess_irc_newton...
d0a67637874b1d14016632550a8d320fa89ea421b4213b434dc8f641aee963d3
Python
3,477
118
import numpy as np import os import matplotlib.pyplot as plt import scipy.io as sio from scipy import stats import matplotlib.colors as mcolors def load_dictionary(dict_filename): """ Helper function to load a dictionary file. Args: dict_filename (str): The filename of the dictionary to load....
3e6454d454787bd9faedbde7a04f34e356c9bb9283057f81e14e10af2a35f740
Python
3,478
94
# # 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,...
ee1fc2d43341bc80b8236ec812054f1f211d3170de23e9d5fb360387eb4d8808
Python
3,479
93
#! /usr/bin/env python3 import os import subprocess import logging import APT_interface class cd : """Context manager for changing the current working directory, and automagically changing back when done""" def __init__(self, path): self.path = path def __enter__(self): self.old_path = ...
1e98b2e8dceb2764959ba478c7a91f9d74d22ac13cc5d19e417b6dc26c29bccf
Python
3,481
108
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Mar 10 15:32:51 2021 @author: eveshalom """ import numpy as np from scipy.integrate import cumtrapz as cumtrapz from scipy.integrate import trapz as trapz def modifiedToftsMurase(Cp, Ctiss, dt, datashape): ### Fit Modified Tofts (Linear from M...
30703660f0198d93cc00a41ed814c1dcebfd3df22a0b0e1bb4602dac6e2c87fd
Python
3,481
78
import torch.nn as nn import torch import torch.nn.functional as F class HANNA(nn.Module): def __init__(self, Embedding_ChemBERT=384, nodes=96): super(HANNA, self).__init__() self.Embedding_ChemBERT = Embedding_ChemBERT # Pre-trained embeddings (E_i) from ChemBERTa-2 self.nodes = nodes # N...
d1329d662c712d603ec70b40670e07729a899a3e17a6bc7566472dcb48134596
Python
3,481
120
import functools import os import pathlib import types import warnings from typing import Union, Iterable, ContextManager, BinaryIO, TextIO, Any from . import _common Package = Union[types.ModuleType, str] Resource = str def deprecated(func): @functools.wraps(func) def wrapper(*args, **kwargs): war...
d559c1c19d9fd935b74a0dfa2c1a37656126f9e105e1748a0bbf32cb21f2f113
Python
3,481
81
# Copyright (c) 2021, Ko Sugawara # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and t...
03ae5d67f4e9065ffb4c8550e11861438b415ebe614157b7c9fea835ca929fc8
Python
3,482
89
# -*- coding: utf-8 -*- import tensorflow as tf from .. import _logging as logging from .core import * __all__ = [ 'MultiplexerLayer', ] class MultiplexerLayer(Layer): """ The :class:`MultiplexerLayer` selects inputs to be forwarded to output. see `tutorial_mnist_multiplexer.py`. Parameters ...
2c7448ccce33ae5aba11bf70698fd590fa4b39a3a41d59a0a3f4a6c3df647dbd
Python
3,482
95
from collections import defaultdict from unittest import TestCase from codex.data.brain_regions import ( match_to_neuropil, lookup_neuropil_set, neuropil_description, REGIONS, REGION_CATEGORIES, neuropil_hemisphere, without_side_suffix, ) class RegionsTest(TestCase): def test_lookup_ne...
2262e3273757a44dcb8ea01a4b91cb03b915ae307c57e12171c68f1d4a231cf6
Python
3,483
123
# 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...
49c3275e974ffb0da82e9520a913b4c080ad8720a1af8963b77ce8b3af988f16
Python
3,483
77
import time import os os.environ["PATH"] = "E:\\Histology\\WSIs\\vips-dev-8.11\\bin" + ";" + os.environ["PATH"] import pyvips as vips import openslide print("Pyips: ", vips.__version__) print("Openslide: ", openslide.__version__) from PIL import Image from histolab.slide import Slide from histolab.tiler import...
75e8afd23e1106181402d25013fc809fae084bb5f49e2878b0ec066f541cea7f
Python
3,483
66
import pandas import numpy import connalysis import conntility from .network import filter_network def create_dd_control_networks(M, Msmpl, Mnrn, cols_coords, model_name, cfg): """ Generates from a network a control model that preserves the original network's distance dependent connection probability betw...
21ede48557feea4c9da6875140f46571b49babbbfc43e251707326b3fc0e720c
Python
3,484
96
import numpy as np import matplotlib.pyplot as plt def add_wmaze_plot(ax, color="tab:orange"): px = [0.5, 0.5, 7.5, 7.5, 6.5, 6.5, 4.5, 4.5, 3.5, 3.5, 1.5, 1.5, 0.5] py = [0.5, 4.5, 4.5, 0.5, 0.5, 3.5, 3.5, 0.5, 0.5, 3.5, 3.5, 0.5, 0.5] ax.text(1, 0.3, "L", ha="center", fontsize=10, color="black") ax...
36dec1148314265e25a2ea18498683338161efdeeea891fa19b98f581289bee1
Python
3,484
86
# coding=utf-8 # Copyright 2020 Mesh TensorFlow authors, T5 Authors and HuggingFace Inc. team. # # 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...
579674c2dfb60753aea677e51867820c837153ae175ce79523e484eb651fbdb5
Python
3,484
116
import torch import lightning.pytorch as pl import numpy as np from lib.human_legnet.trainer import LitModel from lib.human_legnet.training_config import TrainingConfig from torch.utils.data import DataLoader, Dataset class TrainSeqDatasetProb(Dataset): """np.array dataset""" def __init__(self, ...
cede07f407102fba859f8f33385f4d85f091b637eba2dabeb5b0c17fbf1a6d2d
Python
3,484
100
# 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...
3d39c7b64cdb73bb6a87bbb5943322f004e1ff6a836662590f9589cbbac8865d
Python
3,485
115
#!/usr/bin/env python # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module provides the base class for all autonomous agents """ from __future__ import print_function import carla from srunner.autoagents.sensor_interface import SensorI...
8e94612576fa381b93a08f593ee4b29f85474f82bac75fb821cc0c368186bc9e
Python
3,487
136
"""Score a directory of PDBs with BERTScore""" import argparse from eudockscore.equiformer_v2_resi.model_v2_new import EuBERT from torch_geometric.loader import DataLoader from transformers import BertTokenizer import torch import torch.nn as nn import os import pandas as pd from atom3d.datasets import LMDBDataset fro...
b4ba823075afc33eb131279e4bbc11f152f3971b741de2e8e8ac2c515a0cfb97
Python
3,487
93
import os import pandas as pd import numpy as np from tqdm import tqdm from joblib import Parallel, delayed import joblib import contextlib @contextlib.contextmanager def tqdm_joblib(tqdm_object): """Context manager to patch joblib to report into tqdm progress bar given as argument""" class TqdmBatchCompletion...
077937fa6db4ef1d641e9658583873bf31166ffe80516a09a322fc96d4e3448d
Python
3,488
112
import numpy as np import pandas as pd import os, re import matplotlib.pyplot as plt import matplotlib as mpl from os.path import join as pjoin import matplotlib.font_manager as font_manager import h5py # define path and params dataset_path = '' fmriprep_path = pjoin(dataset_path, ' ', ' ') support_path ...
cfc9d547660144be422c046e58d0dfae8c240622a10ac445451460d60b8c8fee
Python
3,489
126
# Node group "XPBD Solve Hook" (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 regenera...
80852c325d43b94e3b0b33d3ce403322f10383c84e2637eb9de4f5bc42ba4bc1
Python
3,490
110
from typing import List import numpy as np from lifelines.utils import concordance_index from pycox.models.loss import CoxPHLoss import torch.nn as nn from pytorch_lightning.utilities import rank_zero_warn from torch import Tensor import torch from torchmetrics import Metric from wsilearn.dl.torch_utils import to_nump...
171193c45ca19f07221b3c37ccb8e96af455002ac78a3bb6ac542cd2eeca2a2e
Python
3,491
83
import numpy as np import pytest from regtools.geometry_registration.pipeline import ( _pad_border, _to_rgb_uint8, _translate_registration_error, ) from regtools.geometry_registration.types import RunParams def test_runparams_border_default(): assert RunParams(tiff_path="x", ccf_index=0)....
59073c8e6ffa36b45ed64727423e96b151122b56b87a88ae7ce5471497cd4fba
Python
3,491
129
import warnings from abc import ABC from typing import Literal import bpy from .render import enable_optimal_gpu _CyclesDeviceTypes = Literal["CPU", "GPU"] class RenderEngine(ABC): """ Configuration for a render engine. Constructing an engine stores the requested settings without touching the scene;...
8496e3670e9637ac3457ca069236aa8224a575d772305e422239aba6966c1f4b
Python
3,492
95
from torch.utils.data import Dataset from torch import nn import torch class InceptionBlock(nn.Module): def __init__(self, input_channels, num_filters=16): super(InceptionBlock, self).__init__() self.conv1x1 = nn.Conv1d(input_channels, num_filters, kernel_size=1) self.conv3x3_1 = nn.Conv1d(...
37dcae070fc0b3cf05d25278e456d67692290cb975012f48a726aeda0392a8bc
Python
3,493
128
# 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, software # distributed under th...
6666fe04e8342a592011254fa5d268a74ace309b4b16b64df4a0985756bef82e
Python
3,493
101
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_1',nargs='?',required=True,type=str) parser.add_argument('--name_2',nargs='?',required=True,type=str) args = pars...
b1b59f6c2470715236ab5fc9c3b0290844b33d2f5515d4bbe2e184289dd858c2
Python
3,493
89
#! /usr/bin/env python3 import os import subprocess import logging import APT_interface class cd : """Context manager for changing the current working directory, and automagically changing back when done""" def __init__(self, path): self.path = path def __enter__(self): self.old_path = ...
e406f7cdf5c13701e782ba835703d71e919631e3a807273d66e450f2707d404e
Python
3,493
114
"""Nox sessions for cog Python SDK testing.""" import glob import platform import nox # Use uv for venv creation and Python management (uv auto-downloads Python if needed) nox.options.default_venv_backend = "uv" PYTHON_VERSIONS = ["3.10", "3.11", "3.12", "3.13"] PYTHON_DEFAULT = "3.13" TRACING_DEPS = [ "opente...
58259c222d7540aa2b59e951f2e6d5642e657cbae24aef9acc763e2df6acd27e
Python
3,494
70
"""DOOR_AND_FIRE.py 2026-09-30. Pre-registration: 04-NOTES/PREREG-2026-09-30u-DOOR-AND-FIRE.md With the antennal lobe repaired but il3LN6 left excitatory, does the right-side sugar input still explode? usage: python DOOR_AND_FIRE.py run | analyse""" import sys, os, time, hashlib sys.path.insert(0, os.path.dirname(os.pa...
9e2886b0718987cff7b2d7fcc3a9768f7f12653375a3f2ed3acc7a62ed2fa454
Python
3,494
98
# 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...
13a225ef808820d0918da91751c5aa4968df0bfb1da7842da1dd01c39cbf34d4
Python
3,495
109
"""distutils.spawn Provides the 'spawn()' function, a front-end to various platform- specific functions for launching another program in a sub-process. Also provides the 'find_executable()' to search the path for a given executable name. """ import sys import os import subprocess from .errors import DistutilsExecErr...
26c586534d61ee41f1f88ba54b8b1fc0a5a8bcbcf4df4ced045ac4f5c6e68651
Python
3,495
75
#! /usr/bin/env python3 import os import subprocess import logging import APT_interface class cd : """Context manager for changing the current working directory, and automagically changing back when done""" def __init__(self, path): self.path = path def __enter__(self): self.old_path = ...
b199ef0f3ce7bae935721a38044d704f7a2c383a1971302ee0d3005688e63120
Python
3,495
60
from sklearn.linear_model import LinearRegression #from ..tools import regression import numpy as np def multregconn(activity_matrix, target_ts=None, parcelstoexclude_bytarget=None, conn_mask=None): """ activity_matrix: Activity matrix should be nodes X time target_ts: Optional, used when o...
6d73a1434b8639b6c2d208c73c7b1fbb443f61174268166f414336c939782907
Python
3,496
97
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a cop...
90af762bde961ba4080b14aa742262670d6624c9d97da3464a8d4411bfa9e1ae
Python
3,496
106
# 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...
6df8795ee10995d3c24f619390b45e942e87bc2fdbb1f85c2eafe540300aec99
Python
3,497
92
# # 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,...
cabc1219faf486abf8286f4161f55d15a044a30fa9ab09331a8953317076aee6
Python
3,497
104
from __future__ import print_function from unittest import TestCase import numpy as np import matplotlib.pyplot as plt from soundsig.discrete_process import DiscreteProcessEstimator from soundsig.colormaps import magma class DiscreteProcessTest(TestCase): def setUp(self): pass def tearDown(self)...
e9d3ccedb420ed61b2fac08547f33d86733f787d869f53f8808e84c1152abd36
Python
3,498
129
import sys from scipy.io import wavfile from scipy.signal import stft, spectrogram from scipy.ndimage.filters import gaussian_filter import os import numpy as np from librosa import feature as libfeature def get_spec_min_max(wav_path, start_s=0, stop_s=-1): """ Automatically calculate the 'spec_min_val...
05c540b024ca2f86eb350fe6a6d1b7fb111f1c1a151756439ac2317cc5b21a85
Python
3,499
92
import os import pytest import numpy as np from oxasl import Workspace, AslImage, preproc def test_preproc_none(): wsp = Workspace() d = np.random.rand(5, 5, 5, 6) wsp.asldata = AslImage(d, name="asldata", tis=[1.5], iaf="tc", order="lrt") preproc.preprocess(wsp) assert wsp.asldata.ntis == wsp.as...
0f3529e9f0f0f6996c8364bbe92ea05d2b5ee3385bf61f0a0c5df2e79a4ebdb8
Python
3,499
107
# Node group ".MN_select_attribute" (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 reg...
431c06a821d9e6429e20c9b696ea4ad43db8ada1eef0c34de74b40437287270d
Python
3,499
78
#! /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_optimal_strips() suite.extend(suites.suite...
4f80116369d3294200570408a30b3611d37b165dee997b71d337d38875c28aae
Python
3,499
63
"""Golden regression: the 'are you a fly?' exchange must reproduce token for token. Reference token arrays are copied verbatim from publication/habr-fly-question/capture.json (captured on CUDA, RTX 3070 Ti, float16) into tests/fixtures/fly_question_golden.json. Verified on 2026-10-10: CUDA float16 and CPU float32 (AMD...
a33cf38ec625ae70a2466f4be5e5816e4d7862d467661e64407fb2787f600a99
Python
3,499
103
import click import numpy as np import pandas as pd import random import os #from set_seed import set_global_determinism SEED = 0 def set_seeds(seed=SEED): np.random.seed(seed) os.environ['PYTHONHASHSEED'] = str(seed) random.seed(seed) def set_global_determinism(seed=SEED): set_seeds(seed=seed) # op...
03c9daa2d604647b2805d839ba094fb0cac69d75a248db6ef75027cd7ab95444
Python
3,500
129
import operator as op import autograd.numpy as np import autograd.numpy.random as npr from autograd import dict as ag_dict from autograd import grad from autograd import isinstance as ag_isinstance from autograd.test_util import check_grads npr.seed(0) def test_getter(): def fun(input_dict): A = np.sum(...
256f6a6dcf3a97a480370ffc4b254c0a73758333b1559a640286d911946c4ca8
Python
3,503
88
from collections.abc import Sequence import torch from torch import nn from torchdrug import core, layers from torchdrug.core import Registry as R @R.register("models.GAT") class GraphAttentionNetwork(nn.Module, core.Configurable): """ Graph Attention Network proposed in `Graph Attention Networks`_. .....
6dda2856ddc0dcdd2c8f2352cdafd65250366ec3f463ad3a1d6d5c8b84f0aadf
Python
3,503
116
""" Given two x,y curves this gives intersection points. Based on: http://uk.mathworks.com/matlabcentral/fileexchange/11837-fast-and-robust-curve-intersections Source: https://github.com/sukhbinder/intersection Copyright 5 April 2017 Sukhbinder Permission is hereby granted, free of charge, to any person obtaining a...
786f6893873a61d42d197ad8759d4f252a473b32794ddd466cbe888631ac9ddc
Python
3,503
124
#!/usr/bin/env python """ Visualize Schaefer IS-RSA results on glass brains. This script reads the IS-RSA R output files and visualizes thresholded t-statistic maps for the Features_Post effect for each movie. """ import os import pandas as pd import matplotlib.pyplot as plt from nltools.data import Brain_Data from ...
132cb940e2cea63b2955c541a6a647b2dd3bba37b4acf51efca4c4207413039f
Python
3,504
94
#!/bin/usr/python3 # Use example 1: python preprocessing_test2.py /home/melanie/data_test data_test_information.csv /home/melanie/data_test/transforms # Use example 2: python preprocessing_test2.py data/train4/BIDS_data_brain Test2_algo_train1.csv test2_algo_train1_preprocessed ## Import libraries import os import s...
23297ff62f162b28496e2b6172ace1e85579caca60311221bb3215928a973a8e
Python
3,505
100
import pandas as pd import argparse import os def arg_parser(): parser = argparse.ArgumentParser(description="Refine cell counts") parser.add_argument("--csv", type=str, help="path to csv file") parser.add_argument("--out", type=str, default="", help="output_dir") parser.add_argument("--level...
b8a74d02b24f3763cc4953c46a678bacfcca1dd1ae5a567b9574a464953ee9ff
Python
3,505
119
"""Phonon recipes for MLPs.""" from __future__ import annotations from importlib.util import find_spec from typing import TYPE_CHECKING from monty.dev import requires from quacc import flow from quacc.recipes.common.phonons import phonon_subflow from quacc.recipes.mlp.core import static_job from quacc.wflow_tools.c...
2095b97690b72c2bfafe7e0820089f4fa219fa34f120f865e9193b6bf8e3abb5
Python
3,506
92
import numpy as np import torch import torch.nn as nn class FocalLoss(nn.Module): """ copy from: https://github.com/Hsuxu/Loss_ToolBox-PyTorch/blob/master/FocalLoss/FocalLoss.py This is a implementation of Focal Loss with smooth label cross entropy supported which is proposed in 'Focal Loss for Dense ...
d1628e9614f736a86c21c6456de38f54a74be5cdbc8249b8f216f590ed3d56d0
Python
3,506
85
import os import argparse def generate_slurm_script(input_dir, output_dir, output_filename, read_group_prefix): # Ensure output directory exists os.makedirs(output_dir, exist_ok=True) # Find all .fq.gz files in the input directory fq_files = sorted([f for f in os.listdir(input_dir) if f.endswith('.fq....
aeffae0f4f760f8fb54145171b6100c4cd84e1816da0a93314f117ff6d8570b5
Python
3,507
127
"""Various general utilities for working with PDB files""" from Bio import PDB import logging import numpy as np from scipy.spatial import KDTree, distance_matrix import warnings logging.disable(logging.WARNING) warnings.filterwarnings("ignore", category=DeprecationWarning) def load_pdb_file(pdb_path: str) -> PDB.Mo...
cc856d07a725abaaf952b617f770d1392ac5a4b6169ba03a45932f53ceb81786
Python
3,507
108
# Node-group asset "Residue Mask" (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 ...
bf37282fd711914aeb22187ff9a9c5e45cf3560ee189a29d98a7abd1af5df3bb
Python
3,508
99
import importlib import os import sys from PyQt5 import QtWidgets import globals.global_style as gs FILE_PATH, FILE_FULL_NAME = os.path.split(os.path.realpath(__file__)) FILE_NAME, FILE_EXT = os.path.splitext(FILE_FULL_NAME) sys.path.append(FILE_PATH + r'\panels') class ProgPanel(QtWidgets.QWidget): ...
c2798eaae5a82891a5df6b154ba691a1cdbb8f61540cc33e94a43cdd2d1e7b6e
Python
3,510
85
import torch from torch.optim.optimizer import Optimizer, required import math class Adaptive_HB(Optimizer): def __init__(self, params, lr=required, betas=(0.9, 0.99), epsilon=1e-8, weight_decay=0.0, momentum_init=0.9): if lr is not required and lr < 0.0: raise ValueError(f"Invalid learning rat...
19baab28094f5e08f1d6b1cc99fe6260c59b35e10e0851e227d563d7ed4cdcea
Python
3,511
114
# Node-group asset "Separate First Point" (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_C...
20a1ea20f48e7b3325a27ed5ab733107ac4729177f6d52a2e542b0393edb1ad9
Python
3,512
95
import sys if sys.version_info.major > 2: import urllib.request as url_lib else: import urllib as url_lib sys.path.append('..') import tempfile import os import APT_interface as apt import ast import glob import re import numpy as np import PoseTools import apt_expts import os os.environ['CUDA_VISIBLE_DEVICES']...
d9598d66b4b6612e8b9f63adf75c96496d28473e76ea9be3c516f38629ef7480
Python
3,513
125
# 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...
fb364745d28baf3f7af673f7f9322bd41d7e44ed869f7a223291c353250a6d1f
Python
3,513
95
import torch import torch.nn as nn import pytorch_lightning as pl from torchmetrics import Accuracy class PilotCareTransNet(pl.LightningModule): def __init__(self, input_dim: int, num_labels: int, learning_rate: float = 1e-4): super(PilotCareTransNet, self).__init__() # Transformer mode...
c85d19ea9665d7bfc76c9f1d42d4e0ce05c71c133f2af598113b947dd9bd79ab
Python
3,514
71
from pddlstream.language.constants import get_prefix, get_args from pddlstream.language.exogenous import replace_literals from pddlstream.language.external import get_domain_predicates from pddlstream.language.stream import Stream from pddlstream.utils import find_unique, get_mapping def get_predicate_map(state_strea...
d23d08685e024c545b87686ca2e64091bad12bc1d25ea0dfdcb529d41cecdaa4
Python
3,514
92
from collections.abc import Callable from elasticai.creator.arithmetic import FxpConverter, FxpParams 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_...
141b24fa9984ea60aefb0f688847a75fbc3fe09415337a7db61289b8f0c156c2
Python
3,515
112
""" Optuna example that optimizes multi-layer perceptrons using skorch. In this example, we optimize the validation accuracy of hand-written digit recognition using skorch and MNIST. We optimize the neural network architecture. As it is too time consuming to use the whole MNIST dataset, we here use a small subset of i...
7a0072d7f23525df178d5411df4916862f22ad83544cb38b808205ab5474c0b6
Python
3,515
109
#!/usr/bin/env python3 """ pdbfixer_cleaning.py Given a PDB ID, this script will: 1. Create a folder ./<pdbid>/ 2. Download the PDB file into that folder. 3. Strip out all heterogens except water. 4. Build any missing residues/atoms. 5. Add all hydrogens at pH 7.0. 6. Write out <pdbid>_cleaned.pdb in that folder...
c5971beb4b7b629935178121c369b53c8b9a66c069b101db34d65b3ea2f6eb9e
Python
3,515
114
import numpy.matlib import numpy as np from scipy.sparse import * from sklearn.metrics.pairwise import rbf_kernel from numpy import linalg as LA def spec(X, **kwargs): """ This function implements the SPEC feature selection Input ----- X: {numpy array}, shape (n_samples, n_features) input...
4141e3df72ff00e7b173b3b9e4a2bc632a83b4d7f0bac5b4db00ecb7a64d1426
Python
3,516
89
# Librairies import os import sys code_path = os.path.split(os.path.split(os.getcwd())[0])[0] sys.path.append(code_path) import numpy as np import argparse from setting import * from loader import * from XAI_method import * from XAI_interpret import * from utils import * # Arguments argParser = argparse.ArgumentParse...
2f66e298bc1a8b274727b9bb8256aa4542bc41745c811d97023cd11565423376
Python
3,517
122
import matplotlib.pylab as plt import numpy as np import tensorflow as tf def lin_interpolate(input_matrix, baseline=False, steps=50): ''' input: numpy array of the sample to explain params: - baseline: reference to use for linear interpolation; zero by default - steps: number of steps to tak...
9f7a488f6ffe2836cb67c5dce288719986744d108286cbd5adee8a61d91635ca
Python
3,517
95
import sys import logging import os import copy import shutil import gzip import numpy as np import pandas as pd from typing import Optional, List, TypedDict, Any, NamedTuple from collections import defaultdict from tqdm import tqdm from glob import glob import torch def nio_patchpath_to_coord(patch_name: str): "...
7d695a7b0f951b5d59495bb2eb2986c212359007e3889894ae7f893513414079
Python
3,518
96
"""Example for loading the optimal HMM runs and calculating model inferences """ # Set up dependencies import os import pickle import numpy as np from sys import argv from osl_dynamics import data from osl_dynamics.inference import tf_ops from osl_dynamics.models.hmm import Model if __name__ == "__main__": # --...
4d6bd828fffec4ed9c8466bc00a758f57905458ef9fc61c0de6529529f1672cc
Python
3,519
115
# Node-group asset "Backbone Vector List" (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_C...
8f4a229f47e91911dc0850b111ca4f090a0512f03e0cc2d42ca7463fc36fefaa
Python
3,519
112
import logging from typing import List, Optional, Tuple from pip._internal.utils.misc import HiddenText, display_path from pip._internal.utils.subprocess import make_command from pip._internal.utils.urls import path_to_url from pip._internal.vcs.versioncontrol import ( AuthInfo, RemoteNotFoundError, RevOpt...
ec50579f6f7bd58dedf6f24ffd119bc88e7338fe04c2c458892e6f0305dde553
Python
3,519
98
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue May 9 16:28:29 2023 @author: Felipe """ import numpy as np import sys import os sys.path.append(os.path.abspath('../../')) import analysis.frequency as frequency import analysis.synchronization as synchronization import scipy.io as sio import scipy.si...
fedfe50b10d7fced48948ee9afc68d194fea81b52553063661fa75b4582a39ff
Python
3,519
77
import torch.nn as nn from ..utils import _triple_same class BaseConverter(object): """ base class for converters """ converter_attributes = [] target_conv = None def __init__(self, model): """ Convert the model to its corresponding counterparts and deal with original weights if necess...
050b093200bcda2bc3f170d9e8458f257f81ac13455a20d0a807fcdeddf737de
Python
3,520
96
import numpy as np from scipy.io import FortranFile from .utils import KGData, VKBGData, tqdm_mpi_tofile, one_by_one, set_range, is_master ''' This module contains functions for reading BerkeleyGW related files ''' class bgw_vsc: ''' VSC file: stores the FT of total effective local potential ''' def ...
21cbf937304a2396c2b6498b9e27d30ba76ff38618834ca34d386079f4fa45e3
Python
3,520
105
# 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...
5c79eab2d93de7bd7502b63d6ad249fa47f4be1f7e8d0618ea4ca7d31c538c58
Python
3,520
99
from dreamcoder.domains.arc.arcPrimitivesIC2 import * import dreamcoder.domains.arc.arcPrimitivesIC2 as p from dreamcoder.domains.arc.arcInput import load_task, num_to_id import arckit # def train_examples(task_dict): # # examples = [((Input(ex["input"], task_dict["train"]),), # # Grid(ex["output"])) for ...
b2ed2828427ff6506245c9b0039e84e35bc6df4c4a756980c88b73c5750a46eb
Python
3,521
124
import os import dash_bootstrap_components as dbc import flask from dash import Dash, html, page_registry, page_container, Output, Input, State os.environ['LOGURU_LEVEL'] = 'WARNING' BAR_STYLE = { "zIndex": "1", } def get_navbar(nav_links: list[dbc.NavLink], navbar_id="pvis_navbar"): bar = dbc.Row( ...
c1b483f6d7a1b45ffc4981cf4abf8e3eb54583b7e01fa3ddf34f58462390d604
Python
3,521
87
from typing import Tuple, Union import pathlib import torch import torchvision import yacs.config from torch.utils.data import Dataset from pytorch_image_classification import create_transform class SubsetDataset(Dataset): def __init__(self, subset_dataset, transform=None): self.subset_dataset = subse...
9136de9f15a91314db647b87d4feb84ca799640eb1c04d0b12ce296e3e09dc52
Python
3,522
92
#!/usr/bin/env python import boto3 import base64 from datetime import datetime def get_user_data(): # my bash code to execute user_data = """#!/bin/bash apt-get update #apt-get install -y nfs-common #mkfs -t ext4 /dev/xvdca #mount /dev/xvdca /tmp eval "$(aws ecr get-login --no-include-email)" nvidia-docker r...
4d8b8bdcb823bd455f9753a414c7c6a5fa12f4d970b0cf4f007d693564a506d0
Python
3,523
81
"""PyNEST Mesocircuit: Run Mesocircuit -------------------------------------- Main example script to run a simulation of the mesocircuit with NEST and subsequently analyze and plot the results. The simulation of the spiking neural network can be followed by an LFP simulation and the corresponding postprocessing and p...
8fa2b8021f0cc5980ccc3a4625a9ea43e444a105a4797c5f3cc5a94c97a6ad88
Python
3,523
86
import numpy as np from scipy import sparse import random import itertools import torch from torch.utils.data import DataLoader from cobolt.utils.data import MultiData class MultiomicDataset(torch.utils.data.Dataset): def __init__(self, dt: MultiData): self.dt = dt.get_data() self.omic = list(sel...
a3c462872f857ea27801b4f4700c46e577fea4996ca076581820ce75c01fbaa8
Python
3,523
106
""" Optuna example that optimizes convolutional neural network and data augmentation using fastai V2. In this example, we optimize the hyperparameters of a convolutional neural network and data augmentation for hand-written digit recognition in terms of validation accuracy. The network is implemented by fastai and eva...
ecd9b0009ac01a5aa4155b944b8d2c30c496aa0183e85d89791611151c3bed39
Python
3,523
113
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
17bf69febbe20c5a55a3b483b99a6f6f63e6c2a12942a98ed2fcd1cbd5f2b8fe
Python
3,525
110
# -*- coding: utf-8 -*- from __future__ import print_function import sys """ We document Fast Downward exit codes at http://www.fast-downward.org/ExitCodes. Please update this documentation when making changes below. """ SUCCESS = 0 SEARCH_PLAN_FOUND_AND_OUT_OF_MEMORY = 1 SEARCH_PLAN_FOUND_AND_OUT_OF_TIME = 2 SEARC...
4d828dc14a4b3d18220007b89e51f72e3b938a005d0d98cf9cf805d9aadec3c5
Python
3,525
114
# 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...
abd9a1ef907088a9241178a6ec5fea6a1c1045070c7b933671741adaec447d88
Python
3,525
89
from __future__ import annotations from ase.build import molecule from numpy.testing import assert_array_equal from quacc.recipes.gaussian.core import relax_job, static_job def test_static_job(tmp_path, monkeypatch): monkeypatch.chdir(tmp_path) atoms = molecule("H2") output = static_job(atoms, 0, 1) ...
baecd3846226f92e72de04daf17913484023e42fb8585580edac570db14ef63a
Python
3,526
115
# 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...
d98b632904e45a9b1fd658488d7c7d7d1f2555456f2534af1677db52fbebc292
Python
3,526
111
import torch import torch.nn as nn from torch import Generator from typing import Any from .coreblock import CoreBlock from .final_layers_block import FinalLayersBlock from .first_layers_block import FirstLayersBlock class PrixFixeNet(nn.Module): """ Main model Can contain up to three blocks: 1. Fir...
4d66f77eccd83eeb2fb654e2d4aaa61b421ce2709c525ab80dd8a08c0097a4af
Python
3,527
81
from argparse import ArgumentParser, Namespace, FileType from Bio.PDB import PDBParser,PDBIO import torch,os,copy import pandas as pd from utils.visualise import save_protein parser = ArgumentParser() parser.add_argument('--results_path', type=str, default='results/user_inference', help='Directory where the outputs wi...
ca4d1ebca4dbd9006365cd3c670cf87ef8c396094769b2c6061b603fee73b02d
Python
3,527
84
"""Write the per-run output artifacts for a geometry-registration result.""" from __future__ import annotations import json import os from typing import Optional import imageio.v2 as imageio import numpy as np from .types import RunResult def _overlay(registered: np.ndarray, edge_atlas: np.ndarray) ...
af3ced4526e5e181a03c76f465c8bc061244123aa5a3a69aa05a130f8cc52c45
Python
3,528
91
"""Edit-summary panel tests.""" import pytest @pytest.fixture def qapp(): from PySide6.QtWidgets import QApplication app = QApplication.instance() or QApplication([]) yield app def _two_region_volumes(tmp_path, shape=(3, 20, 30)): import nibabel as nib import numpy as np ...
b5477b5363f83b3bf06a7f23a0d871c8eecbca04ea1b0f8fe0432d5f64f524fe
Python
3,528
106
#!/usr/bin/env python # ---------------------------------------------------------------------- # Copyright (C) 2014-2015, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This program is free software: you ca...
cff4dbebc19932cffd6a8b1f9530f140e0a3c0eef5f6c4d473d3ccf61ee69750
Python
3,528
56
# 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...
d5c1f742e8ed2aaac5512b3669b20022ca6fb14c216b03a61a29d1d90ac064e6
Python
3,529
84
""" em_fetch.py — read 2-D cut-outs of the public FlyWire EM volume (gs://flywire_em/aligned/v1, 8x8x40 nm) without any account: neuroglancer 'uint64_sharded_v1' format read with HTTP range requests. Coordinates: FlyWire nm (the same space as the synister synapse positions). """ import gzip, json, urllib.request import...
169862ad569a76620eec7fbafef4f820a415712bd54761127f873b397dd67559
Python
3,530
106
# 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...
32f5e3487ba2d53c14a397b197fb07b33dd76016ab117971854094c2e5241e90
Python
3,530
95
from pathlib import Path from typing import cast import bpy from nodebpy.builder import TreeBuilder from ... import blender as bl from ... import material from ...nodes import geometry from ..utilities import create_object from .base import Ensemble, EntityType from .reader import CellPackReader class CellPack(Ensemb...
004a845a9e01c60af746c04f060acb6f72dd2c7a9f1b3af0e6d82543b5af94c1
Python
3,531
124
from collections.abc import Sequence from elasticai.creator.vhdl.design.signal import Signal def _sorted_dict(items: dict[str, str]) -> dict[str, str]: return dict((key, items[key]) for key in sorted(items)) def create_instance( *, name: str, entity: str, signal_mapping: dict[str, str], lib...