sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
2625da041885e2bf38951a564569bc5b7366e4c5a697232f1762a245bfe70271
Python
4,485
121
# 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...
ab66498e7b176d67e7e57e5280e323cd21de43bc1e60866e817243ab86f184cb
Python
4,485
143
# 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...
5b1ec6abf1cdffb51a1a4fd3dcf6556d22ac46d44bafa896635c6dadf6fd951e
Python
4,486
71
import argparse import scripts.train.few_shot from scripts.train.few_shot.train import main parser = argparse.ArgumentParser(description='Train prototypical networks') # data args default_dataset = 'geometry' default_split = 'sable-meyer' parser.add_argument('--data.dataset', type=str, default=default_dataset, metav...
11f600e1cd2103c5fed1676949f1bf68c41244e37d356a0cde559707ab5619a5
Python
4,487
141
import rdkit import rdkit.Chem as Chem import copy from .chemutils import get_clique_mol, tree_decomp, get_mol, get_smiles, set_atommap, enum_assemble, decode_stereo def get_slots(smiles): mol = Chem.MolFromSmiles(smiles) return [(atom.GetSymbol(), atom.GetFormalCharge(), atom.GetTotalNumHs()) for atom in mol....
a44f078c505efff6e47fcdc814f8fe0854c355893847c8b11561f4a4493d530b
Python
4,487
104
# # #from poseConfig import aliceConfig as conf # #import PoseUNet #import os #os.environ['CUDA_VISIBLE_DEVICES'] = '0' #conf.batch_size = 16 #name = 'pose_unet_increasing_filter_32_bsize16' ## self = PoseUNet.PoseUNet(conf,name=name,for_training=False) ## val_dist, val_ims, val_preds, val_predlocs, val_locs, val_info...
eb03983ee15e821888ad4c8f321ffaba8b9346f3d09f6624ab4597d200dcc9ce
Python
4,487
135
#!/usr/bin/python2 # MIT License. # Copyright (c) 2016 William Skellenger # # 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...
1a8d21a54addf9e9f260a12a87ab5c284273ecf01d86e41457bf3923c99bbd1b
Python
4,488
100
import torch from torch.optim.optimizer import Optimizer, required class PIDOptimizer(Optimizer): r"""Implements stochastic gradient descent (optionally with momentum). Nesterov momentum is based on the formula from `On the importance of initialization and momentum in deep learning`__. Args: p...
27ae68c9b86843fb189e11c2f987f62f7885dc24304f1b888da46fd8cb166f27
Python
4,488
99
from typing import Optional, Union from segmentation_models_pytorch.encoders import get_encoder from segmentation_models_pytorch.base import ( SegmentationModel, SegmentationHead, ClassificationHead, ) from .decoder import PSPDecoder class PSPNet(SegmentationModel): """PSPNet_ is a fully convolution ...
5bb9a00386a5545e7c03e417bf0063c6c6831d932e17ecc9df21905c43364881
Python
4,488
95
# Collect predictions from glob import glob from pathlib import Path import sys from unittest import skip import pandas as pd import numpy as np # sample used pipe = sys.argv[1] #opts = '_averaged-source_Schaefer400x17_WM+CSF+GS_hcpaging_695_zscored-beh_' opts = '_averaged-source_Schaefer400x17_WM+CSF+GS_hcpya_771_...
e51628601b72f26e60b613cd28759a645b5f2b71660095aadaa823145b0c48ee
Python
4,488
159
# Node-group asset "Color OKLab Offset" (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. import math from typing imp...
d91f5d55db9b9cc222da231ecf8c234060ae9aab6411b47f0c5465472fd2b382
Python
4,489
124
"""Community detection algorithms. Supported models: - "infomap": Infomap - "flatsbm": Degree-corrected SBM - "bp": Belief propagation """ import sys import numpy as np import pandas as pd from scipy import sparse from scipy.sparse.csgraph import connected_components # ===============================================...
3c9a16429d4101b84cc54f12513b4a36a590dda7e6031fde77ba8b45f65f6acf
Python
4,490
147
""" The layer thickness click command """ from collections import defaultdict import configparser import glob import pathlib import os import click import numpy as np import pandas as pd from layer_recognition.utilities import get_s1hl_corners from layer_recognition.utilities import ( get_animal_by_image_id, ...
a4700021893acf453ec85595043364ea2639ff3eced2364f5220590e9159556c
Python
4,490
122
""" Generates plot with custom accuracy metric. The custom accuracy is plotted for each machine learning model trained: 'spikes30', 'signal30', and 'signal100', as a function of training epoch. For more than one training instance for each model, the average custom accuracy is plotted as a solid line, accompanied by a ...
4c6a72dcecf6f7002336e71b1c0c2eb4a05d2029100b273dcc2f3fcd4dec479d
Python
4,491
132
# https://github.com/AdeelH/pytorch-multi-class-focal-loss/blob/master/focal_loss.py from typing import Optional, Sequence import torch from torch import Tensor from torch import nn from torch.nn import functional as F class FocalLoss(nn.Module): """ Focal Loss, as described in https://arxiv.org/abs/1708.02002....
be85649c4d35402fe4a1aa8593011a3c0baf6a1f4b68e1b020e1e933473d852d
Python
4,491
109
"""Verify graph registration against bundled real data, not generated layouts.""" import csv import gzip import json import re import shutil import struct from pathlib import Path import numpy as np import pytest from liquidaion_fly.anatomy import Anatomy, decode_skeleton, ensure_anatomy ROOT = Path(__file__).resolv...
4e5ad6c4bce02a3518e11b5f71b135f7cecec314b2a2332652f546bab079a711
Python
4,492
158
#!/usr/bin/env python import time import boto3 from lambda_function import get_user_data client = boto3.client('autoscaling') response = client.delete_auto_scaling_group( AutoScalingGroupName='chunkflow-inference', ForceDelete=True ) print('response of deleting auto scaling group: %s' % response) time.sleep(...
ee4703d13da7de0daf2ae08dea8c4dddb4755a317ea7ce54f656a7466bda78f1
Python
4,492
127
# 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...
01cdc32d24c3455c9a10cb07a634cae0429e67a9004f52e32b904701e6a505fb
Python
4,493
100
from __future__ import annotations from typing import TYPE_CHECKING import numpy as np import pandas as pd from anndata import AnnData from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split from pertpy._types import _sklearn_random_state, cast_frame, cast_matrix from...
191c28bde483384b3f64281817f9e65b6445bafd8ee38a5dc70e00c088b3f612
Python
4,496
145
# 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...
4f041d9d8f6d7150d5024302f307ae05d0e3235f68be958bcc0873c9625c43cd
Python
4,496
193
import random import pandas as pd import numpy as np import torch import dgl from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem import DataStructs from tdc.single_pred import ADME from tdc.single_pred import HTS from tdc.single_pred import Tox ATOM_VOCAB = [ 'C', 'N', 'O', 'S', 'F', 'H', 'Si',...
005d8cdc42fe8754e2986db24aed921d50e5a77f1c0352e51ffd63f9fe6788ca
Python
4,497
163
# This code calculates the particle level gr for a 3d system, next the particle level caging potential and coarse-grains it over up-to the 2nd nearest neighbours. # Inputs : linked trajectories of the particles # Outputs: local gr, Caging potential of each particle at different time frame, Coarse-grained caging pote...
664f2388917da56820832e930a94e725065f98cd042757eedbee769ed8f76545
Python
4,497
121
from copy import deepcopy import numpy import numpy as np import pandas as pd import matplotlib.pyplot as plt from albumentations import HorizontalFlip, VerticalFlip, Rotate, Compose, ShiftScaleRotate, HueSaturationValue, \ RandomBrightnessContrast, ImageCompression, GaussianBlur class AugmentedEncoding(object):...
7b4baed28e6bc2ee5988136bae3420785ff4e63062a60b790edd7043b44350fc
Python
4,498
112
"""Test Robust Reference.""" # Authors: The PyPREP developers # SPDX-License-Identifier: MITs from unittest import mock import mne import numpy as np import pytest from pyprep.reference import Reference @pytest.mark.usefixtures("raw", "montage") def test_basic_input(raw, montage): """Test Reference output dat...
4dbac0fa58d9f941a886077584402ed4637788615302f21fa3216d1b52361702
Python
4,499
148
""" Based on previously selected data, containing the location of a 5 seconds signal window, and the optimal max interval parameters, generates a trainset.h5 file with only the 5 seconds slice of the signal (as a float array), and corresponding spikes and bursts (binary array) Input ---------- - "data/trainset...
e442bf69b3d9ae2f5e2280ff3721fbaf7c77231169ea2417b5501768845a41f4
Python
4,500
143
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Atchuth Naveen Code developed at UC Irvine. command line executable to convert a directory of tif images to zarr format that can be visualized on neuroglancer call as: python tif_to_ome.py img_dir {--out_dir} {--channel channel} (append optional arguments to...
f645caf5b28be67430364b0ab060b5434c618c2ebfbfd804da41a3b69d642d8a
Python
4,500
106
from os import SEEK_END from neuron import h as nrn, vec2numpy from neuron import gui from matplotlib import pyplot as plt import numpy # Neuron units ----------------------------------------------------------- # Category Variable Units # Time t [ms] # Voltage ...
149183f32e0aba5f1b7297ef5c31070ecb1e75a50f5e4f719333aa5e3e2b6e5f
Python
4,501
120
"""Inference: an LFA strip image -> positive / negative. image --[segmentation: unet | MnUV3 @ 256x256]--> band mask mask --[classifier @ 256x256]-------------------> P(positive) python -m src.predict --image strip.jpg \ --seg-weights weights/mnuv3_seg_train_no_test_no.pth \ --cls-weights...
809a44af06ec66b47fe8dd038cfb22c95f7d3baf495a1318f5bf0589a52de555
Python
4,502
136
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np import torch def set_requires_grad(nets, requires_grad=False): """Set requires_grad for all the networks. Args: nets (nn.Module | list[nn.Module]): A list of networks or a single network. requires_grad (bool): Whet...
beea3a68f00cafa79ad7b3212b9cc98fd3d98a36c55178d5eae427ea978ea691
Python
4,503
179
import numpy as np from moabb.datasets import ( Zhou2016, BNCI2014004, BNCI2014001, MunichMI, Weibo2014, Cho2017, ) from burst_space import BurstSpace from burst_features import TfFeatures from preprocess import ( load_sub, apply_preprocessing, Dreyer2023, ) from help_funcs import ...
93432f58daef0e18d947ee85402a6b0f438e09735d9f162e775b9d008236e17f
Python
4,504
107
#!/usr/bin/env python from scipy.sparse import csr_matrix import time from multiprocessing import Pool import itertools from itertools import chain import scipy.sparse from SCanSNP.classifyUtils import * from SCanSNP.VCFUtils import * from SCanSNP.DBLsutils import * from SCanSNP.ComputeLLK import * from SCanSNP.GenUt...
a39d6d3f686956da213f7de0498c809063692df60306ac7162c69dca24598b51
Python
4,504
170
from contextlib import suppress from io import TextIOWrapper from . import abc class SpecLoaderAdapter: """ Adapt a package spec to adapt the underlying loader. """ def __init__(self, spec, adapter=lambda spec: spec.loader): self.spec = spec self.loader = adapter(spec) def __get...
fe6461a70e766b81efcafa7d706c9c2550f43aba42006109f054e460f11f0ce2
Python
4,504
137
# Node-group asset "Sample Mix Float" (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_CHECK...
93aa2b87d2067355b184feb309a6931c0275d3b9bdebac1eabc95df3cfebb83f
Python
4,506
120
############################################################################### # This code generates the Supplementary Figure 6 of the paper "Longitudinal # # single-subject neuroimaging study reveals effects of daily environmental, # # physiological and lifestyle factors on functional brain connectivity" # ...
b3d01146c21c8747deaace860b38780cac5798780583e009d1a69e05e1ce8900
Python
4,506
129
# 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...
1dcdd9ac20d27105843928267c8d2867ffae15bcab6ca05439e151693f983892
Python
4,509
103
############################################################################################## # Testing if the evoked response across subjects is significant ############################################################################################## import matplotlib.pyplot as plt import mne import numpy as np imp...
eb6ef3b49b3dcce2fedfc1c9ee45c17ab47e813f0a05f602f14cc4c0c243618a
Python
4,509
154
import re from functools import lru_cache from typing import Callable, List from ._cell_widths import CELL_WIDTHS # Regex to match sequence of the most common character ranges _is_single_cell_widths = re.compile("^[\u0020-\u006f\u00a0\u02ff\u0370-\u0482]*$").match @lru_cache(4096) def cached_cell_len(text: str) -> ...
9519865a202a40c33d45a10c41c4cf0313e62b7d533d8c4a75b2ad54ba08c194
Python
4,510
121
# Copyright (c) 2022, 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...
afe500163a72e0be179c42407d82a1ee543b9b075ac6bb1effc1c2cb44b68a96
Python
4,511
150
import numpy as np from pyspi.data import Data import warnings, copy """ Some parsing functions for decorating so that we can either input the time series directly or use the data structure """ def parse_univariate(function): def parsed_function(self,data,i=None,inplace=True): if not isinstance(data,Data):...
efa84c120bb6906cc61ddb7c97a6ef0c99742dfc37e5602e935713f5d666a57e
Python
4,511
140
#!/usr/bin/env python from __future__ import print_function import colorsys import glob import os import pybullet as p import random import sys import numpy as np from lxml import etree from pybullet_tools.pr2_utils import DRAKE_PR2_URDF, set_group_conf from pybullet_tools.utils import STATIC_MASS, CLIENT, connect,...
35e198cbe6ee9104fef149dc4f0065e4ef135095e9cf2ae225d4bfa619dae6c1
Python
4,512
117
""" RELEASE_ID_SPACE_CHECK.py - written 2026-09-17. WHY THIS FILE EXISTS. The published record (Zenodo 10.5281/zenodo.22795740, v1.0) ships one table whose first column is documented as: "root_id | int64 | FlyWire segment identifier, materialisation 783. Use this as the join key." and the README's wo...
a89f5d8230da18dcd5e468ab922bc3c8deeb0ad9c12e41a5d4436d7b7a86c68f
Python
4,512
114
import torch from denoising_diffusion_pytorch import Unet, GaussianDiffusion from torch import nn from einops import rearrange, reduce, repeat import torch.nn.functional as F from collections import namedtuple ModelPrediction = namedtuple('ModelPrediction', ['pred_noise', 'pred_x_start']) def exists(x): return x ...
72354e1fa3f21d1d139a5881595b3989c34e95cf20049d409e15c898fb70afdb
Python
4,513
148
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Feb 13 13:23:17 2024 @author: Dustin Garner """ import datetime import numpy as np import pandas as pd from fafbseg import flywire import flycode.utils as utils import flycode.reduction as reduction import flycode.readfiles as readfiles client = fly...
837c1c845cea109cfd28e2b35281f1c4298d5bc6fa9b2ab9d7ed0142213fd78d
Python
4,513
116
"""Multi-monitor compare-window tests for the CCF Boundary Editor.""" import numpy as np 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=(20, 20, 30)):...
b79081fb03f3ff57f8b988f06ce703d5ef1d456b77fac994ab08fffd225e5b4d
Python
4,513
139
"""Round-trip tests for the --reg_effort + advanced ANTs override CLI flags. Headless: only argparse + the _build_ants_overrides helper are exercised. No registration runs. """ import pytest from regtools.registration.cli import ( build_parser, _build_ants_overrides, _resolve_annotation_overri...
c66892822acf41d8218270c04eb6aad967173d297943192314a77792f5b0c636
Python
4,513
99
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.input import prepare_inputs class TestPrepareInputs(unittest.TestCase): def setUp(self): self.path = '.data_test' # Create temporary ...
ff6ccf28940fa644fd8fe6b1386de5095be2f346d3e040942c2286b3f8f74b34
Python
4,516
155
# 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 -------------------------------------------------------------- import ...
118be5723a1e9b51d8a1d0064dce2a9e06b92bcc8710d3487b524c6a540da0f1
Python
4,518
118
# # 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,...
4223c6f3f4f181e17fdc5bb5ba73dc413b55b02f37b5c568066b12a335c92fb2
Python
4,518
142
"""Tests for the Transform + Metric dropdown split in the registration GUI.""" import os import sys PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) if PROJECT_ROOT not in sys.path: sys.path.insert(0, PROJECT_ROOT) os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") impor...
f54e7d588ee2a5d090d78a0bdb8e74e725ef40e30682c8d5022a8cabc1d672c7
Python
4,518
140
"""Perform and save time frequency analysis of given files.""" from __future__ import annotations from pathlib import Path from typing import Literal import pandas as pd import pte_decode from matplotlib import pyplot as plt from numpy import True_ import motor_intention.plotting_settings import motor_intention.proj...
2b7fb4c9519f34b2455aa0c47c45e998adc5565cba9010236d5472febecac1da
Python
4,519
143
"""Utility functions for molecular dynamics.""" from __future__ import annotations from typing import TYPE_CHECKING, Literal from ase.md.andersen import Andersen from ase.md.bussi import Bussi from ase.md.langevin import Langevin from ase.md.nose_hoover_chain import MTKNPT, IsotropicMTKNPT, NoseHooverChainNVT from a...
7175c999ffa601eaddcae5f473c80858b3d8c8a8a9f94b7691657c547f17d264
Python
4,520
99
''' This file generates the first-level GLM analysis for the supplementary analysis for nback tasks regressing the threshold values''' import os, sys import numpy as np import pandas as pd from glob import glob import nibabel as nib from nilearn.glm.first_level.design_matrix import make_first_level_design_matrix...
b8fa7b4e65b9325bda578103d2c77fd7cd5320b2d5c141938b514c0e03ae7fb9
Python
4,520
84
import numpy as np import matplotlib.pyplot as plt; import matplotlib.patches as patches; import matplotlib.colors as colors import seaborn as sns def addNetColors(fcMatrix): """ A function to generate a heatmap figure with CAB-NP colors added along axes of FC matrix; python 3 INPUT fcMatrix...
27047b3efd43053b1739e925c0939e58b23a2cc81bf07c68b0d3eb1c1a6a964d
Python
4,521
154
from __future__ import absolute_import from __future__ import division from __future__ import print_function import math import matplotlib.pyplot as plt import seaborn as sns from matplotlib import font_manager import numpy as np from sklearn.preprocessing import MinMaxScaler, StandardScaler CB91_Blue = '#1C2385' CB9...
f442a7a8f4fb8da2474d8ed524062d557b7f059b505ddfbe3ef36a667cd20ccd
Python
4,521
124
import os import sys sys.path.append(os.path.abspath(os.path.dirname(__file__))) import torch import argparse torch.serialization.add_safe_globals([argparse.Namespace]) from pytorch_lightning import Trainer, seed_everything from pytorch_lightning.callbacks import ModelCheckpoint, ModelSummary, RichProgressBar from pyto...
fcfaef4908b65c23909f80ce12421fc0e158654c0fd6f41ba2f084d5e4474ca6
Python
4,521
101
import numpy as np from skimage.filters import threshold_otsu def ispadding(x): # identify the padding in array return np.abs(x - 15213) < 1e-6 def get_otsu_regions(out, labels, args_params = None): """ Identify DeepSIF source region using otsu_threshould, run on CPU :param out: np.arrry; the output...
3f08ca5d8b0fa1276fcaa7febb8af2be180c67918a15f65ed1a475613ebe8bc0
Python
4,522
109
# 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...
f1cc320cfd8fbec25ccadbacc072b707cf0140de85678e81492b487a0617f4fb
Python
4,522
142
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ create remove motion-corrupted files from concatenated echo files python remove_corrupted_dynamics.py [file location] [sequence num] [number of echos] [dyn to exclude] output: concat files e1, e2, e3 in folder 'files for recon' with the corrupted motion dynamics rem...
76aad742a5e0706d130b2a535ee680a6aaa9baade6d91b9d9221019e18b6f848
Python
4,523
122
# 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...
e24fdc1acc0c3fdbdd5eb766f690c261cfa4cdc796113ef8c525765a598bd5ef
Python
4,523
141
# Node-group asset "Atoms to Curves" (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_CHECKI...
eb38566497c752ee4d23e4a94f7d022f235635b05dff642f145251e194bdc1fd
Python
4,523
146
"""Plot UPDRS Med. OFF vs ON""" from __future__ import annotations import csv from enum import Enum from pathlib import Path from typing import Annotated import numpy as np import pandas as pd import pte_decode import scipy.stats from pytask import Product import motor_intention.plotting_settings import motor_intent...
0a3c10eebd5e0b4718e3d18b1f93b5a8a9b715ca45128b06724785ac76b93ead
Python
4,526
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...
16203b57c81483d8bdf8b5391e4a7f0da86c97dc5760b83ad1ea9e8fef9922b9
Python
4,526
132
import numpy as np from scipy.stats import ttest_ind try: from numba import njit use_numba = True except ImportError: use_numba = False def _binarize(W): """ Binarizes a matrix Parameters ---------- W : (N, N) array_like Matrix to be binarized Returns ------- binari...
e66fa3f683f3e74018bec14f700c6381fdf8ca968057681dd21e359561c2805d
Python
4,526
107
from math import pi as PI from control_tools.ik.pr2_ik import arm_difference_fn import numpy as np # NOTE(caelan): these are LTAMP-specific utility functions (separate from utils.py) BASE_FRAME = 'base_link' PR2_JOINT_SAFETY_LIMITS = { # Taken from /ltamp-pr2/models/pr2_description/pr2.urdf # safety_contro...
a5a5ed9e39e105894b1baa6797d0f76fe1d149bf19dedb7a75ab9f496db37557
Python
4,527
112
# 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 random from sklearn.metrics import balanced_accuracy_score, accuracy_score from joblib import dump import time import argparse from setting import * from utils import * from...
c6d47fb5427aa49c7f6eb808e7f110b704a1b56b017eafb5e7475d6ccd8cfad0
Python
4,527
130
from itertools import chain from unittest import TestCase from elasticai.creator_plugins.grouped_filter.src.index_generators import ( generate_deinterleaved_indices, sliding_window, ) class InterleaveChannelsAfterGroupwiseOrdering(TestCase): def select(self, filtered, indices): filtered = tuple(f...
90d85f511b86339332e954ad4a0e3bdef404cf30d8d5a4302123be9880b3a52e
Python
4,528
136
"""Tests for E3FP fingerprints. Author: Seth Axen E-mail: seth.axen@gmail.com """ import pytest class TestFingerprintIO: def test_fprint_from_indices(self): from e3fp.fingerprint.fprint import ( Fingerprint, CountFingerprint, FloatFingerprint, ) for fp_...
a57b9a0aad57b4c268fab501cd19b11efcbe2d7baf995c96c601631d85c9a945
Python
4,528
145
# %% import os os.environ['CUDA_VISIBLE_DEVICES'] = "0" import math import torch.optim as optim import torch import torch.nn as nn from torch_geometric.data import DataLoader import argparse from metrics import get_cindex from dataset import * from model import MGraphDTA from utils import * from log.train_logger impor...
ae530a5cb378e50d5d5d185d363e90ad745586cfebde1d310f6c51b8d7ed181c
Python
4,528
141
import torch from torch import nn from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule from elasticai.creator.nn.integer.MPQ.ffn.design import FFN as FFNDesign from elasticai.creator.nn.integer.MPQ.linear import Linear from elasticai.creator.nn.integer.MPQ.relu import ReLU from elasticai....
b3a094bd1eb6ef9cd58704c5eb973b368b3083158f63359e0a843e4a5b2837ee
Python
4,529
133
import sys import argparse from pathlib import Path import dolfin as d import numpy as np from smart import mesh_tools from mech_parser_args import ( add_preprocess_mech_mesh_arguments, Shape, shape2symfraction, ) # Define expressions to be used for geometry definitions. outerExpr15 = "(1 - z**4/(1000+...
db36d06207bd6cfbaa8dcb38d517a8158ba7946b26c42ec827de169b17d7cc8e
Python
4,529
99
# C. Cocuzza, 2021 # A function to take a vector of 360 (Glasser et al, 2016; MMP Atlas) node's data (e.g., activation estimates) # that have been sorted/ordered into CAB-NP assignments (Ji et al., 2019; https://github.com/ColeLab/ColeAnticevicNetPartition) and # un-order back into original MMP ordering # Main use:...
18a2dbc20bf08d5faa663a597cf7e937aea3faa8fdfcaef6fe1c2e32844e9f6c
Python
4,530
134
"""Test the configuration of pyprep's logger.""" # Authors: The PyPREP developers # SPDX-License-Identifier: MIT import io import logging import subprocess import sys import pytest import pyprep from pyprep._logging import LOGGER_NAME, _StreamHandler @pytest.fixture def logger(): """Hand out the package logge...
b52bdf53e17797502f66d20fc8aa746510266f2c0fc705743a20538de7d4c646
Python
4,530
104
from ..main_analysis import * def get_model_metadata(model_string, sample_image_paths, convert_to_dataframe=True): model_option = get_model_options()[model_string] model_option['model_string'] = model_string model = eval(model_option['call']) model = model.eval() if torch.cuda.is_available(): ...
bcfca962b720d0685fb67e330c31f0c26eb1c7d887a13ebe6dd79774f6c37b77
Python
4,530
123
""" This file can be used to configure the project. The different attributes of the "Settings" class can be accessed as follows: from fidnet import config. A typical use case for this file is to keep track of paths to different files in the project. This is using pydantic-settings. In order to read more about how to...
e7c3ddcede6d88a8dcdff02b40fecf3fc01c4e409c8bb99db83f1bc6d5efdc47
Python
4,532
101
# Script for additionally preprocess for DeepH-hybrid # Coded by ZC Tang @ Tsinghua Univ for DeepH-hybrid support. e-mail: az_txycha@126.com # Please follow the instructions in "README" to use this script import numpy as np import h5py import json import argparse import os Bohr2Ang = 0.52918 def modify_h5(h5_in, h5...
518fc505d96cf1422bc25612fb25d800c15f08b9e4e1b83a4bd05f39eb3328b9
Python
4,533
101
import os import pandas as pd import pytorch_lightning as pl from statistics import mean from typing import Any, Callable, List import torch from torchmetrics import Accuracy # local imports from shapelearningtheory.networks import make_resnet50, make_vit_b_16, \ make_vgg_19, \ make_mlp_small, make_convnet_smal...
640d9b7fa8948773dc8cc9ede5b189cb2beb526008b9c0cb8a6edcd0a8d9d39e
Python
4,535
148
import os import argparse import glob from typing import Generator import pandas as pd from language import load_input_language, Language from learning_experiment import LearningExp import openai openai.organization = "org-MHqlKDvTANBEASvMZSUJGnvZ" openai.api_key = os.getenv("OPENAI_API_KEY") # Globals PARTICIPA...
2db07051dcd1bd8736db1f0bfe5ea434851fe93613d186ad1f2c370faa117656
Python
4,536
141
''' Script to apply Maxwell filtering to Eleka Neuromag data ''' from os.path import join, basename from stormdb.access import Query from stormdb.process import Maxfilter from mne.io import Raw from mne.bem import fit_sphere_to_headshape import warnings import os import re import numpy as np from sys import argv from...
c2f40b90f57e36353a3434847d85fe7a5b0e88bf68b19df5293d0a4c51c33eda
Python
4,536
94
""" Train a DGCNN Model on the AMIGOS Dataset ========================================= In this tutorial, we'll walk through how to leverage TorchEEG for training a Dynamical Graph Convolutional Neural Network (DGCNN) to classify emotions using the AMIGOS dataset. Let's walk through the essential steps—from dataset pr...
2e6cca56be662b321483da822176412d90186cae637762395fba9f92f6ccaa60
Python
4,537
79
"""REAL_PN_DEP.py 2026-09-29. Pre-registration: 04-NOTES/PREREG-2026-09-29e-REAL-PN-DEPRESSION.md Seki et al. 2017 real receptor input -> AL cut-out with fly-like ORN->all depression (f 0.72, tau 2.4 s, x0 = 1) -> real PNs. usage: python REAL_PN_DEP.py [run|analyse] (workers: RD_WORKERS, default 4)""" import sys, os,...
334f0f95c591329ca15819ee5775e8133ca024de5fb28bf5c2010fba3c6345b4
Python
4,537
109
# -*- coding: utf-8 -*- import numpy as np import tensorflow as tf from yolo_v4 import _conv2d_fixed_padding, _fixed_padding, _get_size, \ _detection_layer, _upsample slim = tf.contrib.slim _BATCH_NORM_DECAY = 0.9 _BATCH_NORM_EPSILON = 1e-05 _LEAKY_RELU = 0.1 _ANCHORS = [(10, 14), (23, 27), (37, 58), ...
01c086cff04211a744086b45f4504f1f6567b77a8201332bd26ec924dd861beb
Python
4,538
106
"""A single definition.""" import copy from typing import Union from hed.models.hed_group import HedGroup class DefinitionEntry: """Stores the resolved contents of a single HED Definition. A ``DefinitionEntry`` is created when a ``Definition/`` tag group is parsed and stored in a :class:`~hed.models.De...
316c0afeeedbac36886b9607d7c6bb39040e80891e2d9ee6aae7255311cd8aa2
Python
4,538
143
""" Optuna example that demonstrates a pruner for Tensorflow (Estimator API). In this example, we optimize the hyperparameters of a neural network for hand-written digit recognition in terms of validation accuracy. The network is implemented by Tensorflow and evaluated by MNIST dataset. Throughout the training of neur...
5c1c240076c3224781351e1676ddece447f0c6ee125de72b4619970e2527f916
Python
4,538
111
# !/usr/bin/env python # Copyright (c) 2020 Intel Corporation. # authors: German Ros (german.ros@intel.com) # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ Create a human readable version of the scores provided by the leaderboard. """ from __f...
868680d4dd3d95686992ad4cbc2e25088f803d064873617978e1101c19c354ce
Python
4,538
112
import argparse from loader import MoleculeDataset from dataloader import DataLoaderAE from util import NegativeEdge import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from tqdm import tqdm import numpy as np from model import GNN, GNN_graphpred from sklearn.metrics impor...
fe97ad59d9e425e19387f4c5e4b024d03aca9d22f8a1c42449d60f38c7548769
Python
4,538
120
""" This script runs the model-estimation pipeline 1. Load data 2. Prepare analysis 3. Estimate model for enrichment experiment 4. Estimate model for Rac1-experiment """ if __name__ == '__main__': import numpy as np from scipy.stats import beta import matplotlib import matplotlib.pyp...
7b7c18bea9aff540f6bc9cfafc1f6eac2d20d07bfe91f913da45bf695a52caca
Python
4,539
91
""" Main run function for getting synapse nearest neighbour distances authors: Michael Reimann, András Ecker; last modified: 01.2023 """ import os import logging from tqdm import tqdm import numpy as np import pandas as pd from morphio import Morphology from conntility.subcellular import MorphologyPathDistanceCalculat...
0ab7c71e9abb8f67b625ca8234e75b7ae51a1d22b9fa4962b98bd86bd52bc7d3
Python
4,540
97
import torch from torch.optim.optimizer import Optimizer, required class PIDAccOptimizer_Sym_Tz(Optimizer): r"""Implements stochastic gradient descent (optionally with momentum). Nesterov momentum is based on the formula from `On the importance of initialization and momentum in deep learning`__. ...
5d1d9ac70211055241c8692019e74868478a18ba27dcbfc570f66f88d2e77b86
Python
4,541
120
from classification_models_3D import get_submodules_from_kwargs from keras.src.legacy.backend import int_shape def slice_tensor(x, start, stop, axis): if axis == 4: return x[:, :, :, :, start:stop] elif axis == 1: return x[:, start:stop, :, :, :] else: raise ValueError("Slice axis ...
8f8f7dd8941b552a8907a0b5a162fe5d50bee6e31dafc95f4736ed5d43dcf011
Python
4,542
134
import random import unittest import torch import torch.nn as nn from torch.utils.data import Dataset from torch.utils.data.dataloader import DataLoader from torcheeg.models import BCUNet, BUNet from torcheeg.trainers import CDDPMTrainer, DDPMTrainer class DummyDataset(Dataset): def __init__(self, length: int ...
283567017e4b8affd637c48aea7f9e2cae73bc2c2b7e627057014d9d4ac0c5af
Python
4,543
115
"""AST + color helpers for theme-consistency guard tests. Pure-stdlib (ast, re) so it imports without Qt. Used by test_theme_consistency.py to prove no GUI module bypasses the theme engine. """ from __future__ import annotations import ast import re # Module-level style constants that are rendered from L...
7954a9e93510320690dcc7a0ce335c135d766271a02c5bae26984fe5b9db27c7
Python
4,544
148
"""Plot UPDRS Med. OFF vs ON""" from __future__ import annotations import csv from enum import Enum from pathlib import Path from typing import Annotated import numpy as np import pandas as pd import pte_decode import scipy.stats from pytask import Product import motor_intention.plotting_settings import motor_intent...
7ad8085a819629729a595f2f9ba098b95f825bba551032f4a16b43ad218efd1c
Python
4,544
120
"""Optimizes hyperparameters using Bayesian optimization.""" from copy import deepcopy import json from typing import Dict, Union import os from hyperopt import fmin, hp, tpe import numpy as np from chemprop.args import HyperoptArgs from chemprop.constants import HYPEROPT_LOGGER_NAME from chemprop.models import Mole...
bea60683d1883740bd29a472b0e1965ac0b293f008057047c2eed676ed248556
Python
4,544
138
## # \file template_stack_estimator.py # \brief Class to estimate template stack automatically # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date January 2018 # import os import re import json import numpy as np import skimage.measure import SimpleITK as sitk import pysitk.simple_itk_helpe...
25870aeacb4e5d80ed5825e80ddcca7b32e92ba7c7fbc2d16eefe19570524d12
Python
4,545
131
from typing import Any, Dict, Optional, Tuple import torch from pytorch_lightning import LightningDataModule from torch.utils.data import ConcatDataset, DataLoader, Dataset, random_split from torchvision.datasets import MNIST from torchvision.transforms import transforms class MNISTDataModule(LightningDataModule): ...
1ae2b5d72c2bf132a8106190b7ea0b2fb6c488bcd764b19934942cca3ed36e3a
Python
4,546
140
""" Optuna example that optimizes multi-layer perceptrons using PyTorch. In this example, we optimize the validation accuracy of fashion product recognition using PyTorch and FashionMNIST. We optimize the neural network architecture as well as the optimizer configuration. As it is too time consuming to use the whole F...
3188d35d8deb97ebbf67d83aedea6e344294314e47d946f2545a18645b4cc04b
Python
4,547
112
import torch import torch.distributed as dist import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.utils.data import torch.utils.data.distributed import logging import random import numpy as np from monai.transforms import \ Compose, Resize, EnsureChannelFirst, S...
8ba9a795c4d6ff01d7a06f4a68f88174a8fd16eae597b10c333dfee5ecda12f0
Python
4,547
148
import numba from neurolib.control.optimal_control.oc import OC from neurolib.models.wc.timeIntegration import compute_hx, compute_hx_nw, Duh, Dxdoth class OcWc(OC): """Class for optimal control specific to neurolib's implementation of the two-population Wilson-Cowan model ("WCmodel"). :param mo...
cc6b10dff73a0a7435eac28499fed14824f1605615298e61cedc84eb2b4b384f
Python
4,547
155
# 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...
3006e7c88c75b1bb0474895cce184f9b238069d1d3877c93fd1c58ea79eac1f9
Python
4,548
146
#!/usr/remote/bin/python -u import numpy as np import os from sys import argv import copy import math import re import stat import shutil from optparse import OptionParser import readline def question(question,typefunc,default=None,autocomplete=True): if typefunc==int or typefunc==float: if not default==None and...
6f4cc708cfe513d23b46049f8cff46e3e8c10cb0dd0c3cb5f25ac1b7b196ede3
Python
4,548
136
import os import os.path as op import numpy as np from tqdm import tqdm import mne import mne_bids import nibabel as nib import matplotlib.pyplot as plt from utils import load_raw, bipolar_reference from params import BIDS_ROOT as bids_root from params import SUBJECTS as subjects from params import TEMPLATE as templ...