sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
9d9b24b3d0bb348081dde9f659b0974200cf20024b024bb8587221c043fe1673 | Python | 9,058 | 201 | """
Modified by Mayank Kabra
Adapted from DeepLabCut2.0 Toolbox (deeplabcut.org)
Copyright A. & M. Mathis Labs
https://github.com/AlexEMG/DeepLabCut
Please see AUTHORS for contributors.
https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
Licensed under GNU Lesser General Public License v3.0
Adapted from DeeperC... |
6320a5056c3d6d74091bc934bb3d03636d73f0074c151b6a3201e7ed3244cff7 | Python | 9,064 | 220 | import random
import torch
import numpy as np
import networkx as nx
from loader import BioDataset, graph_data_obj_to_nx, nx_to_graph_data_obj
def combine_dataset(dataset1, dataset2):
data_list = [data for data in dataset1]
data_list.extend([data for data in dataset2])
root_supervised = 'dataset/supervised'... |
4f3496f9f7b33314049fc95dcbaa2071a96e159c7395d9b73a8a912ab408cb26 | Python | 9,065 | 296 | # 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... |
fe801acbe209ce52e1cc7917c597a18ce26fa3e2ab074b4d8e26ae4db42217e3 | Python | 9,066 | 219 | """
Set of tests for Wilson-Cowan model.
"""
import unittest
import pytest
import numpy as np
import xarray as xr
from jitcdde import jitcdde_input
from neurolib.models.multimodel.builder.base.constants import EXC
from neurolib.models.multimodel.builder.wilson_cowan import (
WC_EXC_DEFAULT_PARAMS,
WC_INH_DEFA... |
d32a1a2b7193411e9f4c33c37d47aff0d798f6b82ea799f1305466e143b2fd55 | Python | 9,072 | 251 | """
Filter a ListTomoParticles by comparing their organization with already simulated models
Input: - A STAR file with a ListTomoParticles to filter
- Path to a pickled set of simulations simulations compatible with the ListTomoParticles
- Filtering settings
Output: - The filtere... |
aa811de38b9eebed23f719fb8be3b17ab64fb17f820884dd1b82037138a5e7d7 | Python | 9,073 | 237 | """GUI smoke test, ISOLATED in its own module: a known Qt+other-toolkit
same-process crash on Windows means tkinter tests must not share a module
with Qt/dask tests. Skips cleanly on headless machines with no display."""
import inspect
import os
import sys
import pytest
_ROOT = os.path.dirname(os.path.dirn... |
d821c933d3c677bee511fa7d92f03b13e93bccdd4a5001dea4ae3fbfb332d933 | Python | 9,075 | 265 | """Headless tests for regtools.updater.core driven against throwaway git repos.
A local *bare* repo acts as 'origin' so update/fetch paths work with no network.
Repo-based tests skip if git is not on PATH (the `repo` fixture is the gate);
the non-git test runs everywhere, since it exercises the git-absent path its... |
9fa0b4011e8ea7ebc5c2fd04ed31583ff636cd2f1ae176f965f8faf90b5f56eb | Python | 9,076 | 100 | import os
import pandas as pd
import unittest
from unittest.mock import patch
import sys
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../src")
from hornet.model import read_data
class TestReadData(unittest.TestCase):
def setUp(self):
self.path = ".data_test_read_data"
sel... |
5f0f9437a58f9bee694122b570d8d75199ec5408a2856eb8a064f45b96ed4576 | Python | 9,077 | 225 | # 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... |
786c884b35d9f65d6bb45bdade9d297ab85be0cbb67074f8224cb76dee5ab4e2 | Python | 9,080 | 261 |
"""
Created on Fri Jul 17 16:59:51 2020
@author: Leonardo Bonetti, Francesco Carlomagno
leonardo.bonetti@clin.au.dk
"""
#To use this script please do the following:
#-place the provided stimuli folders in your favorite directory
#-assign to the variable 'stimidr' (few lines below) such directory
#-define your log ... |
9fff2610ab2527e4f77b5409392cd6c3ae881cfd0179cc1b24ad339421b4037d | Python | 9,083 | 282 | from pathlib import Path
import skimage.draw
import skimage.morphology
from wsilearn.utils.cool_utils import is_list, is_ndarray, is_tuple
import cv2 as cv
import numpy as np
from scipy.spatial.distance import cdist
from wsilearn.wsi.wsd_image import ImageReader
def find_contours(arr, only_outer=True, convex=False)... |
30f718480698d3a4a45cc396cf205d16dd9a813c7ec4ac29f565289ed54a26d0 | Python | 9,084 | 259 | # 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... |
96c527e653538f5a4cbb2c90fb7dbefede49b816f73fb217e045fdcc5a1d04b7 | Python | 9,084 | 210 | import os
import re
from copy import copy
from typing import List, Tuple, Union, Dict
import numpy as np
import pandas as pd
from sklearn import model_selection
from torcheeg.datasets.module.base_dataset import BaseDataset
class KFoldPerSubjectCrossTrial:
r'''
A tool class for k-fold cross-validations, to di... |
c8423833a8beca30f9e6872fe6652081e75ac889ecf97fde0231404297b05fb6 | Python | 9,084 | 265 | """Small script than extracts, for a single subject already processed in our pipeline, several intra/inter hemispheric connectivity values.
For inter:
- 1) The CC mid saggital plane is extracted.
- 2) the full CC volume.
- 3) the commisural ratio by number of fibers.
- 4) the commisural ratio by looking directly at the... |
5b3cec2883ea733a0044d5de4742455458a31bfd4e498fdcbf3f3a5bae7f9b58 | Python | 9,085 | 271 |
import argparse
import os
parser = argparse.ArgumentParser(description='SCanSNP args')
parser.add_argument('--vcf', dest='vcf', help='joint vcf with all mixed genotypes SNPs',required=True,type=str)
parser.add_argument('--barcodes', dest='barcodes', help='for matrixgen mode: FILTERED barcodes file in standard 10x ... |
33b1fbc1dda3380d9f01b1e0ee66a1a28da591069ff870214f06eda38b157655 | Python | 9,086 | 215 | import os
import os.path as osp
import json
from tqdm import tqdm
import pandas as pd
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.data import Data, InMemoryDataset
from itertools import repeat
from rdkit import Chem
from rdkit.Chem import AllChe... |
b62e63b1365cb553018af75bd729358e8d0a47d17165c8147504ebc8a0567c97 | Python | 9,087 | 218 | import json
import argparse
import numpy as np
import multiprocessing
import pandas as pd
import rdkit
from rdkit import Chem, DataStructs
rdkit.RDLogger.DisableLog('rdApp.*')
from SmilesPE.pretokenizer import atomwise_tokenizer
def get_args():
"""
Parse and return command-line arguments.
"""
parser... |
f4ab12c58ac5ab529132d568d15bd625510a74ca8735410a5a1fb0dc0128d543 | Python | 9,087 | 248 | import os
import shutil
import unittest
import mne
import numpy as np
import pandas as pd
from torcheeg import transforms
from torcheeg.datasets import (BaseDataset, ConcatDataset, CSVFolderDataset,
FolderDataset, PairDataset, MNERawDataset)
mne.set_log_level('CRITICAL')
class FakeDat... |
4211d07923727dcde966d69990ef7bddc16525bd6ed87201378924c3390e8414 | Python | 9,089 | 267 | # 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... |
67b4805a2e3a51a31a34d6d95560bac532935b1c8ea7bbb4926356c0ba5e8b03 | Python | 9,090 | 200 | #------------------------------------------------------------------------------------------------------------------------
#Author: Brandon S Coventry
# Date: 08/23/2022
# Purpose: This program is a modified port of my previous heirarchical linear regression programs, updated for pymc (v4)
# Revision History: Based ... |
c5d3ae0b29ad733fc2aabf373785253c7d41f46848dde6e0df82c63dedd17613 | Python | 9,094 | 297 | # 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... |
7e61c352d02742f5a49a666ea7d864d6d0894513a1057a45684c703910da91e6 | Python | 9,098 | 188 | import numpy as np
import random
import torch
from basicsr.data.degradations import random_add_gaussian_noise_pt, random_add_poisson_noise_pt
from basicsr.data.transforms import paired_random_crop
from basicsr.models.sr_model import SRModel
from basicsr.utils import DiffJPEG, USMSharp
from basicsr.utils.img_process_uti... |
ca87ae8115ae6f80db6f436bd7f32b4b4bb0f50f91ed0ec0ad1ec1493328c93f | Python | 9,099 | 202 | """Utilities supporting validation of HED tags as strings."""
import re
from hed.errors.error_reporter import ErrorHandler
from hed.errors.error_types import ValidationErrors
from hed.schema.hed_schema_constants import HedKey
from hed.validator.reserved_checker import ReservedChecker
class TagValidator:
"""Vali... |
df2c477b4846052ab72b20e0fa675ee2d14d3fca398a81182d1390d0822588c4 | Python | 9,099 | 248 | # 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... |
efe078b50190cadaca932a3c0bebbcab931ec555f5bb9e2307b8a6c7ba7b6ef2 | Python | 9,100 | 197 | """
MAIN ALGORITHM OF RERE
This file contains the initialization and operation of the ReRe algorithm and its improvements.
"""
import numpy as np
import AnDePeD.ReRe.status_bar as bar
def initialize_rere(self):
# no need in case of online operation for storing values:
# self.values = self.data['value'].to_n... |
ea5b4c62715ef9dbff69dfe61e727bc1fe00229cebe8b220c11468b5b282d652 | Python | 9,102 | 176 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 21 15:20:51 2022
This script compares the fitted parameters with the NM and with the logistic regression.
@author: caroline
"""
import pandas as pd
import os
import matplotlib.pyplot as plt
import scipy
import argparse
import sys
computer = os.una... |
83ac347a0d6775f6cdb9bbfc08a0de3ab998cbdc0b27184ce0700642ddf4dcfc | Python | 9,104 | 248 | """Contents of a JSON file or merged JSON files."""
import json
import re
from hed.errors import ErrorHandler
from hed.errors.error_types import ErrorContext
from hed.errors.exceptions import HedExceptions, HedFileError
from hed.models.column_metadata import ColumnMetadata, ColumnType
from hed.models.definition_dict ... |
586c4c60c9ab2cb5d41111efa796886c213c9d07f9f30dc93b1a1174cfe04bc8 | Python | 9,105 | 209 | import os
import torch
import numpy as np
import torch.distributed as dist
from torchvision import datasets, transforms
from timm.data.constants import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
from timm.data import Mixup
from timm.data import create_transform
from .cached_image_folder import CachedImageFolder
from ... |
b430edbd2592d477d0bed3669fc651684038354a772cd2ffcda81de2734a6814 | Python | 9,105 | 268 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import math
from matplotlib.colors import ListedColormap
from clusim.clustering import Clustering, print_clustering
import clusim.sim as sim
## Plot boxes for the HCP cognitive tasks
def plot_boxes(color='red', lw=2, linestyles='solid', ax=Non... |
74446b7d1137d8729918ed5703b007dd04adb9699bdc81efa24259a0c646bdd5 | Python | 9,106 | 218 | """
HEMIBRAIN_KNOWN_NT_REPLICATION.py - written 2026-09-17.
THE REPLICATION THAT DECIDES WHETHER CHAPTER 3 IS REAL.
RESULT-2026-09-17b measured, in FlyWire, that cell types with experimentally established
chemistry outside the classifier's six-class vocabulary are more ambiguous to it than
size-, region- and ab... |
f4cc07e19120ef4e5e486c413b9db7d238055dc145a3232cc1021e73c8816216 | Python | 9,107 | 249 | # 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... |
44bcad27b21517ac26a61868bf4d822fe85d776f0f57e65b4c5b0b8387a26f46 | Python | 9,108 | 228 | import torch
import torch.nn as nn
import torch.nn.functional as F
class SelfAttention(nn.Module):
def __init__(self, in_channels, grid_size):
super(SelfAttention, self).__init__()
self.in_channels = in_channels
self.grid_size = grid_size
self.multiatt = nn.MultiheadAttention(in_ch... |
436ca7e84fc5cd67a668adaea23bf91e3b5ba3841d46c1a9289679efc6d3524f | Python | 9,114 | 238 | ##
# \file reconstruct_volume_from_slices_rsfmri.py
# \brief Script to reconstruct an isotropic, high-resolution volume from
# multiple motion-corrected (or static) stacks of low-resolution 2D
# slices.
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date July 2019
#
im... |
2ecca054b3571c11247234400d7326e92604ad872422e0c2548827be2d5f54b9 | Python | 9,115 | 247 | # -*- coding: utf-8 -*-
from torch import nn
from tltorch import TRL
from collections import OrderedDict
import torch.nn.functional as F
import torch
class Bilinear(nn.Module):
"""
Bilinear layer introduces pairwise product to a NN to model possible combinatorial effects.
This particular implementation a... |
c5d1625d2cc7e8ef356d5ae3e89bdb6de2e17df81827559d4749f0087ea18121 | Python | 9,115 | 299 |
# IMPORTS
from argparse import ArgumentParser
from functools import partial
import pytorch_lightning as pl
import torch
from pytorch_lightning.callbacks import ModelCheckpoint
from torch import nn
from torch.nn import functional as F
from pytorch_lightning.loggers import TensorBoardLogger
from pl_bolts.models.self_sup... |
1e2bb1d05c731d8c725c42e8a2a0f5b7f8b111c7d3778fe2317845ddc6e00b4f | Python | 9,116 | 243 | from bisect import bisect_left
from typing import List, Tuple
import shutil
from pathlib import Path
from matplotlib import pyplot as plt
import numpy as np
try: #0.0.16
from wholeslidedata.accessories.asap.imagewriter import WholeSlideMaskWriter, WholeSlideImageWriter, \
WholeSlideImageWriterBase
excep... |
f66d496c4d894cb7411b431be81d2511a663d7cd56c7972e3d7669b1b1c46201 | Python | 9,116 | 322 | # module pyparsing.py
#
# Copyright (c) 2003-2022 Paul T. McGuire
#
# 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, cop... |
28d2df68f06bd4afc36d407977087db83ccf22ddf2ed1c4bddb3aba0f94dba4c | Python | 9,118 | 265 | import numpy as np
import pytest
da = pytest.importorskip("dask.array")
import zarr
def test_downsample_mean_max_nearest():
from regtools.ome_zarr_converter.out_of_core import _downsample
a = da.from_array(np.arange(1 * 4 * 4).reshape(1, 4, 4).astype("uint16"), chunks=(1, 2, 2))
mean = np.asa... |
fe7aaa9989d3c6aafe981d32f4990076ad303790f7c3cb5d1bc95b1b92e946aa | Python | 9,118 | 199 | # This code is modified from https://github.com/facebookresearch/ConvNeXt/blob/main/models/convnext.py
import torch
import torch.nn as nn
import torch.nn.functional as F
from timm.models.layers import trunc_normal_, DropPath
# suggested by this [issue](https://github.com/facebookresearch/ConvNeXt/issues/37) (not comp... |
a5d803ddf2afeca0458e094056076332df5b3e7f712a20059c4fb06a4b6dc098 | Python | 9,120 | 180 | supervised_learning = False
def class_extensions():
def init_for_pipeline(self):
"""
Returns H2OPCA object which implements fit and transform method to be used in sklearn.Pipeline properly.
All parameters defined in self.__params, should be input parameters in H2OPCA.__init__ method.
... |
b6aa4f52ac32845dc2b6b3c49e754525636d4a2e1a0d7c101346714c133f4391 | Python | 9,121 | 207 | from __future__ import print_function, division
from collections import OrderedDict, Counter
import numpy as np
import scipy
from scipy.stats import ks_2samp
from learn_tools.collect_simulation import SKILL_COLLECTORS
from learn_tools.learner import SKILL, CATEGORIES, SCORE, FEATURE, PARAMETER, THRESHOLD, RANGES
fro... |
2b1e57dacb30328f993b40799ccc1c48eaa75bf2db7b818fc62da0ed0b9af078 | Python | 9,123 | 196 | """model for MolNexTR"""
import argparse
from typing import List
import cv2
import torch
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_agg import FigureCanvasAgg
from MolNexTR.dataset import get_transforms
from MolNexTR.components import Encoder, Decoder
from MolNexTR.chemical i... |
fc8fc15ecfb7ddbb8291237a4a67eb8f0eae0270475a22cc600314f6ca07a899 | Python | 9,123 | 248 | # -*- coding: utf-8 -*-
#
# Test proper functionality of Syncopy's decorator mechanics
#
# Builtin/3rd party package imports
import numpy as np
import string
import pytest
from syncopy.shared.kwarg_decorators import unwrap_cfg, unwrap_select
from syncopy.tests.misc import generate_artificial_data
from syncopy.shared.... |
35548a26bf73999da84d888ddf751ee45bea60f7219fb679764de6debeea8ffa | Python | 9,125 | 221 | import argparse
import random
import sys
import numpy as np
import os
import pandas as pd
from tabulate import tabulate
from tqdm import tqdm
import torch
from constants import BIN_LOCATIONS1, BIN_LOCATIONS2
from old_code.dataloaders import get_regression_dataloader_eval
from src.training.train_utils import count_par... |
49cfee5d3768fcc6bb899bbc3d86eee5ca292970c47e7d4a494d57c668ca94fe | Python | 9,125 | 234 | # 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... |
85d38189ed294f620d32d3d0906f50064f5e95f073623dc59ff91877a3b25a14 | Python | 9,127 | 232 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from tqdm.auto import tqdm
from utils import CGR_utils
def plot_random_fcgr(df, k=6, random_seed=42):
"""
Plots a 3x3 grid of random FCGR images from sequences in a DataFrame.
Parameters:
- df (pd.DataFrame): DataFrame containing... |
375c9108d5c1a735cc98d1bc2576fe7179d7c12808811bc7fbf182e19ea9cee2 | Python | 9,128 | 257 | # 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... |
da6521f2c3488203d1b1dd6046abec7da4f13aafccd20f721f4fee2d19983283 | Python | 9,132 | 232 | ''' Script to do stats on decoding accuracy data and make plots '''
# Set directories
project = 'MINDLAB2020_MEG-AuditoryPatternRecognition'
project_dir = '/projects/' + project
scripts_dir = project_dir + '/scripts/working_memory/'
import sys
sys.path.append(scripts_dir)
import mne
import pandas as pd
import numpy a... |
c1830a71f85e57b4551ede66e325d602bac79c4d11be91994f2bf30035aa323c | Python | 9,137 | 237 | import pytest
import random
import numpy as np
import pandas
from merlin.util import barcodedb
@pytest.fixture(scope='function')
def barcode_db(single_task, simple_merfish_data):
yield barcodedb.PyTablesBarcodeDB(simple_merfish_data, single_task)
@pytest.fixture(scope='function')
def barcode_db_with_barcodes(b... |
0fd938a2c3cc5cfbd768392559f702ba432f729c6e7f3a13a2d4990d2342a98f | Python | 9,139 | 252 | # 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... |
93549b90bf0c9ac23a1f52ec575e25471474da62b1e4bbfe1b64ba8a03fae464 | Python | 9,139 | 146 | """Real-GPU acceptance of one language-model profile (weights, architecture, coupling, speed, memory).
PYTHONPATH=src python scripts/model_acceptance.py --profile qwen3-4b-base --output results/model-acceptance
PYTHONPATH=src python scripts/model_acceptance.py --profile qwen3-0.6b-base --injection --output results... |
decb2451002f320582d456d1e39301412e549dcdb632686de681f42f4898a8ce | Python | 9,139 | 238 | """Each encoder should have following attributes and methods and be inherited from `_base.EncoderMixin`
Attributes:
_out_channels (list of int): specify number of channels for each encoder feature tensor
_depth (int): specify number of stages in decoder (in other words number of downsampling operations)
_... |
6730c996ef62aa67ae5ed3de5ea8b9b0e95d1474974a3a270d3ed112a0b04abe | Python | 9,141 | 238 | """Utilities to read data from different format."""
import inspect
from warnings import warn
import numpy as np
import xarray as xr
from mne import Epochs, create_info
from mne.channels import DigMontage
from mne.epochs import make_metadata
from pandas import DataFrame
def _defaults_check_epoching(kwargs):
expec... |
e68457a3f3d3f5aed8faef803db87d4778fd549356337dd547269df23a022170 | Python | 9,141 | 291 | # 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... |
b1e66f41894c4022101f0f910d1bed847cf4d10e4b50935ed78b8cdb68257243 | Python | 9,142 | 281 | import sys
import time, datetime
import traceback
import importlib_resources
import json
from collections import namedtuple
from math import ceil
from tqdm import tqdm
from tqdm.utils import disp_len, _unicode
import numpy as np
comm = None
MPI = None
def is_master(comm=comm):
return comm is None or comm.rank == ... |
f2c07609f7fba1992ad1290ac50fee1d424c62b222e9c8beaccf4c06c63788c9 | Python | 9,143 | 252 | """
Filter a ListTomoParticles by comparing their organization with already simulated models
Input: - A STAR file with a ListTomoParticles to filter
- Path to a pickled set of simulations simulations compatible with the ListTomoParticles
- Filtering settings
Output: - The filtere... |
6390d9e65aa635371fac66c8af0dca9d9b4459e84c3e518e7e696f514b215b4e | Python | 9,149 | 254 | import gzip
import io
import os
from pathlib import Path
from urllib.parse import quote
import requests
from biotite.database import afdb
CACHE_DIR = Path(Path.home(), "MolecularNodesCache").expanduser()
class FileDownloadPDBError(Exception):
"""
Exception raised for errors in the file download process.
... |
f14579b3e619f2f52a09cc2fd5e47903b11326caf29359f0c0c1745bef24ea30 | Python | 9,150 | 226 | # 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... |
1a089e75f9fd53438337621d30b1bddb6623856febb4cba64ad2ea4d3c856412 | Python | 9,152 | 264 | # -*- coding: utf-8 -*-
#
# Syncopy timelock-analysis methods
#
import os
import numpy as np
import h5py
from copy import deepcopy
# Syncopy imports
import syncopy as spy
from syncopy.shared.parsers import data_parser
from syncopy.shared.kwarg_decorators import (
unwrap_cfg,
unwrap_select,
detect_paralle... |
6e6647c442339d550adc11fecbacb2f639d0928bc603f556ac8a13db720cb3de | Python | 9,154 | 273 | from typing import Optional, Callable, Tuple
import torch
from torch import Tensor
import torch.nn as nn
# from src.models.utils import conv_block, fc_layer
__all__ = ['get_reyclassifier']
class ConvBlock(nn.Module):
def __init__(self, in_channels, out_channels, norm_layer, downsample, dropout):
super(... |
799b79e0b876413b70f250da75b770b21df1cb8c04672c660aa1f46090ae6b60 | Python | 9,155 | 241 | import torch
from torch_geometric.nn import MessagePassing
import torch.nn.functional as F
from torch_geometric.nn import global_mean_pool, global_add_pool
from myogb.graphproppred.mol_encoder import AtomEncoder,BondEncoder
from torch_geometric.utils import degree
import math
### GIN convolution along the graph struc... |
bedbdab9af6b7c6d0afac4a339d776fad6a020cec4d853051075b64c9fefc5ad | Python | 9,155 | 296 | # 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... |
5f4b8893478ca2152b50a3dfb0a5234737d09cbcd5131b046194986fa6b572e0 | Python | 9,160 | 329 | #!/usr/bin/env python
# coding: utf-8
# ## Plot univariate correlation heatmaps for mutation prediction, across gene features
#
# To support the idea of selecting features using cancer type specific $f$-statistics, we wanted to visualize $f$-statistics across cancer types for some genes. We are expecting to see that ... |
fb77ff56d22b72063de7220b0b9fa8fa3879d56a23f50d1184bddb99b3a327e1 | Python | 9,160 | 275 | import logging
import os
import re
import string
import typing
from itertools import chain as _chain
if typing.TYPE_CHECKING:
from typing_extensions import Literal
_logger = logging.getLogger(__name__)
# -------------------------------------------------------------------------------------
# PEP 440
VERSION_PATT... |
72920e29bdee13afdb22b1266f40134e8e9e87d25b37edec11f2281ee6732a72 | Python | 9,164 | 293 | __author__ = "Zoe Wefers"
__credits__ = ["Ryan Huang"]
__version__ = "1.0.0"
__maintainer__ = "Zoe Wefers"
__email__ = "zoe.wefers@mail.mcgill.ca"
"""Purpose: Function for obtaining folder paths, channel names and numerical values from user.Formats and saves txt and excel files."""
import re
import os
impor... |
ef6fd2a88300478fbb0aba745994e9f3ed55614e0547e198c7a983bb704aa353 | Python | 9,166 | 249 | import numpy as np
from scipy import sparse
import scipy.sparse.linalg as sparse_linalg
def matrix_normalize(M):
M = np.array(M)
row_sums = M.sum(axis=1)
assert np.all(row_sums > 0) and np.all(np.isfinite(row_sums)), "given matrix cannot be normalized"
return (M.T / row_sums).T
class Grammar(object)... |
e8e688ee6fd4998203d0aa247b87810a60a22433c6c3b2e842139d025c7bc42f | Python | 9,167 | 227 | #============================================================
#
# Deep Learning BLW Filtering
# Data Visualization
#
# author: Francisco Perdigon Romero, and Ahmed Shaheen
# email: ahmed.shaheen@oulu.fi
# github id: AhmedAShaheen
#
#===========================================================
import matplotlib.pypl... |
f87f1ade3fb7993b68a550061eed32561cae6d76e9c9be2ff9be854443907330 | Python | 9,168 | 190 | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.animation as animation
import time
import ray
import os
from neuron_model_parallel import NeuronSim
from elec_field import sparse_place_human
from pulse_train import PulseTrain_Sinusoid... |
04c6d460d8d2f6ea1d34f7efb58fe8766534f4603943370c6d0e5c2598659502 | Python | 9,169 | 251 | from typing import Iterator, List, Optional, Tuple
from ._loop import loop_first, loop_last
from .console import Console, ConsoleOptions, RenderableType, RenderResult
from .jupyter import JupyterMixin
from .measure import Measurement
from .segment import Segment
from .style import Style, StyleStack, StyleType
from .st... |
3e2b416ee396841a428632f262e8bb6d81074c9984eacda989df79ad6c7351ee | Python | 9,170 | 332 | # 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... |
74cc0fb18a0dfe66d5767302139e77e96682a0d8f1cbd39da2c16fa6e8cffe00 | Python | 9,170 | 182 | """
This script compares fmriprep confounds.
Requirements:
- fmriprep folder
- savepath where the plots (outcomes) should be stored
- subject label for which the plots will be compared
- strategies for which you would like to compare
- TR of the sequences
... |
96235ad07f52d50a91910ccbd4228f9d4e41198d440a26d4c6cc2d4e21d78dae | Python | 9,170 | 99 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
try:
from relativescatter import RelativeScatterPlotReport
matplotlib = True
except ImportError:
print 'matplotlib not availabe, scatter plots ... |
e58e2f71ea146ed046b4e62dee04a5a0fb4f614e237ec07d95dfffb966bf3922 | Python | 9,171 | 212 | # coding=utf-8
# Copyright 2018 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.0
#
# Unless required by... |
81fc2fbdaf82d3a20a5a829109045173752b39afd17374a67ae6d7d36a1b55bb | Python | 9,172 | 99 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
try:
from relativescatter import RelativeScatterPlotReport
matplotlib = True
except ImportError:
print 'matplotlib not availabe, scatter plots ... |
ffe2dae8dfcc92be7fd1c035abb471143185081ee2d2d614af0b82b85e4662da | Python | 9,174 | 156 | import keras
from keras.preprocessing import sequence
import numpy as np
from matplotlib import pyplot as plt
import sys
import json
from scipy import stats
spearman = lambda a,b: stats.spearmanr(a,b)[0]
from sklearn.neighbors import NearestNeighbors
#model magic below. just a json string that specifies model structu... |
9486e4f479779f9f7705b3556f0871333037cefe84dda4c58be68ffa6e7112da | Python | 9,175 | 193 | from typing import List, Tuple
import torch
import torch.nn as nn
from .mmd_like import _MMDLikeTrainer
def gaussian_kernel(x_source,
x_target,
mul_kernel=2.0,
num_kernel=5,
fix_sigma=None):
"""
Code from XLearn: computes the fu... |
9f56c60aaa46c3df3b878b7f3f271684cba08e20c21ec1e252f5c799637b59d2 | Python | 9,180 | 256 | import torch
import torch.nn as nn
import torch.utils.data as data
import torchvision.transforms as transforms
import torch.backends.cudnn as cudnn
import time
import numpy as np
from utils.ddfa import ToTensor, Normalize, CenterCrop, DDFATestDataset
from model_building import SynergyNet
from benchmark_aflw2000 import... |
ffabca60fed04695584359d80f5bf6f2d4a9211c69727c2df04a31a9d9161add | Python | 9,181 | 167 | """GUI acceptance for model selection and coupling layers (real models, real Qt widgets, offscreen).
Sequence: Qwen3-0.6B (launch) -> 0.6B-Base, layers set to 10 -> 20 with the spin boxes, Continuous run
whose telemetry must show hooks firing exactly on 10 and 20 -> 1.7B-Base -> 4B-Base (NF4) with a run ->
back to Qwe... |
14bbf5a708f50992a998d2f75470571dd265ca049707d093d60e49f25fc1bc99 | Python | 9,182 | 201 | from typing import Tuple
import torch
import torch.nn as nn
class BCEncoder(nn.Module):
r'''
TorchEEG provides an EEG feature encoder based on CNN architecture and CVAE for generating EEG grid representations of different frequency bands based on a given class label. In particular, the expected labels are ad... |
1f53e5ae95faeb6ea3478908bb0219106ac38fde7f9504e8b97dce4800dda361 | Python | 9,186 | 261 | # 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... |
7f51b1b07337298d303b2184b66e53e935d186c2573ce5c530a6594ff924143d | Python | 9,186 | 240 | """Fetch the Franklin-Paxinos parcellation of the Allen CCF (Chon et al. 2019).
Chon et al. (Nat. Commun. 2019) mapped the classic Franklin-Paxinos stereotaxic
nomenclature onto the Allen CCFv3, distributed via BrainGlobe as the ``kim_mouse``
atlas. Its reference image IS the Allen average template, so its annotat... |
0f0e2a9cf5183cbebd0d479f8bf5950c1908d30d9c85589358e9af0e398f2bbc | Python | 9,187 | 263 | # Node-group asset "Animate Trails" (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_CHECKIN... |
f534aa39bc6dbcabbfc6223b9051fc579eab3dd1b5dafb21a3c6b14d889dd3e8 | Python | 9,190 | 238 | # -*- coding: utf-8 -*-
import os.path
from lab.environments import MaiaEnvironment
from lab.steps import Step
from downward.checkouts import Translator, Preprocessor, Planner
from downward.experiments import DownwardExperiment
from downward.reports.compare import CompareRevisionsReport
from downward.reports.scatter... |
6aeb9d055cdd161d8f80711d80ce3098df113fa882699e7e9d6065328dfbb50c | Python | 9,191 | 318 | # 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... |
e78c25b47bf1d5f83cb13dc3de73ac5d40bcb80a9b639d5bd86a139935ca62f0 | Python | 9,193 | 272 | import serial
import time
import re
import threading
class PriorStage():
def __init__(self, sn, baudrate=115200, timeout=0.1, parent=None):
port = [p.device for p in serial.tools.list_ports.comports() if sn == p.serial_number]
self.serial = serial.Serial(port[0], baudrate=baudrate, timeout=timeout)... |
6421dc57462c9ec9d1c16d81090cdb1a35f500bc75ea1291ccba495f264c657f | Python | 9,194 | 207 | import numpy as np
from matplotlib import pyplot as plt
import scipy.io as sio
import sys; print('Python %s on %s' % (sys.version, sys.platform))
sys.path.extend(['/home/DATA_Folder/1R_memoryTest/Frequency_detection'])
# from sklearn.preprocessing import StandardScaler
filename = 'SavedMaps_newChip_SCISSOR-3_20... |
fd54d64bebb017f6a532209a308c4fa03f0e5e7581f075f2d646f8af14ad89a2 | Python | 9,194 | 240 | # %%
import sys
import numpy as np
import pandas as pd
from tqdm import tqdm
import pickle
import matplotlib.pyplot as plt
import os
import math
import scanpy
import json
import argparse
from code_utils.scribble_generation.autoscribble_generator import make_backbone
parser = argparse.ArgumentParser(description='Scribb... |
a491e910ec504a405fcc893ee34ba8d34ea30ba31b2af331a81359531630561d | Python | 9,200 | 275 | import torch
from torch import nn
import dgl
from dgl import function as fn
from .decoder import DotDecoder, ZINBDecoder
class LightGraphConv(nn.Module):
def __init__(self,
drop_out=0.1):
"""Light Graph Convolution
Paramters
---------
drop_out : float
... |
d0432181f3c6164f05667e90abb1e9f4f37a607b903568956f2e035dc4c238de | Python | 9,200 | 260 | import logging
import os
import shlex
import subprocess
from typing import (
TYPE_CHECKING,
Any,
Callable,
Iterable,
List,
Mapping,
Optional,
Union,
)
from pip._vendor.rich.markup import escape
from pip._internal.cli.spinners import SpinnerInterface, open_spinner
from pip._internal.exc... |
a6e745f5c8226c16cf80121c7679d4b28ba1091c960ad861160306c2d8e481c2 | Python | 9,204 | 249 | import pytorch_lightning as pl
import torch
from pytorch_lightning.metrics import Accuracy
from typing import List
from torch.nn import functional as F
from train_ae import AE
import wandb
import torchvision.transforms as T
from models.common import LinearProbe
class Evaluator(pl.LightningModule):
"""
Evalua... |
ed9ed51eebf9d13c05397704732dc3f6fdd6b06b0607d588c911c2ae1283f325 | Python | 9,204 | 261 |
"""
Created on Fri Jul 17 16:59:51 2020
@author: Leonardo Bonetti, Francesco Carlomagno
leonardo.bonetti@clin.au.dk
"""
#To use this script please do the following:
#-place the provided stimuli folders in your favorite directory
#-assign to the variable 'stimidr' (few lines below) such directory
#-define your log ... |
b924afbc866f527fcc5b8da3729ac0cdbd62f5f64c2465852aab5988e2b6dcc6 | Python | 9,206 | 188 | from typing import Callable, List, Dict, Optional, Literal
import torch
from torch import nn
from .base import AtomicModule
from ..layer import EmbeddingLayer, RadialLayer, ReadoutLayer
from ..layer.equivalent import MultiBodyLayer, GraphConvLayer, NonLinearLayer, GraphNorm
from ..utils import find_distances, _scatter_... |
ee0a9b2a7149064af74014214c2e2bc8bc39f90febeb385a4930e1b91b3033d1 | Python | 9,210 | 331 | """Various array operations.
Author: Seth Axen
E-mail: seth.axen@gmail.com
"""
import numpy as np
from scipy.spatial.distance import pdist, squareform
QUATERNION_DTYPE = float
X_AXIS, Y_AXIS, Z_AXIS = np.identity(3, dtype=float)
EPS = 1e-12 # epsilon, a number close to 0
# Vector Algebra Methods
def as_unit(v, axi... |
b0234798d0e273cc8de9bd5972d316ff2536c1e153e59d3f4dd87b161a3e116d | Python | 9,211 | 231 | import copy
import shutil
import time
from typing import List, Tuple
import numpy as np
import os
import pandas as pd
from tabulate import tabulate
import torch
import torch.backends.cudnn as cudnn
from torch import optim, Tensor
from torch.utils.tensorboard import SummaryWriter
from constants import *
from src.train... |
1083c406dcff115f90cd37d486f6cea4f36efb97749d5b08c35cf0df44d7debb | Python | 9,212 | 307 | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 10 14:34:21 2022
@author: agnie
"""
import os
import pandas as pd
import numpy as np
from sklearn.impute import SimpleImputer
import math
import statistics as st
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as ... |
fb0e9f18075062b3bd58532dfc84cef55e3565e3063876439e9cd75695f74bdf | Python | 9,212 | 185 | ################################
######## Inference Prod ########
################################
#%%# Catalyzer
# import re
import numpy as np
# import numba
# from scipy import interpolate
import torch
from sbi.inference import SNPE
from sbi import analysis
import time
import matplotlib
import matplotlib.pyplot a... |
ebdfc4893b2cc6ced8c8253ffe41ec4b65d07fc31a0f21d9c8b7c0e5ec20af83 | Python | 9,213 | 164 | """LAW_IN_SPIKES.py 2026-10-03. Pre-registration: 04-NOTES/PREREG-2026-10-03a-LAW-IN-SPIKES.md
Is the inequality's line (s_Unu >= 0.456 breaks the lobe) the same in spikes? S1: eight new random orders of the 369
unlabelled inhibitory local neurons, spiking cut-out (50 channels x 5 trials), breaking step by bisection,... |
9a957094a366c3c5da326786411782a003ac65bd53fa28aa6b6e101101d66869 | Python | 9,214 | 266 | """Extensions to the 'distutils' for large or complex distributions"""
import functools
import os
import re
import _distutils_hack.override # noqa: F401
import distutils.core
from distutils.errors import DistutilsOptionError
from distutils.util import convert_path as _convert_path
from . import logging, monkey
from... |
47712d40859e77512a6c95c5374a0248ded42b996bf4a8ef08aceb8551b5dc84 | Python | 9,215 | 219 | from collections.abc import Sequence
from importlib.util import find_spec
import numpy as np
import pandas as pd
import pytest
from pandas.core.api import DataFrame
if find_spec("formulaic_contrasts") is None or find_spec("formulaic") is None:
pytestmark = pytest.mark.skip(reason="formulaic_contrasts and formulai... |
66fd90ab40c7f554557bc2bfba5a9cb1f870ee04a118a6133bfd6aeb1909c785 | Python | 9,216 | 291 | import os
import argparse
import yaml
# command line arguments:
# --local: 1 (run locally) or 0 (run on spaceml)
# --GPU: [0-7] specifies the gpu to run it on, check with gpustat which one is available
# --config: path to the config.yaml file
# --runname: optional run name argument
DATA_DIR = ''
GPU = -1
RUN_NAME = '... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.