sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e4493bc7b0ea2fdae9ff2fae0a126b5d9e72cf1c7e613e12f28399f49ac64b01 | Python | 3,787 | 120 | # Node group ".Sample Nucleic Base Values" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# Shared by several assets, which import it; not an asset itself.
# _build_group() is the source of truth: the docstring, __init__ and accessors ... |
8f5e94afd456cfe8154fec26aae96d3d87b6dcfa17c470e2967fe4087cfcc7f8 | Python | 3,788 | 78 | """HED schema loading, caching, and introspection.
This module exposes everything needed to load and inspect HED schemas — the
vocabularies that define valid HED tags.
Typical usage
-------------
Load a released schema by version number (auto-downloaded and cached)::
from hed.schema import load_schema_version
... |
66234fc78ff154f32f85e1f3c7c564da08423e62509dbb14ff57e03bade0df63 | Python | 3,790 | 98 | """Mark a registration output directory as incomplete (Qt-free, testable).
A cancelled run can leave a half-written output directory behind. The danger is
a user (or a later "view results" click) mistaking that partial directory for a
finished result. This module drops an unmistakable marker file into the output
... |
6e23b27e9ad7a90343350b27cf03fb309cdf8c7544e4b15c7e84c8c0506ba6d9 | Python | 3,791 | 113 | from __future__ import annotations
# built-in
import string
from math import isclose
# external
import hypothesis
import hypothesis.strategies
import pytest
# project
import textdistance
from textdistance.libraries import prototype
libraries = prototype.clone()
@pytest.mark.external
@pytest.mark.parametrize('alg... |
9b117c294c67d0f282369a4ecc2c9565d7d8a0afd0a0a78da3f4a28b72328ae4 | Python | 3,791 | 125 | import torch
def _take_channels(*xs, ignore_channels=None):
if ignore_channels is None:
return xs
else:
channels = [channel for channel in range(xs[0].shape[1]) if channel not in ignore_channels]
xs = [torch.index_select(x, dim=1, index=torch.tensor(channels).to(x.device)) for x in xs]... |
b8d1049ced8ee2c4597df5c6820fc49076953d7b69768887f9a93990fe372db4 | Python | 3,791 | 95 | from __future__ import annotations
from typing import TYPE_CHECKING
from pertpy.tools._perturbation_space._perturbation_space import PerturbationSpace, _resolve_matrix
if TYPE_CHECKING:
from collections.abc import Iterable
from anndata import AnnData
class ClusteringSpace(PerturbationSpace):
"""Applie... |
fc9f812d66b35f52c21a28c70ad2d994a0724056049aaeadeee15ac970772928 | Python | 3,791 | 139 | """
==================================================
Run multivariate pattern analyses for cue activity
==================================================
Fits a classifier to test how well the scalp-topography (i.e., the
multivariate pattern) evoked by the presentation of a stimulus can
be used to discriminate amon... |
08ca11af1aeb2135620078ba2f1f5ff6ba7e06b3c0acfc1db041329b02fd96f7 | Python | 3,792 | 91 | """Download the Allen ARA Nissl reference volume, re-warped into CCFv3 space.
The Allen "ARA Nissl" was deformably registered into the CCFv3 ``average_template``
space, so it sits on the **byte-identical voxel grid** as ``average_template_25``
/ ``average_template_10`` - same dims, orientation, spacing, and origin... |
15c8d1875e407618a2a808a4937c7189495ea40796d16e9fcb61ee9a0eda8176 | Python | 3,792 | 50 | """FIG_HEAD_TO_HEAD.py 2026-09-30. Report figure F12 from the HEAD_TO_HEAD rows (Shiu et al.'s own file, simulator checked
against their Brian2 code). usage: python FIG_HEAD_TO_HEAD.py"""
import sys, os, glob
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import numpy as np, pandas as pd, matplotlib... |
6ef3daaea04d35203499733d7885ee9cc9680ed72146aef7310dfeee29acc9c5 | Python | 3,793 | 90 | import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
import pandas as pd
import os
# Generell Plot settings
Custom_Blue = (0/255, 95/255, 140/255) # Converted to [0, 1] range
Custom_Red = (185/255, 40/255, 25/255) # Converted to [0, 1] range
plt.rcParams.update({
'axes.titlesize': 16, # Increa... |
a9c5b610cf6c99bfb45d8dff8a0c0cd766036840828504656017779b531d4469 | Python | 3,793 | 83 | #!/usr/bin/env python
import os
import pandas as pd
import matplotlib.pyplot as plt
from nltools.data import Brain_Data
from nltools.mask import expand_mask, roi_to_brain
from nltools.stats import threshold
from nilearn import plotting as nplot
## location of main project directory on HPC
proj_path = '/project/30111... |
12ebe30d38603c069336b0a1660665e1a326504ef0c5e7fd4eb2293084ae334f | Python | 3,795 | 108 | import os
from html.parser import HTMLParser
import requests
"""
shamelessly taken from https://gist.github.com/exzhawk/33e5dcfc8859e3b6ff4e5269b1ba0ba4?permalink_comment_id=4001137
according to https://community.plotly.com/t/deploy-dash-to-github-pages/14399/7
it is possible to add callbacks using dash clientside ca... |
b738cce634cbadf87e544cb1aace240c0559fad44fc42a11c30748e235120ac0 | Python | 3,795 | 110 | import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
import numpy as np
from .misc import *
__all__ = ['make_image', 'show_batch', 'show_mask', 'show_mask_single']
# functions to show an image
def make_image(img, mean=(0,0,0), std=(1,1,1)... |
5651bc0aa55ebb3de6ae914df18362e94a9aa7611cf158c99a32b3d0472c7a41 | Python | 3,796 | 102 | import os.path
import gzip
from collections import defaultdict
from ckg.graphdb_builder import builder_utils
#########################
# DisGeNet #
#########################
def parser(databases_directory, download=True):
relationships = defaultdict(set)
config = builder_utils.get_config(config_na... |
42aa639b9d475b8c6816d752b588b6b0abd579a3a5d39412374ddab574d65fdb | Python | 3,797 | 127 | from math import floor, log2
import cocotb
import pytest
from cocotb.triggers import Timer
from torch import asarray
from elasticai.creator.arithmetic import FxpParams
from elasticai.creator.nn.fixed_point import PReLU2
from elasticai.creator.testing import CocotbTestFixture, eai_testbench
from elasticai.creator_plug... |
ce2575a16aba34e439304499e57b5b0f6a7058a2a001441749556f4b9bb2b4e1 | Python | 3,797 | 134 | from typing import Literal
from tqdm import tqdm
import numpy as np
from scipy.stats import spearmanr
from sklearn.metrics import roc_auc_score
import torch
import torch.nn as nn
from torch import Tensor
from torch.optim import Adam
from torch.optim.lr_scheduler import CosineAnnealingLR
from .predictor import get_pr... |
f6c101770fe053d371caa61483a095e2c23e8cc301c0e337b491b99428ceb180 | Python | 3,798 | 121 | #
# 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,... |
7b655c944225013f9ebffc63eb3ada2e3335f6ec551beffcab2a2139bbde33f0 | Python | 3,799 | 119 | # 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... |
1ddd9b680866259834222eade75d199899b203f67ac64750bf1ac533e4135844 | Python | 3,800 | 100 | import pandas as pd
import torch
import numpy as np
import os
from src.utils import map_to_score_grid
from torch.utils.data import Dataset, DataLoader, WeightedRandomSampler
from torchvision import transforms
def get_regression_dataloader(data_root: str, labels_df: pd.DataFrame, batch_size: int, num_workers: int, s... |
d378a7ffad73d330b27295c258f9305fe3e3a7b0f83ccb2e85cd2676fd8678eb | Python | 3,801 | 139 | import yaml
def read_yaml(filename: str) -> dict:
"""Reads a yaml file and returns a dictionary
----------
Parameters
* filename: str; the path to the yaml file
Returns
* dict; the dictionary containing the yaml entries
"""
with open(filename, "r") as f:
return yaml.safe_loa... |
315c03fe29cb904c99afc4fe438bd9aaf5563e2ce3d14991ce38097190444b79 | Python | 3,802 | 116 | import itertools
import sys
from collections import defaultdict
from typing import List, Dict, Type
import atheris
from fuzz_helpers import EnhancedFuzzedDataProvider
from dataclasses import dataclass, field
with atheris.instrument_imports():
import textdistance
@dataclass
class InitializationConstraints:
... |
35e9554a2c0d3246068b9754e97ad144e9ba620640cd281b40e79450ffd9cab8 | Python | 3,803 | 99 | import torch
import torch.nn.functional as F
from torch import nn, Tensor
class FCLayer(nn.Module):
def __init__(self, in_size, out_size = 1, dropout = 0.5):
super(FCLayer, self).__init__()
self.fc = nn.Sequential(
nn.Linear(in_size, 128),
nn.ReLU(),
... |
41f11528ab7e529f428ddb193672f8d533494d7a17a18926157ce386e701ca21 | Python | 3,803 | 153 | #!/bin/env python3
'''
Define a Feynman diagram
'''
import pdlfeynman as fy
import pdlfeynman.particle as fyp
import pdlfeynman.reaction as fyr
import yaml
def determine_particle(node:fy.diagram.Node, key:str='products') -> fyp.Particle|None:
match node.nodetype:
case fy.diagram.NodeType.PARTICLE:
... |
5f3df21f841139bd6878ee12e177241b7b5b63e93482d61505c20c159aed25a7 | Python | 3,804 | 117 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Create basic BIDS files and directories.
Based on the material provided by
https://github.com/bids-standard/bids-starter-kit
"""
import argparse
import datetime
import logging
import os
import sys
import platform
from os.path import join as opj
from dcm... |
a3abccac2f73345cc0221aaff98dde3b73dc30b6d2db2b73c091c7957993b2a2 | Python | 3,804 | 101 | """
@Mariellapanag
Created on Feb 2023
@author: mariella and chris, CNNP Lab
Reads in the timeseries of each bandpower for each patient and calculates the power of each biological rhythm.
output: saves these in the cycles folder, and produces
"""
# external modules
import numpy as np
import os
import matplotlib
im... |
16a90b4f536df54ce175bdf7d51a3778919d6a3566823e2aa7dc9e6fde04ae63 | Python | 3,805 | 117 | import json
from collections import Counter
import warnings
from tqdm.auto import tqdm
import random
import math
import numpy as np
import pandas as pd
from Bio.Seq import Seq
# from pandas.core.common import SettingWithCopyWarning
# warnings.simplefilter(action="ignore", category=SettingWithCopyWarning)
pd.set_optio... |
45fc742c8381b64517bbb4290f579867f3d4e7b6696c5577dfffe21a01fcedcd | Python | 3,805 | 124 | # Node-group asset "Vector from Point" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHEC... |
7adc5b753f88fb50904ab5a9f12db61c05e6a2779f7aa009e0b60a03d34fae18 | Python | 3,806 | 101 | import os
import threading
import traceback
from PyQt5.QtWidgets import QWidget
from PyQt5.uic import loadUi
import reram_register
import apps
import globals.global_func as gf
FILE_PATH, FILE_FULL_NAME = os.path.split(os.path.realpath(__file__))
FILE_NAME, FILE_EXT = os.path.splitext(FILE_FULL_NAME)
... |
5315eb6fd3abb0b61253f9091a2adf26123157828ca13c9f2611a87c12751c9d | Python | 3,807 | 101 | # 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... |
f6f7a3610403fb4531f5898f0fb5856796a08afbac6bb381a9e3c9c55636670d | Python | 3,807 | 66 | import matplotlib.pyplot as plt
import numpy as np
import numpy.random as nr
import os
import os.path as path
import seaborn
def threads_plot(data, y_tick_labels, x_dt, save_dir, overlap_num=2., xlabel="Time (s)", ylabel=""):
"""
data: np.array with shape (n_traces, num_step)
y_tick_labels: lis... |
f67aeb71925385e51be0e8ca9aa5eddde8604d3729fb73a35a1d061bee8a7180 | Python | 3,808 | 95 | import os
import random
from time import time
import pandas as pd
import numpy as np
import networkx as nx
import argparse
import pickle
from utils.utils import *
from utils.graph_creation import *
from utils.motif_counts import *
from utils.visualization import *
import graph_tool.all as gt
sns.set_context("talk")
... |
91117e9f5f06847c17c1da1f9851c63f0044352759bff922967a65585a7ba48b | Python | 3,810 | 105 | """The input pane hovers RAW intensities and says when the render is preprocessed.
``_refresh_preview_input`` pushes the input through the Parameters-tab
clip+normalize / histogram-match so the pane approximates what ANTs registers.
With ``Clip + Normalize Input`` on (the default) that rescales to 0..1, and the
h... |
05b0c47f4b3bd4d84e7cf3b2a3917a1167350525df2f91367d35536d1f1c0af7 | Python | 3,811 | 129 | """Focused tests for RegistrationTab._start_worker (issue #129).
The helper encapsulates the moveToThread lifecycle every background worker in
the tab used to hand-roll. These verify GUI-thread relay of result/error,
keep-alive tracking + drop-on-finish, the optional on_finished hook, and that
_shutdown_workers d... |
44770d3a1ab10ce79c4284f52aa97a8bfa32747d984b2eef09e96ae40072803f | Python | 3,811 | 76 | from ..main_analysis import *
from .manifold_stats import *
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Manifold Statistics Script')
parser.add_argument('--model_string', required=True, type=str,
help='string / uid of deep net model to load')
parser.add_... |
2117973940cd2498ae91a6f510e23784c06bd51d28b6601c7494e7704441999a | Python | 3,812 | 99 | """The registration report's per-hemisphere counts section."""
import csv
import os
def _r():
from regtools.registration import report
return report
def _write_hemi(d):
path = os.path.join(d, "cell_count_hemisphere.csv")
with open(path, "w", newline="", encoding="utf-8") as f:
... |
b5f4400f65ed409e8f16ec7f3bca2efca103edd1dd6c6b0beaba4b240294ef7e | Python | 3,812 | 122 | """Generates connectivity results from preprocessed data."""
import os
import numpy as np
from coh_handle_files import (
generate_analysiswise_fpath,
generate_sessionwise_fpath,
load_file,
)
from coh_connectivity import ConnectivityGranger
import coh_signal
def granger_processing(
signal: coh_signal.... |
5d5efd84327355024ee8deec4b2d2159bc546efb6dfde8f15d74d8830f496754 | Python | 3,813 | 105 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : calc_glob_features.py
# Author : Yufeng Liu
# Date : 2023-01-24
# Description :
#
#============... |
5f9be6fe01cd8223d50fadd203805f1c2702425da24830e917ef618308b5d425 | Python | 3,815 | 120 | """Configure sphinx."""
import os
import sys
from datetime import date
import sphinx_bootstrap_theme
import sphinx_gallery # noqa: F401
import pyprep
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# docume... |
69cb24452b9d244b5e1988e777628a53d888e21ee0bbcb9ae86a194e47271261 | Python | 3,815 | 123 | from pathlib import Path
import mdtraj as md
import numpy as np
import pandas as pd
import pytest
from calvados import sim
from calvados.cfg import Components, Config
TEST_DATA = Path(__file__).parent / "data"
# Ashbaugh-Hatch potential
HALR = lambda r,s,l : 4*0.8368*l*((s/r)**12-(s/r)**6)
HASR = lambda r,s,l : 4*0... |
b7543c2be5328e99223959740049368e957f53395e357a417e9b5834f7d68d7a | Python | 3,815 | 139 | from argparse import ArgumentParser, Namespace
import glob
import os
import nibabel as nib
import numpy as np
import pandas as pd
import segmentationmetrics as sm
from tqdm import tqdm
def parse_args() -> Namespace:
parser = ArgumentParser(
prog='meta24_compute_metrics.py',
description=(
... |
c76ed495e90fd2a3eca5d71ad08a86424f7a2729c09292ed3e469d1023919b8a | Python | 3,815 | 110 | """System parameters
--------------------
A dictionary with parameters defining machine configurations.
"""
import sys
import os
if 'HOSTNAME' in os.environ:
partition = ('dc-cpu'
if os.environ['HOSTNAME'].rfind('jureca') > 0
else 'batch')
elif 'SYSTEMNAME' in os.environ:
p... |
a8c744e1de0b2251cebc96a7376d3c78012838a12c84dd9c538df2524368d673 | Python | 3,816 | 111 | """
This script converts NeSys .xyz files with coordinates specified
in the local coordinate system for the pontine nuclei defined by
Leergaard et al. 2000 to Waxholm Space coordinates for the rat brain
(in voxels).
"""
# pylint: disable=C0103
import os
import random
random.seed()
# - - - - - - - - - - - - ... |
cf20dc24d1f69470d2e841bd71196e4d8cac99aacc43265cc4facda697f8abfa | Python | 3,816 | 63 | """SUGAR_OFFSET.py 2026-09-30. Pre-registration: 04-NOTES/PREREG-2026-09-30m-SUGAR-OFFSET.md
Is the left/right sugar asymmetry (Santos 2026) a matter of degree, and which fix keeps a margin at higher sugar input?
usage: python SUGAR_OFFSET.py run | analyse (SO_WORKERS, default 8; resumable)"""
import sys, os, time, h... |
4e440814efcd9b07e0fa2a50698985c0757c9a4e47a88d0eab128144c55c80a5 | Python | 3,817 | 129 | # version:1.0.1905.9071
import gxipy as gx
import time
from PIL import Image
def acq_color(device, num):
"""
:brief acquisition function of color device
:param device: device object[Device]
:param num: number of acquisition images[int]
"""
... |
94b84e4b220b1a1687526a622d875319f72cd92cbc6ed29b3cf5aa7fb4fcd620 | Python | 3,817 | 137 | import time
import random
from bayes_opt import BayesianOptimization
from bayes_opt.util import UtilityFunction
import asyncio
import threading
from colorama import Fore
try:
import json
import tornado.ioloop
import tornado.httpserver
from tornado.web import RequestHandler
import requests
except ... |
1652c3f37b9e5a5380f3c5709cf36fdd93323156f5637fc674bc467809892006 | Python | 3,818 | 86 |
# 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_nodenoise_UKB_5000_z-beh_'
opts = '_averaged-source_Schaefer400x17_nodenoise_UKB_3353_z-beh_'
#... |
369c6f41080115512542b1b4c0fe3802599cc449ed2c8d75aa3d40d0a152ac26 | Python | 3,818 | 139 | from __future__ import annotations
# built-in
import json
import math
from collections import defaultdict
from timeit import timeit
from typing import Iterable, Iterator, NamedTuple
# external
from tabulate import tabulate
# app
from .libraries import LIBRARIES_PATH, prototype
# python3 -m textdistance.benchmark
... |
029332005d34acadc17303a5fdb07f466d8d6059bd5f414ae5cfa5b7e0f7bfe5 | Python | 3,819 | 90 | import os, sys, json
import numpy as np
import pandas as pd
from tqdm.auto import tqdm
from ..model_options import *
from ..feature_tools import *
def count_parameters(model):
return sum(p.numel() for p in model.parameters() if p.requires_grad)
def get_model_metadata(model_option, convert_to_dataframe = True):
... |
10576d5cd5c9d8b883356709b76454eba195cadbbd71642a45f1317c326139e4 | Python | 3,819 | 90 | import torch
import torch.distributed as dist
import torch.nn as nn
import torch.nn.functional as F
from models.mlp import MLP
from utils.utils import FeatureExtractor, BackpropagatableFeatureExtractor, MultiModalGradCAM
from medcam import medcam
import sys
class MultiModalModel(nn.Module):
def __init__(
... |
41bc936b597e9fa24e50db34af57673d822122f175b90075f4cbf62e9dc4d369 | Python | 3,820 | 102 | import torch
from tqdm import tqdm
from base import BaseTrainer
from .tracker import MetricTracker
class DNN_Trainer(BaseTrainer):
'''
DNN Trainer
'''
def __init__(self, config, train_data_loader, valid_data_loader=None, test_data_loader=None):
'''
Initialize the DNN Trainer instance ... |
482842dc69c2fcc8287b39b53d9cb6c6d6f202817fbf73bc799d5faccdff3689 | Python | 3,820 | 141 | # Node group "Domain Switch Matrix" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# Shared by several assets, which import it; not an asset itself.
# _build_group() is the source of truth: the docstring, __init__ and accessors are reg... |
69b4397f258673f72fbaf8134b6c16459f1a4a2537601a9a861e77623e182c61 | Python | 3,820 | 79 | import os
import unittest
from hed.errors.exceptions import HedFileError
from hed.models import HedGroup, HedString, Sidecar, TabularInput
from hed.models.model_constants import TopTagReturnType
from hed.schema.hed_schema_io import load_schema_version
from hed.tools.analysis.event_manager import EventManager
from hed.... |
7e26a6a761d08df5b1b0c863f86168d617e867588e2a1615df5e5d05666749dd | Python | 3,820 | 57 | """RULE2_PREDICTS_IGNITION.py 2026-09-24. Pre-registration: 04-NOTES/PREREG-2026-09-24f-RULE2-PREDICTS-IGNITION.md"""
import sys, os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import numpy as np, pandas as pd, scipy.sparse as sp
from scipy.sparse.linalg import eigs
import SHIU783_SIM as S
R = 'D:/eu... |
e05226c0f2580e843c62778fe0ab81e7b97c5426b22550fc63c1f2de231eb5ae | Python | 3,820 | 139 | """ Train a machine learning model that predicts brain layers """
import pathlib
import click
from sklearn.model_selection import train_test_split
from layer_recognition.ml.utils import get_image_files, get_classes_and_features
from layer_recognition.ml.train_and_predict import train_and_evaluate_model
@click.comman... |
c896f1f6a0cb24c3589cf0b41f1820744976ca83de958d76a96bed74c66fe09e | Python | 3,821 | 108 | # regtools/tests/test_batch_2d_model.py
from regtools.registration.gui.batch_2d_model import BatchRow, BatchConfig
def _cfg():
return BatchConfig(
template_path="C:/data/template_25.nii.gz",
atlas="allen_ccf",
points_mode="per_image",
points_single_csv=None,
share... |
7188060027de7442762d03a382c5effdc0cc3d5ca1a0938eca6f9f7c2bb0ecfd | Python | 3,822 | 139 | import numpy as np
import scipy
from scipy.sparse import eye, issparse
import networkx as nx
from networkx.algorithms import community
def get_a_graph(X, method='cosine_similarity'):
"""
From a data matrix X, return an adjacency matrix A.
Parameters:
X -- np.array of shape [# samples, # featur... |
8c0b44765dbbdabb2c5b8f816381baff1e5293cbbd3dcaa64d475855db41aa90 | Python | 3,822 | 88 | from utils import set_random_seed
from utils.api.tcga_api import (download_file, download_files,
get_filters_result_from_case,
get_filters_result_from_file,
get_filters_result_from_project,
ge... |
140fbf915c016768e15dab9172d37f7b01d52b6e5bf9f8f4033cb3d531d0d0a9 | Python | 3,823 | 141 | """
requests.exceptions
~~~~~~~~~~~~~~~~~~~
This module contains the set of Requests' exceptions.
"""
from pip._vendor.urllib3.exceptions import HTTPError as BaseHTTPError
from .compat import JSONDecodeError as CompatJSONDecodeError
class RequestException(IOError):
"""There was an ambiguous exception that occur... |
ca4085e844cb404d207d58c4211b014729883385fdd42cbe0b2bc81a64f039bc | Python | 3,823 | 101 | import os
import shutil
import tempfile
import numpy as np
import pytest
from tests.mock_data import MockInputData
from cuppa.sample_data.cuppa_features import CuppaFeaturesDir, CuppaFeaturesLoader
class TestCuppaFeaturesPaths:
def test_can_find_files_in_dir_by_pattern(self):
match_files = CuppaFeature... |
5ec05f2a0818fce4c2129f05e158282920b1ad35e3a062f2653c00c2d130195e | Python | 3,824 | 110 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from lab.reports import Attribute, gm
from downward.reports.compare import CompareConfigsReport
from common_setup import IssueConfig, IssueExperiment
import os
def main(revisions=[]):
suite = suites.suite_optimal_with_ipc11()
config... |
62d3e09a3540975940ad2765c714e4949183682e3e28b36bae8159f879775f8f | Python | 3,824 | 134 | # helper utils for reading in data
import numpy as np
import os
# reads a list of filepaths, stores in list
def read_list(path):
collection = []
with open(path) as infile:
for line in infile:
newline = line.strip()
collection.append(newline)
return collection
# reads a l... |
700eaccd567dfce9a923633f269d5ec8cfbb89e35e3b73981d518865720b2474 | Python | 3,826 | 127 | # %%
import sys, os
sys.path.append(os.path.abspath(".."))
sys.path.append(os.path.abspath("."))
import torch
import torch.nn as nn
import torch.optim as optim
import prosper_nn.utils.generate_time_series_data as gtsd
import prosper_nn.utils.create_input_ecnn_hcnn as ci
import prosper_nn.utils.neuron_correlation_hid... |
5b7b0a6cd27709a24040e7025261f01b03292d8c5324b4bb470e1ea77455eff6 | Python | 3,827 | 105 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
dd0ef8e6f6f6f445d2f96e4e4b35158cb6a5df590db9c47ec9ce10cfb1013ea2 | Python | 3,827 | 98 | from collections import defaultdict
from ckg.graphdb_builder import builder_utils
#################################
# Clinical_variable - SNOMED-CT #
#################################
def parser(files, filters):
"""
Parses and extracts relevant data from SNOMED CT database files.
:param list files: list... |
53fff8708e975ce698902a2c31c9300f480f5327c9d5d83d16c3e397ce184154 | Python | 3,829 | 116 | import numpy as np
from scipy import ndimage
from skimage import measure
import numba
def relabel_segmentation(seg):
"""
Relabel contiguously a segmentation image, non-touching instances with same id will be relabeled differently.
To be noted that measure.label is different from ndimage.label
Example:... |
cfed5900684b523b85e7a32fef8dec4e32a1846495ffe346f45e60d2cef0bca2 | Python | 3,829 | 116 | 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.trainers import ClassifierTrainer, RegressorTrainer
class DummyClassificationDataset(Dataset):
def __init__(self, length: int = 105):
se... |
9e4cf52a81ceb5ca4653c7f3abe8b1dabef8b08253e5f104f17ac6685473a50b | Python | 3,833 | 128 | # -*- coding: utf-8 -*-
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.utils import to_categorical
from sklearn.preprocessing import LabelBinarizer
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
from imutils import paths
import matplotlib.pypl... |
6bfef66adfff49c9218e5eacff948373c41294b42dfa25a0b8fd81da4369505c | Python | 3,834 | 116 | # Node-group asset "Sample Position" (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... |
de8d5a22b1036f10a03ba973519a0edd488f752875f9cab0230d3c1c3fa385b5 | Python | 3,834 | 120 | """
Utility functions for tedana.selection
"""
import logging
import numpy as np
LGR = logging.getLogger("GENERAL")
RepLGR = logging.getLogger("REPORT")
RefLGR = logging.getLogger("REFERENCES")
def clean_dataframe(comptable):
"""
Reorder columns in component table so "rationale" and "classification" are
... |
30279ac0ddf1f76d22c56beb0606541951cf9945c842cef80134c89e32618c70 | Python | 3,835 | 122 | import json
import random
from collections import OrderedDict
from pathlib import Path
import dgl
import numpy
import torch
import yaml
from six import iteritems
def read_json(fname):
fname = Path(fname)
with fname.open('rt') as handle:
return json.load(handle, object_hook=OrderedDict)
def read_yam... |
7fcfbb0ed810e78eb9fbf702728080f8cd3c122920c01050d75321800273929a | Python | 3,835 | 98 | ##############################################################################################
# Testing if the evoked response across subjects is significant
##############################################################################################
import matplotlib.pyplot as plt
import mne
import numpy as np
imp... |
e46df7ce15e4c8bd5cab61d25a8d6d5d1ce6baf0ccbc076478b8bdf4d2b3514b | Python | 3,835 | 121 | from collections.abc import Sequence
from itertools import chain
from elasticai.creator import graph as gr
from elasticai.creator import ir
from elasticai.creator.ir2vhdl import DataGraph, type_handler
from .combinatorial import (
build_data_signal_connections_for_combinatorial,
build_declarations_for_combina... |
04ee070075e47e7ed2edcd917b2799796958af97ed173763278e0648df4f85b0 | Python | 3,836 | 53 | """CONVENTION_AUDIT.py 2026-09-30. Pre-registration: 04-NOTES/PREREG-2026-09-30r-CONVENTION-AUDIT.md
Four published sign conventions (Shiu, Pospisil, Lin, FlyGM) applied to FlyWire's nt_type calls inside Shiu et al.'s model
(antennal-lobe cut-out of their v783 file): excitatory share of local-neuron output, and health ... |
8e85fca37c01b57a4516ed10a947f71cbb4f327d4ebde26712946848f0a76483 | Python | 3,836 | 61 | """SFF_PAIRS.py 2026-09-28. Pre-registration: 04-NOTES/PREREG-2026-09-28e-SFF-PAIRS.md
From the best end point of SFF_SEARCH (S1), steepest descent over single flips plus pair flips among the 20 largest LN types.
usage: python SFF_PAIRS.py [run|analyse] (workers: SFF_WORKERS, default 10)"""
import sys, os, hashlib... |
4c02aab7fc4eeabefb04a99a8a0d8ebfbb444e8663fafe4fbe968679d8b44cff | Python | 3,837 | 112 | import copy
import warnings
from collections.abc import Collection, Iterable, Iterator, Mapping, Set
from typing import Any, Hashable, Self, TypeVar, cast
from .graph import Graph
T = TypeVar("T", bound=Hashable) # noqa: F821
# we have to keep this bound to T, until we move to python 3.13 with default type argumen... |
7c1bdf17fe9944f67f817a6de7ec7e13db45ceb69e359e801143e06f30c8eb57 | Python | 3,837 | 94 | # SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL
#
# SPDX-License-Identifier: AGPL-3.0-or-later
'''
Compute reliability of connectomes with added connections
Author(s): Daniela Egas S.
Last update: 12.2023
'''
import numpy as np
import sys
sys.path.append('/gpfs/bbp.cscs.ch/home/egassant/reliability_and_st... |
44f81a9b2a48955bd38db49600ba2ac19b464b3a226b356ee71087a199b6f6a8 | Python | 3,838 | 67 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, BaselSlurmEnvironment
from lab.reports import Attribute, geometric_mean
from common_setup import IssueConfig, IssueExperiment, DEFAULT_OPTIMAL_SUITE, is_test_run
BENCHMARKS_DIR=os.path.expanduser('~/repos/downwar... |
9f34a4e7f03c1a8c190591ddd56151752cc4ab5b9844e83f29fa104fd93d1b36 | Python | 3,838 | 75 | # Librairies
import os
import sys
code_path = os.path.split(os.path.split(os.getcwd())[0])[0]
sys.path.append(code_path)
import argparse
import numpy as np
from setting import *
# Arguments
argParser = argparse.ArgumentParser()
argParser.add_argument("-n", "--name", type=str, help="Dataset name")
argParser.add_argume... |
d98358e47fc1fedde6c21d36339074f3dc976a6ad1ad20710667eff2938050e2 | Python | 3,839 | 142 | # A data types modules
import numpy as np
_SI_MAX_ = 9223372036854775807
_FP_MAX_ = 1.7976931348623157e308
#-------------------------------------------------------------------------------
def Type(x):
y = type(x)
if y == np.float64:
return float
elif y == np.int64:
return int
elif y == np.bool_:
... |
2c96c29de8d730486f3f52da9107bf1d906f7e04a3865c3747885950c827ff1e | Python | 3,840 | 92 | from monai.transforms import Transform
from torch.nn.functional import grid_sample
import torch
import numpy as np
class GetStartEndPoints(Transform):
"""
Return the start- and endpoints of each artery in the CoW as a dictionary
"""
def __init__(self, BoI_key):
self.cow_dict = {'AcoA': (0, 1), ... |
5612fc1c842772cc9b35740939a5f4b04c61e4279ceb81292f2f0c699025f443 | Python | 3,840 | 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... |
2fb422342e3a641db995d85f54bbdb79208275e96aaa2bca027a3bdc3a556ff1 | Python | 3,842 | 106 | import torch
import scipy
import numpy as np
import pandas as pd
from typing import ClassVar
from torch.utils.data import Dataset
from .utils import Seq2Tensor
class SeqDatasetProb(Dataset):
POINTS: ClassVar[np.ndarray] = np.array([-np.inf, *range(1, 18, 1), np.inf])
""" Sequence dataset. """
... |
612e0a5c5f7df4527a88b9fd58979295fc40bfebca49f05afca448bbce473f0a | Python | 3,843 | 53 | """THEORY_BOX.py 2026-10-08. Post hoc, illustrative (not a test): why the edge of the fly-like region does not move with
background drive (REST_STATE R3, where my pre-registered bet that it would move failed).
Toy antennal lobe: G glomeruli, one threshold-linear projection-neuron unit each (rate capped at r_max); one... |
a0cd9cfda7e84722180fa1dea697d5beb88f909d1865cd84a5ddd9870e95f49a | Python | 3,844 | 109 | """Ordinal Metric Learning loss module.
Copyright (c) 2024 University of Michigan. All rights reserved.
Licensed under the MIT License. See LICENSE for license information.
"""
import torch
import torch.nn as nn
import numpy as np
from typing import Optional
cat_data = lambda x: torch.cat([x[0], x[1]], dim=0)
cat_l... |
1020e2d11c23085ad903387649801383bce9e9566130441ec59ebf1f69d25a04 | Python | 3,845 | 131 | from typing import Iterable, Iterator
from elasticai.creator_plugins.grouped_filter import FilterParameters
def find_channel_sizes_from_g1_to_g2(g1, g2, max_fan_in, w2) -> set[int]:
sc_set = set()
sc = g1
while (sc // g2) * w2 <= max_fan_in:
if sc % g2 == 0:
sc_set.add(sc)
sc ... |
531da2c7ca6b14558ae646563d8a790b5afc10a4609d97a88e071e6485112a6c | Python | 3,846 | 133 | # Node-group asset "Visualize Points" (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... |
b563f43cc31b87788ef524d859df403da159a855eedc2b25123b1beba60ea41d | Python | 3,846 | 117 | import tracemalloc
import unittest
from memory_profiler import LineProfiler, profile, show_results
from io import StringIO
class TestIncrementDisplay(unittest.TestCase):
"""Tests memory incrementation / decrementation display"""
def setUp(self):
tracemalloc.start()
def tearDown(self):
t... |
cb94adabea3cae323f4bd17460aac82c322e8351d1e9e12540608d4146109d09 | Python | 3,846 | 109 | ################################################################################
# Copyright (c) 2021-2024, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
# Written by D. Jones <djones@llnl.gov> and UCSD collaborators in listed in CONTRIB.md
#
# All rights reserved.... |
3c2ed06472001e320062324a31f05517d29b0ef6a5231489918d56c32f170892 | Python | 3,847 | 132 | import sys
import random
import os
import argparse
import sys
import pwd
import time
import subprocess
import re
import shutil
from sklearn import metrics
import re
from sklearn.metrics import roc_curve,roc_auc_score
import numpy as np
import glob
from numpy import sqrt
import logging
import io
import tensorflow as tf
... |
044e8973ff98b22b1711a9ca9ca8533a4e772b1ee7962a99cd260c1f1df0171b | Python | 3,848 | 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,... |
2427c431e518e87fd261183b6501f7b1fd4b282b12ff6ef5c95fed4b631e42f0 | Python | 3,848 | 96 | from collections.abc import Sequence
import torch
from torch import nn
from torch.nn import functional as F
from torchdrug import core, layers
from torchdrug.core import Registry as R
@R.register("models.NeuralFP")
class NeuralFingerprint(nn.Module, core.Configurable):
"""
Neural Fingerprints from `Convolut... |
d97812c444e1e08cfc2fb5ac7701ad6357e56f60c5fe0327809b8518a63bfc6d | Python | 3,848 | 110 | from pathlib import Path
from helpers import load_config, cluster_signal, find_peak, mean_amplitude_around_peak
import pandas as pd
import numpy as np
import mne
mne.set_log_level('ERROR')
if __name__ == '__main__':
# Load configuration
config = load_config('evoked_config.yaml')
no_participants = config... |
abe62efe716b2687a6261e21f2298e3ce4a109433f6e71fbcb331a74b2a48f77 | Python | 3,850 | 77 | import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
import numpy as np
import networkx as nx
import feature_embedding
import argparse
import random
import PDB2Graph
parser = argparse.ArgumentParser(description="create graph library for GNN training")
parser.add_argument('-d','--dataset', required=True, help='the prot... |
c35b60fb11bec143c299a744539bb3b7c492d9682fe17e21d44f3477effb4589 | Python | 3,850 | 99 | # -*- coding: utf-8 -*-
#
# Utilities for syncopy's synthetic data generators
#
# Builtin/3rd party package imports
from inspect import signature
import numpy as np
import functools
from syncopy import AnalogData
from syncopy.shared.parsers import scalar_parser
from syncopy.shared.kwarg_decorators import (
unwrap... |
156bb873bc0524ddd4ae6688c5d9583d2a9fa5eadfa28963b1eb10bc50ee1435 | Python | 3,851 | 125 | # Manuel A. Morales (mmoraleq@bidmc.harvard.edu)
# Beth Israel Deaconess Medical Center
# Harvard Medical School
import os
import glob
from typing import Tuple
import torch
import torch.utils.data as data
import torchvision.transforms
from torch import Tensor
from Config import *
import numpy as np
import pandas as ... |
f2a41442965d24a134937875d7677bc66177052e85e3a0d28a03cc0d6c0af6c1 | Python | 3,852 | 112 | """Utilities to determine interface information for PDB files."""
from eudockscore.utils.pdb import (
load_pdb_file,
get_ca_coords,
get_chain_ids,
get_sparse_matrix,
)
from Bio import PDB
import numpy as np
import torch
import logging
import warnings
logging.disable(logging.WARNING)
warnings.filterwarn... |
1afbdad7fdc6a8c59af56b8f0ac4fcbb80ccb4a71cf1bbd8fd0f4270e2d37ab5 | Python | 3,853 | 114 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
547de82e700e3687db34197f7df47b393d1c808fd22f8bc06f6c76872567fd0c | Python | 3,853 | 103 | # This script generates multiple collections of orientation-sensitive neurons and computes the distance matrices
import sys
sys.path.insert(0, '../')
import numpy as np
import itertools
import h5py
from simulations import *
import pickle
from compute_similarity_multiprocessing import *
def compute_true_firing_rate... |
6e987d5c22853134347febdaa7c1ac34f26a7b0ed7097b417c84047831dac017 | Python | 3,853 | 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... |
7d90a7d76efdee2f4260b53170be5bb3e1a8a0d62cd61556fe86705b33086a84 | Python | 3,853 | 85 | import numpy as np
from ..utils.misc import slice_same
from ..matao.matao import PairsInfo, pairs_to_indices, indices_to_pairs, MatAO
from ..matao.findpairs import pairs_within_cutoff
def calc_vkb(olp_proj_ao, Dij, spinful=False):
'''
Construct VKB in atomic orbital basis according to the formula:
<ia| Vk... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.