sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
290d30856c5b04ffb10df700a5d13f6a6c36a939704ee026ea3fa2fabaf7eb61 | Python | 4,242 | 124 | import rdkit
from rdkit import Chem
from moleculekit.molecule import Molecule
from moleculekit.tools.voxeldescriptors import getVoxelDescriptors, viewVoxelFeatures
from moleculekit.tools.atomtyper import prepareProteinForAtomtyping
from moleculekit.smallmol.smallmol import SmallMol
from moleculekit.home import home
imp... |
53fff922b99c693ff994ca59b185df5752995bc4fc872bb9ad184505e98afd68 | Python | 4,242 | 127 | """
Create a dist_info directory
As defined in the wheel specification
"""
import os
import shutil
import sys
from contextlib import contextmanager
from distutils import log
from distutils.core import Command
from pathlib import Path
from .. import _normalization
from ..warnings import SetuptoolsDeprecationWarning
... |
af5e93fedc1c2df128f43b2a3de8200fd2ab0beee3e6fb792d27e347aeb6c526 | Python | 4,242 | 116 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 27 17:28:50 2023
@author: felipe
"""
import numpy as np
import sys
import os
sys.path.append(os.path.abspath('../../'))
import analysis.frequency as frequency
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import scipy.io as... |
451e61639e87ea9fbf1c9102d35b050054e93a5791c629e1ec90ab5b78dd1359 | Python | 4,244 | 142 | # %%
import os
os.environ['CUDA_VISIBLE_DEVICES'] = "0"
import math
import numpy as np
import torch.optim as optim
import torch
import torch.nn as nn
from torch_geometric.data import DataLoader
import torch.nn.functional as F
import argparse
from metrics import get_cindex
from dataset import *
from model import MGraph... |
57a0660e35bcf2c7b894a805bbb559ef6d6b52e9b2bbb727f35ac3c7154ee2f9 | Python | 4,244 | 121 | """
Noise codes
===========
This tutorial shows how to generate different types of noise-codes using the PyntBCI library. Noise-codes are used to
evoke the code-modulated responses as measured by EEG. For a comprehensive literature review of code-modulated visual
evoked potentials (c-VEPs), see [1]_. For an empirical ... |
61d8fdda8b0b863868b4564c0d2c07f99bb483b58f18667886981cac569b7ea6 | Python | 4,244 | 77 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from lab.reports import Attribute, gm
import common_setup
REVS = ["issue548-base", "issue548-v1"]
LIMITS = {"search_time": 1800}
SUITE = suites.suite_optimal_with_ipc11()
B_CONFIGS = {
'rl-b50k': ['--search', 'astar(merge_and_shrink(mer... |
7bbfe95d0fd4f4959b64e4a773cb849719c24614b16d033142e2c10d30d71007 | Python | 4,244 | 157 | # 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... |
b060019a8c73053b1f49c122a864193acdef9ca40ab0eeeaf79d1ba417f95dc9 | Python | 4,244 | 125 | from __future__ import annotations
from typing import Optional, TYPE_CHECKING
import pandas as pd
from cuppa.constants import META_CLF_NAMES, SUB_CLF_NAMES
from cuppa.logger import LoggerMixin
from cuppa.misc.utils import as_categorical
if TYPE_CHECKING:
from cuppa.classifier.cuppa_classifier import CuppaClassi... |
2c04aeb8468d5dfa52ee0d98a0a11c318ccd893bf9934577ab6e707c5a774781 | Python | 4,245 | 122 | import os.path
import tarfile
from collections import defaultdict
from ckg.graphdb_builder import mapping as mp, builder_utils
import pandas as pd
###################
# FooDB #
###################
def parser(databases_directory, download=True):
relationships = defaultdict(set)
directory = os.path.j... |
409ce3ef788dc6fa0d456726de53c26e7bde9286b8ecb32712675024ccfa5633 | Python | 4,245 | 123 | from __future__ import annotations
from typing import TYPE_CHECKING
from wikibaseintegrator.models.basemodel import BaseModel
from wikibaseintegrator.models.snaks import Snak
from wikibaseintegrator.wbi_enums import ActionIfExists
if TYPE_CHECKING:
from wikibaseintegrator.models.claims import Claim
... |
c146b41283bb15a1951efcf6597f1e9d5c3bd936b815029329894b5c19d5f700 | Python | 4,245 | 103 | #!/bin/env python
"""
OXASL - Sensitivity correction module
Copyright (c) 2008 University of Nottingham
"""
from __future__ import unicode_literals
import numpy as np
from fsl.data.image import Image
from oxasl import reg
from oxasl.options import OptionCategory, OptionGroup
from oxasl.reporting import LightboxImag... |
6936c728efcbe4259127f070133253f65194afb5966cb29bc65010816392d658 | Python | 4,246 | 114 | import torch
import numpy as np
from xron.utils.seq_op import raw2seq
from torchaudio.functional import forced_align
def beam_search(decoder, logits, seq_len, return_paths = True,vocab = ['b','A','C','G','T','M']):
results = decoder(logits, seq_len)
tokens = [ [x.tokens for x in result] for result in results]
... |
438347b5a4b509b2f481d574476c1ceaf6f641cce08841b67f497e7c0ad456f8 | Python | 4,247 | 65 | dict_manifest_to_version = {
'Notebook_Augmentor_ZeroCostDL4Mic': 'Augmentor' ,
'Notebook_CARE_2D_ZeroCostDL4Mic': 'CARE (2D)' ,
'Notebook_CARE_3D_ZeroCostDL4Mic': 'CARE (3D)' ,
'Notebook_Cellpose_2D_ZeroCostDL4Mic': 'Cellpose' ,
... |
aa963c7f1c8157c7b6e8954024791d2424031b253aa6ae53115f6e7d483ba812 | Python | 4,247 | 130 | # 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... |
fa003376ee190875721398c5fbed9f76999295384e084459f77badbd8277fb34 | Python | 4,247 | 102 | import SimpleITK as sitk
class sitkTile:
# 1. estimate transformation between input volumes
# 2. warp one volume with the transformation
def __init__(self):
self.elastix = sitk.ElastixImageFilter()
self.transformix = sitk.TransformixImageFilter()
self.parameter_map = None
se... |
334d6b0eac47f296c18d77ba9f14aaff17cf84129a4fe2e1521f7d22cd09d049 | Python | 4,248 | 144 | from abc import abstractmethod
from collections.abc import Callable, Iterable, Mapping
from typing import Protocol
from ._attribute import AttributeMapping
from .datagraph import DataGraph, Graph, NodeEdgeFactory, ReadOnlyDataGraph
from .datagraph import Edge as _Edge
from .datagraph import Node as _Node
from .graph i... |
622f554606bb0919125c30c5474bc9bb650bb86316db3945fd37573a25e52d05 | Python | 4,248 | 172 |
#dict of gt regexes
"""
pre.create(".+"),
pre.create("\d+"),
pre.create("\w+"),
pre.create("\s+"),
pre.create("\\u+"),
pre.create("\l+")
"""
gt_dict = {
776: "JPC\\u\\u\\d+\\.png",
922: "WHS\\d_\\d+",
354: "\\u+",
523: "(\\u)+|\\.",
184: "\\.\\d+",
501: "u... |
844de5ce041013752ff6a25063e5334f45bbd74763cba7467ff99ebfb6b4c3ad | Python | 4,248 | 105 | '''
Description:
Run MIOFlow on extrapolating multiple timepoints.
Author:
Jiaqi Zhang <jiaqi_zhang2@brown.edu>
'''
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scanpy
import torch
import sys
from baseline.MIOFlow_model_revised.running import trainModel, makeSimulation
from m... |
9d191be9e93e1e837369ca5ad93ad69ad735356bc824d94bd95fa9f38350a9cc | Python | 4,249 | 107 | """Persist a fitted midsagittal plane beside the annotation it describes.
Built-in atlases NO LONGER use this. Their planes are fitted by the maintainer
and shipped in ``regtools/hemisphere/planes.json`` - see
:mod:`regtools.hemisphere.shipped`. The one remaining producer is the midline
the USER DRAWS for a custo... |
cfcd0563f31cb2af05ad2ec710b53c601f510171d522db8cae3e57f47d903daa | Python | 4,249 | 120 | import random
import unittest
from unittest import mock
from dreamcoder.enumeration import multicoreEnumeration
from dreamcoder.frontier import Frontier
from dreamcoder.grammar import Grammar
from dreamcoder.task import Task
from dreamcoder.type import arrow, tint
def add1():
x = random.choice(range(10))
ret... |
e89027834c2a9471e05542cda7ed1b65eae9dd186f0da1388cc8769a6931bdde | Python | 4,249 | 129 | """Helper code used to generate ``requires.txt`` files in the egg-info directory.
The ``requires.txt`` file has an specific format:
- Environment markers need to be part of the section headers and
should not be part of the requirement spec itself.
See https://setuptools.pypa.io/en/latest/deprecated/python_e... |
85af6ec6fce0b7673fb96a19c75f35429fc86822ab6ba92977d02bcb7061c535 | Python | 4,250 | 155 | """
Wheel command-line utility.
"""
from __future__ import annotations
import argparse
import os
import sys
from argparse import ArgumentTypeError
class WheelError(Exception):
pass
def unpack_f(args):
from .unpack import unpack
unpack(args.wheelfile, args.dest)
def pack_f(args):
from .pack impo... |
9209f07173c24bd3e3b24300c1800fb523f25f5dc8599645760345045b03aa7d | Python | 4,251 | 105 | # -*- coding: utf-8 -*-
"""This file implements the dipole model
Atomic predictions from the network are interpreted as atomic charges. This
model fits the total dipole of the inputs and predicts both the charges and
the total dipole.
"""
import numpy as np
import tensorflow as tf
from pinn import get_network
from pi... |
ca2e6d7564d59a20df90e59390dec9ac0384d47b3ca057ee5a82ba6f9625adac | Python | 4,251 | 148 | #!/usr/bin/python
import sys, getopt
import numpy as np
from scipy import optimize
import os
import matplotlib.pyplot as plt
import plotter_module as plotter_module
import cleaning_module
class eloG:
def __init__(self, filename):
self.log_open(filename)
self.name = filename
... |
6180820f9552ed587309451637937341de5379b34ad6d5104054c39b88487d1b | Python | 4,252 | 147 | """
Core recipes for Lennard-Jones Potential.
NOTE: This set of minimal recipes is mainly for demonstration purposes
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from ase.calculators.lj import LennardJones
from quacc import job
from quacc.runners.ase import Runner
from quacc.schemas.ase ... |
278f8193ae022161803505fd789b4f16545e67e98caac2cbe28f436a33ec4dc6 | Python | 4,253 | 122 | """
Generates a filtered by class version from an input Relion's STAR file
Input: - STAR file
- Classes to keep
Output: - A copy of input STAR file where only entries of the specified classes are preserved
"""
__author__ = 'Antonio Martinez-Sanchez'
###### Global variables
import pyseg ... |
afa9a55ea8ef88ab3daed33c6933e16e235f6b936bd63da9d2f80afd3cd12313 | Python | 4,255 | 77 | """
Gets synapse (not connection) properties of projection synapses on assemblies
last modified: András Ecker 06.2023
"""
import os
from tqdm import tqdm
import numpy as np
import pandas as pd
from morphio import Morphology
from conntility.subcellular import MorphologyPathDistanceCalculator
from assemblyfire.config i... |
01f6ca1123702c2ba58fab731f4b8673f17b24f91282a10b03e6365bb996c6f5 | Python | 4,256 | 116 | import torch
from prosper_nn.models.hcnn.hcnn_cell import HCNNCell, PartialTeacherForcing
class TestPartialTeacherForcing:
ptf = PartialTeacherForcing(p=0.5)
def test_evaluation(self):
self.ptf.eval()
input = torch.randn((20, 1, 100))
output = self.ptf(input)
# fill dropped n... |
7663d0007e9bd9ca2a75a618d1a89833287e7fbda859485b92c90f95471e9ab6 | Python | 4,256 | 111 | import os
import tempfile
import unittest
from torcheeg.model_selection import (KFold, KFoldCrossSubject, KFoldCrossTrial,
KFoldGroupbyTrial, Subcategory)
from .test_utils import _make_dataset
class TestKFoldSplits(unittest.TestCase):
def setUp(self):
self._directo... |
4f389b737aaa355731332eb0e1eb2006af3a22fe5d047af86622658106795022 | Python | 4,257 | 137 | """
MOF-off-compatible VASP static calculation recipe.
"""
from __future__ import annotations
from importlib.util import find_spec
from typing import TYPE_CHECKING
from ase.units import Bohr
from monty.dev import requires
from quacc import flow, job
from quacc.recipes.vasp.matpes import matpes_static_job
from quacc... |
95e35dd16e9428e66a7c1624e43d61a27c2fb62827f4de9aa5d6eb0f5cf7da8a | Python | 4,257 | 107 | """Implements the long-short term memory character model.
This version vectorizes over multiple examples, but each string
has a fixed length."""
from os.path import dirname, join
from rnn import build_dataset, concat_and_multiply, one_hot_to_string, sigmoid, string_to_one_hot
import autograd.numpy as np
import autog... |
34ca3d5895a916e29f56be23e6b6d46bb351336acfe12d0152634e7e62907f20 | Python | 4,258 | 71 | """Real-GPU check of capture/steering layer pairs in every order (capture below, on, or above steering).
PYTHONPATH=src python scripts/layer_order_acceptance.py --profile qwen3-0.6b-base --output results/layer-order
"""
from __future__ import annotations
import argparse
import json
from pathlib import Path
from li... |
d60513bed4c4f5c4477964f04a1593c77c3982a93960fea720541dd6672de4b1 | Python | 4,258 | 132 | # 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... |
00a59ab6679fe9fc55ca5033b683eb9fbd0c0426884ca28dd92c05abf3495ed4 | Python | 4,259 | 110 | import scanpy as sc
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
import scipy
def load_data(adata_path, zscore_path):
adata = sc.read_h5ad(adata_path)
zscore_df = pd.read_csv(zscore_path, sep='\t')
return adata, zscore_df
def calculate_disease_score(adata, z... |
3fdb326141acdd39ab8e1ff495ef233ae25f40af7b0231ff1d592516b21b84fd | Python | 4,259 | 116 | import random
import unittest
import torch.nn as nn
import torch
from torch.utils.data import Dataset
from torch.utils.data.dataloader import DataLoader
from torcheeg.trainers import CWGANGPTrainer, WGANGPTrainer
from torcheeg.models import BGenerator, BDiscriminator, BCGenerator, BCDiscriminator
# A minimal dataset ... |
55d238251b71c3fe2ed8a25d6b8cd04170bf269a4dac74b3746e39bf1bb49dc4 | Python | 4,259 | 125 | """Standalone launcher for the Manual Contour Registration tool.
Usage
-----
# GUI launcher (file picker dialog)
python -m regtools.manual_contour_registration.launch
# CLI with file paths
python -m regtools.manual_contour_registration.launch registered.nii.gz
# CLI with all paths
... |
2fe2ea8f54da4cdc0034e3f18592451de1796e1c1d02e18cad5a2c6c58f9383e | Python | 4,260 | 124 | import pandas as pd
import os
import numpy as np
import pandas as pd
import random
from warnings import simplefilter
import pickle as pkl
from sklearn.model_selection import train_test_split
from scipy import sparse as sp
import argparse
simplefilter(action='ignore', category=FutureWarning)
def l2norm(mat):
stat... |
a2aebbd0959a5a7c8326b43f5cf897187fc680391109a2ed11189a9899a3c78a | Python | 4,260 | 88 | # SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL
#
# SPDX-License-Identifier: AGPL-3.0-or-later
import numpy as np
import pandas as pd
from tqdm import tqdm
from connalysis.network import local
import conntility
def correlation(x, mean_center=True):
"""Correlation between rows of matrix
potentially f... |
6d51c908aa52974f1fbe33caeab2d1ece0a8a205b81b1112da1dbe96403e3e8d | Python | 4,261 | 105 | import sys
sys.path.append(sys.path[0] + "/..")
from file_io import load_image
import numpy as np
import SimpleITK as sitk
import fire
import glob
class SomaLocRefine(object):
def __init__(self, win_radius=(20, 20, 20), kernel_radius=(3, 3, 3), sigma_xy=10, sigma_z=10, iterations=30):
"""
:param ... |
b8a9d17e6e1a36b650174d2a169b016390b54093a6882bb9551f6c550988aead | Python | 4,263 | 110 | """
Pipeline to derive evoked responses from EEG data locked to onset and target events.
Procedure includes the following steps:
- Load preprocessed data
- Apply bandpass filter
- Get evoked response for context and random conditions
- Save evoked responses
"""
from pathlib import Path
from helpers import load_config... |
f3e8ecc22810eb5da6388d13ea1daabe3082247f36280b01f79f21e0de513685 | Python | 4,263 | 119 | from tensorflow import keras
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
import matplotlib as mpl
from tensorflow.keras.models import Model
import cv2
# The following two functions were copied from:
# https://keras.io/examples/vision/grad_cam/
def make_gradcam_heatmap(img_array, model... |
b0002da5722c67314877fe35fa405520042d15ad2368788a689e93693746e40c | Python | 4,264 | 96 | import numpy as np
from torch.utils.data import DataLoader
from torch.utils.data.sampler import SubsetRandomSampler
import torchvision.transforms as transforms
from data_aug.gaussian_blur import GaussianBlur
from torchvision import datasets
import pandas as pd
from PIL import Image
from skimage import io, img_as_ubyte
... |
c35a48669469403ecf4abfee398540f2b1ff53747420c871f6ee2ee0d8360790 | Python | 4,264 | 113 | """
Using TorchEEG to Complete a Deep Learning Workflow
===================================================
In this tutorial, we demonstrate a complete deep learning workflow using TorchEEG. We will cover the following aspects:
1. Utilizing Datasets and Transformers in TorchEEG
2. Data Partitioning Strategies in Torc... |
d743d93c33669be62748c5a825461267501592e5cc322662eb954980664f2472 | Python | 4,265 | 59 | import pandas as pd
import json
# second-level metaclass
taxonomic = ["P279", "P31", "P361"]
biomedical_symmetric = ["P769", "P2789", "P2293"]
nonbiomedical_symmetric = ["P129", "P1382", "P1889", "P190", "P2959", "P3179", "P3364",
"P3403", "P460", "P461", "P47", "P530"]
biomedical_nonsymmetr... |
db7645ef5802c3802971481b4887e4c9e999e7f93fae6be3fa29384f440ed44d | Python | 4,266 | 134 | from PIL import Image
import matplotlib.pyplot as plt
import numpy as np
import os
from skimage import io as skio
from matplotlib.patches import Patch
from pathlib import Path
import matplotlib.colors as mcolors
from math import ceil
def load_image_thumbnail(
image_path,
max_size=(128, 128),
):
with Image... |
344cd7689560af49522e7d3a6de1938907a1e201f432f4eeabe14b72abcd15b0 | Python | 4,267 | 119 | import numpy as np
from typing import List
import tensorflow as tf
from dataclasses import dataclass, asdict
from sitetack.app.alphabet import Alphabet
from sitetack.app.kmer import Kmer
from sitetack.app.enums import PtmKind, OrganismKind, LabelKind
from sitetack.app.model import Model
from sitetack.app.fasta import ... |
a08ba6e014cf9d2ba3e9ac54538d586a6b94c9c1cbb344221e1d508f1092ea81 | Python | 4,267 | 131 | import numpy as np
import torch
from PIL import Image
def convert_img(img):
"""Converts (H, W, C) numpy.ndarray to (C, W, H) format
"""
if len(img.shape) == 3:
img = img.transpose(2, 0, 1)
if len(img.shape) == 2:
img = np.expand_dims(img, 0)
return img
class ClipToTensor(object):... |
a59b6a3782a199cb71c9749c4d606d55d3dc07934967d5f8347d2e01e1a6a063 | Python | 4,267 | 100 | """Shared source loader for the OME-Zarr converter.
Loads one conversion source to a numpy array, applying the TissueCyte
reorientation (``orient``: per-section in-plane transform + section/z reversal)
and the manual axis order/flips. Used by
both the conversion CLI and (historically) the in-process GUI worker so... |
179b8f9fdd49f56d746fd6320fdc2c028c2ee10214bce2209faf480885d5ed8c | Python | 4,268 | 79 | # 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... |
e6ac9fce1afb2458d1d9d5565a27faa06313a2e0bf7a585c53aa2e572fc108da | Python | 4,268 | 66 | """THEORY_TWO_WAYS.py 2026-10-08. Pre-registration: 04-NOTES/PREREG-2026-10-08e-ADDENDUM-1-THEORY.md
The noiseless rate reduction of the authors' neuron (MEANFIELD.phi: zero rate and zero gain below threshold), on the same
network, knobs and sign sets as REST_STATE R3. For each background b: the resting fixed point, it... |
2829265f6df70f6689214b8d848512f558a0bf8bf069ef1748fea11a14cb8e0e | Python | 4,271 | 136 | # 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... |
3406d665cf5c112b2be9dcdda99a2ccdbd5bd24c3660c26d6a0e1cd9d885faab | Python | 4,271 | 142 | # -*- coding: utf-8 -*-
# @Author: Sadamori Kojaku
# @Date: 2023-01-21 17:11:06
# @Last Modified by: Sadamori Kojaku
# @Last Modified time: 2023-06-15 12:50:28
import os
import pathlib
import random
import tempfile
import numpy as np
import pandas as pd
from scipy import sparse
class NetworkGenerator:
"""
... |
fde03ad2ef63db23119f2fc3999c776b3796f4f7199b669e372cbf1b4022b499 | Python | 4,271 | 108 | from __future__ import annotations
import re
from typing import Any
from wikibaseintegrator.entities.baseentity import BaseEntity, TermsEntity
from wikibaseintegrator.models.aliases import Aliases
from wikibaseintegrator.models.descriptions import Descriptions
from wikibaseintegrator.models.labels import Labe... |
135211082b70e4643be3b94278c2cfe215fcd677601bc8fb6064578aec1ad688 | Python | 4,273 | 96 | """
This script computes the beta series for the specified denoise strategy, task,
and session.
Inputs: session, task, denoise strategy, in that order.
Outputs: nii file with the beta computations
@author: trianaa1
"""
import sys
import pandas as pd
import nibabel as nib
from nilearn.image import concat_imgs
fro... |
0c80ea24f5c5baa9dea61e3e8177cbf937a17880683aaa5507f257f2bd1b2249 | Python | 4,274 | 105 | import torch
import torch.nn as nn
import torch.nn.functional as F
from ...utils import LazyLoader as _LazyLoader
_pyg = _LazyLoader(
'torch_geometric',
install_hint='See https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html')
class GIN(nn.Module):
r'''
A simple but effective ... |
5610b8853bfb926b569d3e93e4aab9d2ffaf942b28d48e3ba52767c2be49e136 | Python | 4,274 | 128 | # 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... |
6fa129684f6c5b064c3f88550c77e0f1a8f691bfeff7ba305d03e27b26f15548 | Python | 4,274 | 126 | import pandas as pd
import click
from sklearn.model_selection import train_test_split
#from src.set_seed import set_global_determinism
import numpy as np
import os
import random
import pandas as pd
SEED = 0
def set_seeds(seed=SEED):
np.random.seed(seed)
os.environ['PYTHONHASHSEED'] = str(seed)
random.see... |
5d28f050f58ef121c07b0e366ec3536cee2afd41a0c196cf93ed28e3bf96e145 | Python | 4,275 | 142 | # 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... |
ad3fc6a1b14464b5c89d3e460ea43302768932aa893c49dc4c48d60da8760d4e | Python | 4,275 | 168 | import pytest
import torch
@pytest.fixture
def inputs():
"""Create sample input tensor for testing."""
return torch.tensor([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])
@pytest.fixture
def relu_layer(tmp_path):
"""Create a ReLU layer for testing."""
from elasticai.creator.nn.integer.MPQ.relu.relu import ReLU
... |
67088eb2ffac0ffa2e5357edf30cbfc59dcb43b51b715cf2aa3d97372aec662b | Python | 4,279 | 108 | """
certifi.py
~~~~~~~~~~
This module returns the installation location of cacert.pem or its contents.
"""
import sys
if sys.version_info >= (3, 11):
from importlib.resources import as_file, files
_CACERT_CTX = None
_CACERT_PATH = None
def where() -> str:
# This is slightly terrible, but w... |
932ab44919ab7c631d92734a5a54642ff5a0b64fe0873d5f0bee17896f3d1c72 | Python | 4,280 | 114 | """Diagnostics-section rendering from registration_diagnostics.json."""
import json
import os
from regtools.registration.report.metrics import _render_diagnostics
def _write(path, obj):
with open(path, "w", encoding="utf-8") as fh:
json.dump(obj, fh)
def test_renders_all_blocks(tmp_path):... |
f388f574f25a228cf94366533e2d2e07589a0c01e250d7cab584864027c52a9a | Python | 4,280 | 127 | import contextlib
import functools
import os
import sys
from typing import TYPE_CHECKING, List, Optional, Type, cast
from pip._internal.utils.misc import strtobool
from .base import BaseDistribution, BaseEnvironment, FilesystemWheel, MemoryWheel, Wheel
if TYPE_CHECKING:
from typing import Protocol
else:
Prot... |
113e151b6d0ccd35e6acd642b03b5fad02c07be825e96396ecbb338189c9b5d3 | Python | 4,281 | 117 | from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
from pertpy._types import cast_frame
from ._look_up import LookUp
from ._metadata import MetaData
if TYPE_CHECKING:
from anndata import AnnData
class Moa(MetaData):
"""Utilities to fetch metadata fo... |
0587d9db0521ae25664eb84f04f553f64dac43f6106e84acd2433110a3bdde0e | Python | 4,282 | 134 | #!/usr/bin/env python3
"""
Compute pairwise correlations between movie-specific IS-RSA statistic maps.
Uses Schaefer 2018 300-parcel IS-RSA output files.
"""
from pathlib import Path
import pandas as pd
import re
from itertools import combinations
# ------------------------------------------------------------------... |
98fad010db95969c4576c95e73f0a60be627cc59fcbb90626653a800841e9577 | Python | 4,284 | 143 | from psychopy import visual
def _display_text(win, txt):
msg = visual.TextStim(
win,
text = txt,
pos = (0,0),
wrapWidth = win.size[0]
)
msg.draw()
win.flip()
def _wait_for_spacebar(kb):
kb.waitKeys(keyList = ['space'], clear = True)
def _show_instructions(win, ... |
9a9b99f52d35d739a02b0cea9aaf8c7f276800c6052d090dac42f70e7568cd4f | Python | 4,286 | 105 | """Recent-sessions mixin for the CCF boundary editor.
Carries the "Load recent..." feature: maintaining the capped recent-session
path list in settings (``_push_recent_session``), enabling/disabling the
button (``_refresh_recent_button_state``), the popup menu of recent paths
(``_show_recent_sessions_menu``), and... |
d7d8d299e2e4e9b2bd9b7335ec82dfeabfabcc057eefaef4cadf652fae68c9c2 | Python | 4,287 | 115 | import torch
from torch import nn
from typing import List, Optional, Dict
from .base import CutoffLayer, EmbeddingLayer
from ..utils import find_distances, _scatter_add
__all__ = ["AtomicOneHot",
"AtomicNumber",
"AtomicEmbedding",
"BehlerG1",
]
class AtomicOneHot(Embedding... |
e0b09270dc1fca4643dc60047652c558c1ad3c2ee8d58e8239a671f0e99ca018 | Python | 4,287 | 138 | #!/usr/bin/env python
"""
Create long-format dataframes from the upper-triangle ISC similarity matrices
for each movie and Schaefer parcel.
Each output CSV contains the correlation value for each unique subject pair.
"""
import pandas as pd
from pathlib import Path
# ------------------------------------------------... |
f789e045d3039de43c79940fcc8e24c18c64986cb8481f510232e49d07e38e42 | Python | 4,287 | 137 | # 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... |
8e883feba874d1b2880c95ebfa977df2d76cc00fd4daa83bea2b0280d581f868 | Python | 4,288 | 150 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Demonstrates that CLEVR sentences are actually parse-able under a CCG
syntax.
"""
import random
import nose
from nose.tools import *
from pyccg.chart import WeightedCCGChartParser, printCCGDerivation
from pyccg.model import Model
from pyccg.lexicon import Lexicon
f... |
bfd90a5bf3e9a4995924244d9745e454c3ba107513f439d4364e3353a21d47ea | Python | 4,288 | 112 | import pandas as pd
import torch
import numpy as np
import os
import cv2
from constants import N_ITEMS
from src.utils import map_to_score_grid, score_to_class
from torch.utils.data import Dataset, DataLoader, WeightedRandomSampler
from torchvision import transforms
def get_multilabel_dataloader(data_root: str, labe... |
e879d8bfffa22108d56d7ac0e29ed764ace28732ef5c01d1b10aa1db9f006501 | Python | 4,288 | 116 | # 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... |
4cd599909e0544c1410112637313bd8418e461b24862df68be4d2688ec7aab0d | Python | 4,289 | 117 | import torch
from torch import Tensor
from torch.nn import Module
from .autograd import (
QuantizeForwHTEAutograd,
QuantizeForwHTEBackwHTEAutograd,
QuantizeForwHTEBackwStochasticAutograd,
QuantizeForwStochasticAutograd,
QuantizeForwStochasticBackwStochasticAutograd,
)
from .two_complement_fixed_poi... |
769640d7c3f446793440295ec17225003f10551428ef89b68b1f7444dca251a6 | Python | 4,289 | 104 | """The napari input preview must show the ORIENTED section and its cells.
The 2D branch of ``_build_input_preview_script`` loaded the section with
``orient=False`` and returned EARLY, before the points suffix was appended - so
the out-of-process viewer showed the un-rotated image and no cell layer at all,
even wi... |
7211e16c90d32e735b9b4f16ef7625a2ded7ae8815c023e9b6b6dfa8cd68f430 | Python | 4,291 | 155 | import os
from os.path import join
import numpy as np
import pandas as pd
from correspondences import Controller
from scipy import spatial
class MatchInspect():
"""Object to control display of correspondence point pairs with filters so
they can be manually inspected and editted.
df: pandas dataframe with pre & p... |
674c15686053511e0c50faed00fa7635ccde0ececf78b58dacf2234a0bba9c0e | Python | 4,292 | 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... |
be27859254ca761238a20af08f4f06cf08b9336033dcdcdda0b4d6184d84a4ed | Python | 4,292 | 107 | """Explicit voxel-spacing units end-to-end (registration CLI + loader).
Regression for three unit-convention bugs rooted in load_volume's voxel_spacing
being interpreted per-format (TIFF: µm, NumPy: mm) while the registration CLI
passed unit-less values:
#1 mm --voxel_spacing reached the TIFF loader as µm (1... |
4fb05220d4c543008e6e810f5f31f7d17743eb7cfb692c9926818df8288225eb | Python | 4,293 | 136 | # -*- coding: utf-8 -*-
import logging
from external import txt2tags
def _get_config(target):
config = {}
# Set the configuration on the 'config' dict.
config = txt2tags.ConfigMaster()._get_defaults()
# The Pre (and Post) processing config is a list of lists:
# [ [this, that], [foo, bar], [pa... |
bd771f2babaf9ca6db73e8aa864d1b37735601ba961db93e6f265ad17553cbb3 | Python | 4,293 | 143 | """
This evaluation script follows 3DDFA and 3DDFA_V2
https://github.com/cleardusk/3DDFA
https://github.com/cleardusk/3DDFA_V2
"""
import os.path as osp
import numpy as np
from math import sqrt
from utils.io import _load
d = './aflw2000_data/eval'
yaws_list = _load(osp.join(d, 'AFLW2000-3D.pose.npy'))
# origin
pts68... |
daa932ef6a5d780d1c653f4f56e21d5f7bfc9167faaa3d73e7b4303da5826c31 | Python | 4,293 | 113 | """
Convert an XML particle list into a STAR file
Input: - XML particle list
- Reference tomogram
Output: - A STAR file with particles
"""
################# Package import
import os
import numpy as np
import scipy as sp
import sys
import time
from pyorg import pexceptions, sub, disperse_i... |
97a7c4aa33ade1c8cffe9e7748fbd86ecb0c11002f60e800c19667f2695a975d | Python | 4,294 | 96 | import sys, math, json
from pybioshell.core.data.io import Pdb
from pybioshell.utils import LogManager
from pybioshell.core.chemical import monomer_type_name, HydrogenBondFilter
LogManager.INFO()
if len(sys.argv) < 4:
print("""
Finds contacts between a ligand molecule and a protein.
This scripts reads one or m... |
b6fbdc698581dc0de707f92ff19a80957d3e250cd9e727427ce6d119ac904034 | Python | 4,294 | 99 | """Implementation of CLI measure command."""
import os
import json
import math
import numpy as np
from treem import Morph, SWC
from treem.io import TreemEncoder
from treem.utils.geom import norm
def measure(args):
"""Computes morphometric features of the reconstruction."""
# pylint: disable=invalid-name
... |
f0609ef33f28d3b6382daf8948948c6069a7917d7ec0ba7969b3cd00437c3d84 | Python | 4,294 | 141 | # 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... |
e0c099a1670cba85a188d03ebd7e04a6354785be5b117a5a04e32fbe85acb25e | Python | 4,295 | 131 | # Node-group asset "Dihedral Psi" (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,... |
ef910a0d1c5e28a30dc1b0cdca9146638fe8d93c381e47aa1b38e0704b261d9c | Python | 4,295 | 119 | import os
import numpy as np
import pingouin as pg
import nibabel as nib
import scipy.stats as ss
import hcp_utils as hcp
from sklearn.linear_model import LinearRegression as LReg
parc_l = hcp.mmp.map_all[hcp.struct.cortex_left]
parc_r = hcp.mmp.map_all[hcp.struct.cortex_right]
parc = hcp.mmp.map_all[hcp.struct.c... |
7b30802a098be2082e78d81b5504388af823f57a0a45e5582e660c203274b399 | Python | 4,296 | 122 | """
Credit: Tianwei Yin
Copied from LAV repo
"""
from torch_scatter import scatter_mean, scatter_max
from torch import nn
import torch
class DynamicPointNet(nn.Module):
def __init__(self, num_input=9, num_features=[32,32]):
super().__init__()
L = []
for num_feature in num_features:
... |
ed024a10cba3d63c5d016c3f98fc88a8614216f9cfde97584d03a8fce62a8fa4 | Python | 4,296 | 133 | # Plots probabilities to prefer a corticospinal wave based on selected feature
# for Fig 7D
from os.path import join
from get_paths import *
import classification
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import Repeat... |
3e5587f5e6a9db631da816fd408fd87310c5a3242dab59033ed9710ebca4f627 | Python | 4,297 | 166 | from __future__ import annotations
import numpy as np
import pandas as pd
from typing import Any, Optional
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.utils.validation import check_is_fitted
from numpy.typing import NDArray
from cuppa.logger import LoggerMixin
class Log1pTransformer(BaseEs... |
844b33a80571dc88e67d7eb9ad1bf1a022060e76930e286a69caaff8332be53d | Python | 4,297 | 148 | from functools import partial
import scipy.linalg
import autograd.numpy as anp
from autograd.extend import defjvp, defjvp_argnums, defvjp, defvjp_argnums
from autograd.numpy.numpy_wrapper import wrap_namespace
wrap_namespace(scipy.linalg.__dict__, globals()) # populates module namespace
def _vjp_sqrtm(ans, A, dis... |
b1d2cb7460075cf1bbf31729d366583882c140f5ba960d54bd6dd3e2b5be7744 | Python | 4,297 | 123 | import pandas as pd
import random
import numpy as np
from merlin.util import barcodefilters
def generate_barcode(fov, barcode_id, x, y, z, mean_intensity):
bc = {'barcode': random.getrandbits(32),
'barcode_id': barcode_id,
'fov': fov,
'mean_intensity': mean_intensity,
'max_... |
301ed0d66d681cb9cdc0ef8ce2b977a4fad66cbf8333d0d5feeacd4d4cbdd090 | Python | 4,298 | 136 | """ Engram Utilities: This module contains utility functions that are repeatedly used throughout the project """
import numpy as np
import pandas as pd
import os
def safe_save_dataframe(dataframe):
""" This function saves a data frame and ensures that values don't change unexpectedly
:param dataframe: Data ... |
f01ed480e1618d9267225788791446e6d7d7204023ca4101bbdddcd0ffab8bc2 | Python | 4,298 | 100 | """
Set of functions to access Allen Brain cell (ABC) atlas, download MERFISH data, and annotate with DevCCF labels.
"""
import os, json, requests, pathlib, subprocess, time
import pandas as pd
import matplotlib.pyplot as plt
def download_file( file_dict ) :
print(file_dict['relative_path'],file_dict['size'])... |
4f16f280440a8c6024d9ba26e08a75f397a15680671410188346a1b5beff9818 | Python | 4,300 | 128 | ## Reserved to unit and integration tests
if __name__ == "__main__":
no_rotation = True
S = Surface()
I = Perimeter()
if 0:
I = Perimeter()
I.append(Point(-4,6,0))
I.append(Point(0,2,0))
I.append(Point(2,5,0))
I.append(Point(7,0,0))
I.append(Point(5,-6,0))... |
e244f610cbc4521ed34e896e931fd9c7cdc10ba2c0b7c6508fed7e532c6999bb | Python | 4,300 | 135 | import math
from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_port
from elasticai.creator.vhdl.design.design import Design
fro... |
1bf058f96c05694c0eb5ffe7e0d8affe4dd7153ea74b973284f2fe55ec5e79b9 | Python | 4,301 | 119 | """
Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu.
"""
import string
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.transforms as mtransforms
import numpy as np
from matplotlib import rcParams
from matplotlib.colors import ListedColormap
cmap_em... |
5de64428c36bd85e303b59cbdda3de1b2a10fcfb3ef9a423803d3a384adadf65 | Python | 4,302 | 98 | MODEL_PATH = r"E:\KosikLab\Deep-Learning-for-Realtime-Spike-Sorting\data\models\v0_2\2950"
PATH_REC_NPY = r"C:\KosikLab\2950\data.raw.npy"
PATH_SORTED_NPZ = r"C:\KosikLab\2950\sorted.npz"
import numpy as np
import torch
import matplotlib.pyplot as plt
from src.model import ModelSpikeSorter
from tqdm import tqdm
cla... |
7fc24340bff7927e91774c77c56c14fd2c2509634bc85558cd00eb0818782115 | Python | 4,302 | 146 | import re
from collections.abc import Callable
from typing import cast
import pytest
from elasticai.creator.file_generation.in_memory_path import InMemoryFile, InMemoryPath
from .design import MultiValueRom
def extract_rom_values(text: str | list[str]) -> tuple[str, ...]:
if not isinstance(text, list):
... |
8097151c1d804a664c17f0616ef50aaf325902097c52e72d8ce7507eb17166b4 | Python | 4,303 | 120 | # cross correlation analysis of muscle activation
import numpy as np
import matplotlib.pyplot as plt
import os
online_input_path = os.path.join("/home/lifesim/MetaWorm/eworm/model_figure/movement", "online_input.txt")
online_motor_neuron_path = os.path.join("/home/lifesim/MetaWorm/eworm/model_figure/movement", "onlin... |
8e43e664cc66b5e09b12aef081e020a22e3927a80c1de43f548e81a98545480c | Python | 4,303 | 122 | import pandas as pd
from cuppa.components.mutational_signatures import SigCohortQuantileTransformer
class TestSigCohortQuantileTransformer:
#from cuppa.tests.components.test_mutational_signatures import TestSigCohortQuantileTransformer
#self = TestSigCohortQuantileTransformer()
feature_names = ["SBS7_U... |
930e74675c0b6612ccb61f33723477ce0cfceab2aa6847fd346fe458f2335509 | Python | 4,303 | 68 | """GAIN_ATTACK.py 2026-09-29. Pre-registration: 04-NOTES/PREREG-2026-09-29k-GAIN-ATTACK.md
Is the olfactory runaway fixable by lowering Shiu's synaptic weight, with taste still working? Published signs vs lab prior.
usage: python GAIN_ATTACK.py [run|analyse] (workers: GA_WORKERS, default 4; resumable)"""
import sy... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.