sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
7e15dd89f4621244053efcea63ed6847a21e00ad558e9178651c97f108a6e739 | Python | 4,678 | 151 | import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
from libs.layers import GraphConvolution
from libs.layers import GraphIsomorphism
from libs.layers import GraphIsomorphismEdge
from libs.layers import GraphAttention
from libs.layers import PMALayer
class MyModel(nn.Module):
def __ini... |
d3c98a61cdd0ede896939457a2e30e70c0f780bfa32f826f5fd6bcf60d514da8 | Python | 4,679 | 83 | """
BUILD_RELEASE_TABLE_V11.py - written 2026-09-22. Builds v1.1 of the Zenodo table LOCALLY.
Nothing is published by this script. Publishing a new version is a human action.
Fixes two defects in v1.0 (DOI 10.5281/zenodo.22795740):
1. THE JOIN KEY. v1.0's column `root_id` is documented as "materialisation 783... |
169f10baf795925fe4fcca572273e596235ac6546e77a17b01e28f3df75b2a1c | Python | 4,680 | 79 | import sys
fn=sys.argv[1]
dfh=open(fn,'r')
rfh=open('./'+fn.split('/')[-1]+'_2_contacts.txt','w')
stat_rfh=open('./'+fn.split('/')[-1]+'_2_contacts.stats.txt','w')
dfh.readline()
def foo(x, y):
return 0 if y == 0 else x / y
non_split_all=0
non_split_mapped_both=0
non_split_mapped_only=0
non_split_match=0
Total_A... |
5fe7a89e1db0f1c30baf3d2d8fb854247fa5a14ec1d042540c1f9b190f2312d1 | Python | 4,680 | 100 | from typing import Optional, Union, List
from segmentation_models_pytorch.encoders import get_encoder
from segmentation_models_pytorch.base import (
SegmentationModel,
SegmentationHead,
ClassificationHead,
)
from .decoder import UnetDecoder
class Unet(SegmentationModel):
"""Unet_ is a fully convoluti... |
8907749fca545e7ea6c8a11992ad243f601f58b33b79319ce7ef47fdcb6ba921 | Python | 4,680 | 143 | """Classes representing HED search results and tokens."""
class SearchResult:
"""Holder for and manipulation of search results.
Represents a query match result consisting of:
- group: The containing HedGroup where matches were found.
- children: The specific matched elements (tags/groups) within tha... |
692a976cd663f5555c880bea8fc5750e4a3ad8c97001ccc998352ef79ae9501a | Python | 4,683 | 146 | from __future__ import annotations
import json
from typing import Any
from wikibaseintegrator.models.basemodel import BaseModel
from wikibaseintegrator.models.claims import Claims
from wikibaseintegrator.models.language_values import LanguageValues
class Forms(BaseModel):
def __init__(self) -> None:
... |
9ad207f011f4401d095e985e9edfe9f68ed82e7218cbd6365710e1dea51c0cb2 | Python | 4,683 | 137 | from itertools import chain
from typing import Iterator
from .filter_params import FilterParameters
from .iterator_utils import batched
from .tensor import reshape_flat_CxN_groupwise
def channelwise_interleaved(length, channels):
size_per_channel = length // channels
indices_per_channel = batched(tuple(range... |
ae0eab0cbdc3b86ab586b003254e00f6a4755e8472a4ddc42d7d0996dc2f97a6 | Python | 4,683 | 128 | """The config-menu Install action polls the download subprocess and refreshes the
card when it finishes - previously it fire-and-forgot, so the card kept showing
'missing' until a manual Refresh."""
import os
import pytest
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
@pytest.fixture(scope="modu... |
feff38c5e031f7107b604da348bb194430fbe5f6332ac859309947ec38a13b5f | Python | 4,684 | 108 | # By Shuran Liu, 2023
import argparse
import yaml
import os
from tqdm import tqdm
import torch.nn.functional as F
import warnings
import math
from torch.utils.tensorboard import SummaryWriter
warnings.filterwarnings("ignore")
parser = argparse.ArgumentParser(description='Input a config file.')
parser.add_argument('--c... |
18efdab91f19bae6e1cff03b0d507dc61897696886f6f4aa441616a84f4cde71 | Python | 4,685 | 121 | # 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... |
22cb0725266ba7ffd0d82380fd23bc5f060957840f677ec30921f764b4c26072 | Python | 4,686 | 136 | """
Generates plot with histogram showing burst_quality metric.
The histogram has three bars containing how many "Default", "Predict", or "Equal" bursts are classified as optimal,
using the the output from 'GUI.py', stored in "GUI/".
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def ... |
a81ca34ef9c421b4c4a24d37d8f61b55fc4308bb8f2fd0106eada5a6c80ee16d | Python | 4,686 | 167 | import numpy as np
import math
from scipy.spatial.distance import cdist
def eucl_dist(x, y):
"""
Usage
-----
L2-norm between point x and y
Parameters
----------
param x : numpy_array
param y : numpy_array
Returns
-------
dist : float
L2-norm between x and y
... |
49dbd6bbe5954bda11ec6fffe96ac2337ebc6f71bde176f697054f002f1c901f | Python | 4,687 | 119 | import os
import pandas as pd
import scanpy as sc
import numpy as np
from scipy.sparse import csr_matrix, vstack, issparse
from sklearn.utils import resample
from sklearn import random
import time
from tqdm import tqdm
import argparse
pd.options.mode.chained_assignment = None # default='warn'
seed = 43
np.random... |
64d1448b7ab09a35344640f74b2bfe802a908284b5e0ca8fa5a8d3d0766fc0a7 | Python | 4,687 | 135 | # -*- coding: utf-8 -*-
from __future__ import annotations
import torch
import torch.nn as nn
class GraphConvolutionalNetwork(nn.Module):
r"""
Multiple GCN layers with layer normalization and residual connections, each executing the operator
from the `"Semi-supervised Classification with Graph Convoluti... |
d426cea4dd02ea3de9d769b6f3f08eecee1e0e41c045f541049d791a22d2a666 | Python | 4,687 | 126 | # 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... |
882664b8be90a69f81c090a4f201e1743951548fbd08f80bb0474a0d240616fe | Python | 4,688 | 148 | import pickle
import numpy as np
import argparse
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import sys
sys.path.append("..")
from KGDNet_Model import KGDNet
from util import ddi_score, eval, test
from dataloader import get_ehr_data
resume_path = ''
parser = argpa... |
409b108b4776b1e0023c53e3acb3fb6fd378c07f6325274f68bd2d0ff0c86555 | Python | 4,690 | 126 | # -*- coding: utf-8 -*-
#
# downward uses the lab package to conduct experiments with the
# Fast Downward planning system.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of t... |
b8167d5104074eefb0cff82b1d0a67ca9a80e2c8d3e37c1dafd4ce3f9cd3ca15 | Python | 4,690 | 129 | """Schema lookup table for ancestor-aware string search.
Generates a compact mapping from every tag's casefolded short name to its
full ``tag_terms`` tuple (all slash-path components from root to self), which
is the same information stored in :attr:`~hed.schema.HedTagEntry.tag_terms` after
schema loading.
This lookup... |
258452176caaa46e571a0fe3193a526792c6a129f31d254b7c42c845c43bdfc3 | Python | 4,693 | 127 | #
# 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,... |
25fb4c96d36ef5d0f330d202b198fc64374f2e4e9504e19c37f0e1c6f81482b5 | Python | 4,694 | 110 | import random
import math
import numpy as np
from itertools import count
from pydrake.multibody.multibody_tree import WeldJoint
from examples.drake.utils import create_transform, get_model_bodies, set_joint_positions, get_movable_joints
def weld_gripper(mbp, robot_index, gripper_index):
X_EeGripper = create_tra... |
37bf10262522e9695ea4a4385d895fa7cb6b258776cd4abdc6dd49022d42e216 | Python | 4,696 | 108 | import matplotlib.pyplot as plt
# same BBSVI function!
from black_box_svi import black_box_variational_inference
import autograd.numpy as np
from autograd.misc.optimizers import adam, sgd
from autograd.scipy.stats import norm
if __name__ == "__main__":
# Specify an inference problem by its unnormalized log-densi... |
d1681dde27ca39c5f2b9f84b365ebdfed0ba261185951b1c916830b111d970f1 | Python | 4,697 | 142 | import glob
import json
import os.path
from loguru import logger
from ord_schema.message_helpers import load_message
from ord_schema.proto import dataset_pb2
from tqdm import tqdm
from ord.data.data_reaction import ReactionDataError, ReactionData
from ord.utils import json_load, json_dump
"""
use this to export data... |
8045348564f45b3bb628f97e767b18442bb9107cf40b79e3d8d18651d74d5087 | Python | 4,700 | 162 | import matplotlib.pyplot as plt
import numpy as np
import PyMieScatt as ps
import meep as mp
r = 1.0 # radius of sphere
frq_cen = 1.0
resolution = 20 # pixels/um
dpml = 0.5
dair = 1.5 # at least 0.5/frq_cen padding between source and near-field monitor
pml_layers = [mp.PML(thickness=dpml)]
s ... |
87a054aef936ad1bc517c2c901b3ea2e534b717fc02b05e0fdb09abe611a7dbc | Python | 4,701 | 129 | import torch
from torch import nn
from torch.nn import functional as F
from elasticai.creator.nn.integer.avgpooling1d.design import (
AVGPooling1d as AVGPooling1dDesign,
)
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.math_operations import Mat... |
10d0178e4522c1b2fc4d684d63e16870eb33b060a84d48afbe2991dd61a9b61f | Python | 4,702 | 135 | # 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... |
4f751026d6af7cdc3ee1d652092cb65dfda14cd49c5c559f8aed3e1711b0cab6 | Python | 4,702 | 128 | import numpy as np
from .utils import get_parameters
from .parameters import sigma_ou
from .plot_utils import plot_means_and_stds
from .ou_bridge import generate_learning_windows
def gen_stdp_rule(params={}):
"""
Generate the STDP rule specified in params.
"""
stdp_type, stdp_amplitude, sigma, tau_m,... |
4993147b15a4af17e40d10049ba7d91d586442f99db691099d6516d892632d55 | Python | 4,703 | 101 | import json
import pytest
import NDATools
from NDATools.upload.cli import ValidatedFile, ValidationError
from NDATools.upload.validation.api import ValidationV2, ValidationV2Credentials, ManifestError
@pytest.fixture
def v2_creds():
res = {
'access_key_id': 'AWSAKIDASLDASDASD',
'secret_access_ke... |
a5209c20a5110e419be8900ab1cf9c76f9ef9c026560f93ea77bef38df4cdc36 | Python | 4,704 | 119 | import logging
from collections import OrderedDict
from typing import Dict, List
from pip._vendor.packaging.specifiers import LegacySpecifier
from pip._vendor.packaging.utils import canonicalize_name
from pip._vendor.packaging.version import LegacyVersion
from pip._internal.req.req_install import InstallRequirement
f... |
30d71f4247a2d374de730b674c8204bb2ab08735d67256d8adae2622295dcd98 | Python | 4,707 | 104 |
import numpy as npy
import pandas as pd
DMN=['l PCC', 'r PCC', 'l prec', 'r prec', 'l par', 'r par', 'l ITG', 'r ITG', 'l parahip', 'r parahip', 'l SFG', 'r SFG', 'ant med PFC', 'vent med PFC' ]
pDMN=['l PCC', 'r PCC', 'l prec', 'r prec', 'l par', 'r par', 'l ITG', 'r ITG', 'l parahip', 'r parahip']
aDMN=[ 'l SFG', '... |
670db179d36b5456f20ab118eae908685dde5b5f653ab90472943950c7b8ab20 | Python | 4,707 | 129 | #
# Testing module for non-user exposed functionality in ACME
#
# Copyright © 2020-2025 Ernst Strüngmann Institute (ESI) for Neuroscience
# in Cooperation with Max Planck Society
# Copyright © 2026 Ernst Strüngmann Institute (ESI) of the Max Planck Society
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Builtin/3rd part... |
9691cdf2dd947a3b8568b42c74ee29e11f9866e148ca3d34b7e8ce75864d14c1 | Python | 4,708 | 100 | from typing import Optional, Union, List
from segmentation_models_pytorch.encoders import get_encoder
from segmentation_models_pytorch.base import (
SegmentationModel,
SegmentationHead,
ClassificationHead,
)
from .decoder import UnetPlusPlusDecoder
class UnetPlusPlus(SegmentationModel):
"""Unet++ is ... |
c7c29ee7d65efe7642d698aad30abf73117569a4a0d6a8823636249a1e94d709 | Python | 4,708 | 152 | """ Stability-related functions for osNMF"""
""" Drawn from Yu Group's implementation of sklearn_NMF """
""" Source: https://github.com/Yu-Group/staNMF/blob/master/staNMF/nmf_models/sklearn_nmf.py """
# define find correlation function
def findcorrelation(_A, _B):
'''
Construct k by k matrix of Pearson produc... |
325be27020fd67b8b909b49690e23ea3d501c061ace9ed09489f3ed9172af3ed | Python | 4,709 | 132 | #!/usr/bin/env python
"""
Setup script for oxasl
"""
import os
import subprocess
import re
import io
from setuptools import setup
from setuptools import find_packages
MODULE = 'oxasl'
def get_filetext(rootdir, filename):
""" Get the text of a local file """
with io.open(os.path.join(rootdir, filename), encod... |
849dc4096e12f216df851b3bbb181befb7bfdcd70362aa19c1e6c769f84926df | Python | 4,709 | 99 | """
Script to evaluate the confusion matrix based on prediction made by the classifiers.
"""
from itertools import chain
import numpy as np
import pandas as pd
from tabulate import tabulate
def pandas_to_latex(df: pd.DataFrame, n_digits: int = 4):
table = ""
for idx, row in df.iterrows():
neg_samples_... |
5a3b437220cd6439c3b5d8c359547cd3773cb5c8c1d0ae055bc5b3d69addd6e7 | Python | 4,710 | 107 | import os
import torch
import numpy as np
import matplotlib.pyplot as plt
from src.common import get_camera_from_tensor
class Visualizer(object):
"""
Visualize intermediate results, render out depth, color and depth uncertainty images.
It can be called per iteration, which is good for debugging (to see ho... |
93aed88a01f4218f36a88d4e6f34d37108862edb76cb7b1f4dc692b6f3510e06 | Python | 4,711 | 110 | import unittest
from unittest.mock import patch
import numpy as np
import torch
from scipy.linalg import sqrtm
from torch import nn
from torcheeg.trainers.generative.utils import FrechetInceptionDistance
class EEGFeatureExtractor(nn.Module):
def __init__(self):
super().__init__()
self.calls = 0
... |
fe8d3d15368419f215ac30c44210d064642614503f3a9a833c47a70b87dbe0af | Python | 4,711 | 106 | from __future__ import division, print_function
from torch.autograd import Variable
from memristor_model import *
from gaussian import gaussian
# %%
class BBP_Model(nn.Module):
def __init__(self, layer_size, N_train, no_sample=None, Exp=None):
super(BBP_Model, self).__init__()
input_dim = ... |
be71ee71420c159ed85968ead3bdc0063bacdd58dc44dc922c40abaecf55fffe | Python | 4,713 | 162 | # Node-group asset "Peptide Chi" (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
f... |
f0ab261f361cc56d643c51c2b3586487994878598143a4e4686584fb697cad44 | Python | 4,713 | 129 | from pathlib import Path
import numpy as np
from biotite import InvalidFileError
from biotite import structure as struc
from biotite.structure.io import pdbx
from ...utils import array_transforms_from_dict
from ..molecule.pdbx import PDBXReader
# For reading cellpack files, we override the CIFFile from biotite. The o... |
d0ecd51cd6e799e4d2daddb774e47a1efcb3e0ba77b4aaa0df5f4c59c378397f | Python | 4,715 | 149 | """Plot decoding times."""
from __future__ import annotations
import csv
from enum import Enum
from pathlib import Path
import numpy as np
import pandas as pd
import pte_decode
import scipy.stats
import motor_intention.plotting_settings
import motor_intention.project_constants as constants
import motor_intention.sta... |
f8615b8042420fef5ae2388c2ecfbd2f0dfb75842ea36919018f36e226141696 | Python | 4,715 | 151 | ##
# \file propagate_mask.py
# \brief Script to propagate an image mask using rigid registration
#
# \author Michael Ebner (michael.ebner@kcl.ac.uk)
# \date Aug 2019
#
import os
import numpy as np
import SimpleITK as sitk
import pysitk.python_helper as ph
import pysitk.simple_itk_helper as sitkh
impor... |
470c6457c0f9ca632b33226096c2711525a0dd81da1fdc8e5f2386373c6426d5 | Python | 4,716 | 142 | import numpy as np
import pandas as pd
from seq2exp import tools
import torch
from torch.utils.data import TensorDataset, DataLoader, random_split
# TODO add 10 fold cross validation
def load_data(
file_path,
split_ratio=0.8,
batch_size=256,
shuffle=True,
num_workers=12,
sample_rate=1,
le... |
8e3bf96815e25c193eba0bbde5ec2ec90938c9f3542739a860aade229bb00f45 | Python | 4,716 | 116 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 11 09:45:43 2019
@author: hannekevandijk
copyright: Research Institute Brainclinics, Brainclinics Foundation, Nijmegen, the Netherlands
"""
from TD_BRAIN_code.autopreprocessing import dataset as ds
from TD_BRAIN_code.inout import FilepathFinder a... |
c18d357f14b8a0d49034402fb2c62e2e3764f61f1a2cc951e4d6b3875f4211a8 | Python | 4,716 | 128 | #
# 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,... |
df98a459bc54e5b14e4d9611924a0d441587f0887cae325db3037e4fb8e33a4f | Python | 4,716 | 109 | from PyQt5.QtGui import QFont
from PyQt5.QtWidgets import QDialog, QGridLayout, QLabel, QHBoxLayout, QSpinBox, \
QCheckBox, QComboBox, QPushButton
from PyQt5 import QtCore, QtWidgets
from src.gan_settings import GanSettings
class GanPipelineSettingsDialog(QDialog):
def __init__(self, parent=None,apply_flag=False... |
3ccc8a0f5da5dbbf5d1ff53dc3003de705941599b1feb665587072391bad4bc5 | Python | 4,717 | 108 | # By Shuran Liu, 2023
import argparse
import yaml
import os
from tqdm import tqdm
import torch.nn.functional as F
import warnings
import math
from torch.utils.tensorboard import SummaryWriter
warnings.filterwarnings("ignore")
parser = argparse.ArgumentParser(description='Input a config file.')
parser.add_argument('--c... |
0b00c045c4142bf7166aa5ed89fca3343f83ceebb6673a10ef58c6399c9c78ac | Python | 4,720 | 112 | import numpy as np
import io_mesh as io
import subprocess
import argparse
import os
import copy
def calculate_area(surfname,fwhm, software="CIVET", subject="fsid",surf="pial",hemi="lh"):
"""calculate and smooth surface area using CIVET or freesurfer"""
tmpdir='/tmp/' + str(np.random.randint(1000))
os.mkdir... |
b2a582a65d4c0bf298314a4107a3620048434accf81df60a25eeca4a143e5e69 | Python | 4,721 | 49 | """posthoc_v2ln30_witnesses_2026-10-02.py (descriptive). Everything the data say about the two v2LN30 besides the model:
lineage, the classifier's votes in two flies (FlyWire and BANC), and their wiring against the rest of their lineage.
Output: 06-OUTPUT/posthoc_v2ln30_witnesses.txt"""
import sys
sys.path.insert(0... |
1dd7c9c9b554511b920128ff6457d49dc0927bea4ea786aa3461e89ef93844a9 | Python | 4,722 | 96 | from ..main_analysis import *
def make_rs_dataframe(rs):
rs = pd.DataFrame(rs)
rs.columns = ['X' + str(col) for col in rs.columns]
return rs
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Intermodel RSA Script')
parser.add_argument('--model_string', required=True, type=st... |
186e41eba53313571d3547346fcecf12a2ee3832255d1e071bc4e2aa1aa878f8 | Python | 4,723 | 152 | # Node-group asset "Peptide Dihedral" (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... |
efd860b265620741585af459bf0c4e733069fb5a2ab59ea91e116d46381b4f7d | Python | 4,725 | 122 | """Unit tests for regtools.cellpose_sam.gpu_mem.
The module is loaded by file path so the test exercises *this* worktree's copy
regardless of where the editable install resolves ``regtools`` to. gpu_mem has no
intra-package imports (torch/gc are imported lazily inside the functions), so a
standalone load is faith... |
3c113f84f09431ac3211a5217c3153a23f631606d7802b7bac055ecdd70f4cc5 | Python | 4,726 | 107 | """
EC codebase Python library (AKA the "frontend")
Module mapping details:
TODO: remove module mapping code when backwards-compatibility is no longer required.
The below module mapping is required for backwards-compatibility with old pickle files
generated from before the EC codebase refactor. New files added to th... |
a5e62b5dfbed3f071ad18b8a0e2a19019d129ef16cdd7b432bd9aa8828ea0425 | Python | 4,726 | 139 | """
Script for reconstructing a surface from a segmented membrane
Input: - Original tomogram with the segmentation (0-fg, otherwise-bg)
Output: - vtkPolyData with the surface
- vtkPolyData with the cloud of points (optional)
- tomogram with the signed distance (optional)
"""
__... |
31cd06e00e47bfd3bec6a87c2870769e1fd4ef27d99184f5e2098de026a339fb | Python | 4,727 | 187 | import argparse
import numpy as np
import meep as mp
def main(args):
if args.perpendicular:
src_cmpt = mp.Hz
fcen = 0.21 # pulse center frequency
else:
src_cmpt = mp.Ez
fcen = 0.17 # pulse center frequency
n = 3.4 # index of waveguide
w = 1 # ring width
r = 1... |
f6baf462a8ca95119962c0c1efceefc63f322dbad46482e3107761c3f0bc7a47 | Python | 4,727 | 139 | # ----------------------------------------------------------------------
# Copyright (C) 2016, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/or mo... |
0573ed996805afba9837d44bb3704d78d9b2c07fd3507658d83c4ecc4d98eb2f | Python | 4,728 | 141 | ##
# \file SegmentationPropagation.py
# \brief { item_description }
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date May 2017
#
# Import libraries
import sys
import itk
import SimpleITK as sitk
import numpy as np
import pysitk.simple_itk_helper as sitkh
import pysitk.python_helper as ph
... |
5c8696d06a0361e344649180dc9e764e596bcae749a8546046d2b4bf8ad95d56 | Python | 4,729 | 145 | # Node-group asset "Lag Geometry" (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
... |
a7e688aef7239f03a60e461e41cb17855d86e9840195fc04352239c0b0a7a38e | Python | 4,729 | 132 | # Node-group asset "Split to Centred Instances" (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 ... |
b447ea44c9444e8d5644ccdf9ffa673a373f303fcdb68af919449dc47d4e53f7 | Python | 4,729 | 121 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
123e582c890fa7c38a44eff37156391d10bb6d2b4db1590eaccf18fc54c752fe | Python | 4,730 | 121 | """Best-effort startup health check for known-bad install states (issue #127).
A stale install is a real, invisible failure mode here: a lab-drive copy of
``regtools`` left on ``sys.path`` (or an editable install pointing at old code)
silently shadows the checkout the user thinks they are running, so already-fixed... |
46ca09c53020bf79a14fe9c57701bd9b2c4146600de640e4db8fb3bbb3a2e0e1 | Python | 4,730 | 140 | # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
... |
6b40af3250c9560fb920b233fefab5c978485dffb84e5e3e2d35ee7ef2603dd8 | Python | 4,730 | 110 | """
Created on Sun Dec 26 19:38:25 2021
@author: Haotian Teng
"""
import os
import sys
import torch
import argparse
from functools import partial
from xron.xron_model import CONFIG,DECODER_CONFIG,CRITIC_CONFIG,MM_CONFIG
from xron.xron_train_supervised import main as supervised_train
from xron.xron_train_variational im... |
b53d94a1bc520cf73bd13a3b70f829a66cc6fa23f6ce5a877488ff50c8b0e0be | Python | 4,730 | 99 | """ Authored by: Neel Kanwal (neel.kanwal0@gmail.com)"""
# This file provides confusion matrix for ensemble of binary models for better comparisons.
import pandas as pd
import os
import seaborn as sns
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as plt
import numpy as np
from utils ... |
28d208295d0003ffb6d528c5c204e883ee92e09add415aafe43e6378493b6e22 | Python | 4,732 | 150 | import string
from itertools import cycle
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from matplotlib_scalebar.scalebar import ScaleBar
import matplotlib_scalebar
import scipy.interpolate
def transect(pts, ppf, paui, duri, grid=True):
if grid:
... |
5037c28879b2cd3f38d39d64eb7a4c02a95f5755aa1987bb986c6675df4e2a39 | Python | 4,732 | 156 | import os
import numpy as np
import logging
import wandb
import torch
import torch_geometric
from torch_geometric.utils import to_dense_adj, to_dense_batch
class CheckpointSaver:
def __init__(self, dirpath, decreasing=True, top_n=5, save_every=False, not_save=False):
"""
dirpath: Directory path w... |
59cd501089c6981dea92e3305900c6ad566a5d3da7ee05155b0aa023c1a37066 | Python | 4,732 | 123 | import torch
import numpy as np
from engine_set_preprocessing_1 import CmaPss
from engine_set_preprocessing_2 import NCmaPss
class Dataloader(object):
def __init__(self, train_samples, train_labels, batch_size: int, train_mode: bool):
self.train_x = train_samples
self.train_y = train_labe... |
af80b0f91296ac8454c2cbee33c2868a3d264de3dba6c8e26da6274f970ed37a | Python | 4,732 | 158 | import argparse
import time
import gc
import numpy
import theano
import theano.tensor as T
from pylearn2.utils import serial
from pylearn2.config import yaml_parse
from pylearn2.datasets.mnist import MNIST
from pylearn2.datasets.tfd import TFD
def get_nll(x, parzen, batch_size=10):
"""
Credit: Yann N. Dauphi... |
692e8fc564ceca3e5cb466d91b19f182839b80859e583a484be8589ba1602f44 | Python | 4,733 | 161 | from copy import deepcopy
import torch
class ModelSaver:
def __init__(self, model, optimizer, dir_model):
self.model = model
self.optimizer = optimizer
self.dir_model = dir_model
def save(self):
self.state_dict = deepcopy(self.model.state_dict())
state = {
'... |
04948103d1a7e35b939bde05c0cff8180fa4e519c6d274b98ab4f69e85dd5d83 | Python | 4,734 | 132 | """
converts electrode (or for that matter, any point) coordinates in MRI space
to coordinates in freesurfer mesh space.
Requires subject ID to find coords data (in electrodenames_coordinates_native_and_T1.csv) and
the two matrices Norig and Torig which can be obtained using mri_info
Run:
python voxcoords_to_fs.p... |
77cc7f56fba0b18511a4e2b7ffb1df9050ce48aa6a87cc168ec5bab56f89c555 | Python | 4,734 | 159 | import itertools as it
from functools import reduce
import numpy as np
from autograd.core import vspace
from autograd.test_util import check_grads, scalar_close
def check_vspace(value):
vs = vspace(value)
# --- required attributes ---
size = vs.size
add = vs.add
scalar_mul = vs.scalar_mul
in... |
5b762fc6dc5f82e3764c984f633aa3da6fcdcc77a511a253babd290be189a569 | Python | 4,736 | 138 | # Node-group asset "2 Index Angle" (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... |
1f5192d2b3c48be4dcce6d1ba1ad9f8736f71f47e0b6d59290a73731ed680798 | Python | 4,737 | 135 | # 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... |
8484f61cdb7cda437232b66e7a8035e8757e1b8871ab6876e50a5cc6aedadc8a | Python | 4,737 | 116 | import torch
from torch_geometric.data import InMemoryDataset,Data
from os.path import join, isfile
from os import listdir
import numpy as np
import os.path as osp
from imports.read_abide_stats_parall import read_data
class ABIDEDataset(InMemoryDataset):
def __init__(self, root, name,raw_folder='raw_depression_HC... |
e8d1a4cf2e0cced7928727ac4ba863a17a58403db408d2cbf6ca43fc7a42bc50 | Python | 4,737 | 130 | """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
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd import grad
from autograd.misc.optimizers import adam
from au... |
f67bc2a587f30b6b7829372785dfac0378793c10eb55b73ca0afaca43c0b1a83 | Python | 4,737 | 133 | from __future__ import print_function
import invariant_finder
import options
import pddl
import timers
DEBUG = False
def expand_group(group, task, reachable_facts):
result = []
for fact in group:
try:
pos = list(fact.args).index("?X")
except ValueError:
result.append... |
5fec1ebd2c2fde48978e1f3807dfce9b24f68370e1a379bfc4559236b00a3df8 | Python | 4,738 | 140 | from utils import utils
from tqdm.auto import tqdm
import torch
from torch import nn
import numpy as np
# setup device agnostic code
device = "cuda" if torch.cuda.is_available() else "cpu"
def train_step(model: torch.nn.Module,
dataloader: torch.utils.data.DataLoader,
criterion_instance... |
c6a8833a6e0240a77996a7da7d6a8a9d569f1e25723882f4f6911f4e179a66d6 | Python | 4,739 | 133 | # 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... |
1db9f1abe3ff97d769b067f8638a2b0492de9677f40858d3a048c3c5a410e437 | Python | 4,740 | 123 | import torch
import numpy as np
import scipy.stats as st
import wandb
from sklearn.metrics import roc_auc_score, precision_score, recall_score, f1_score, accuracy_score
def ImputationMetrics(outputs, labels, info=None):
return {"imputation_MAE": torch.mean(outputs["imputation_MAE"]), "reconstruction_MAE": torch.me... |
50f05b79a4fb260904cae9d8fee1b1c000d8d4f67d5bf51ad5a2a1b50f3721d1 | Python | 4,741 | 82 | """
SIZE_MATCHED_LOCALISATION.py written 2026-09-07
WHY THIS EXISTS.
On 4 September the D-02 work found that the optic lobe's raw 2.41x determinacy
elevation falls to 1.45x once neurons are matched on synapse count, and to 0.64x with
no clustering at all. The conclusion drawn that day was that CHAPTER 5's wording h... |
effc99a470a07479cc0cd982d377cff351ca49b8fb5d43a4f12e7020ebabba53 | Python | 4,741 | 127 | import numpy as np
from common import *
from gzip import GzipFile as gz
from matplotlib import pyplot as plt
from sklearn.neighbors import NearestNeighbors
from random import shuffle
def transform_hap_to_autotet(x, coverage=25):
idx = [[0+i,1+i,2+i,3+i] for i in range(0,48,4)]
out = []
for i in idx:
... |
2b9f604c2cbb9bc17e9a32f458cc0f868cf17377693e029b90e27f32b30832c7 | Python | 4,743 | 124 | import os
import random
import shutil
import unittest
import mne
from torcheeg import transforms
from torcheeg.datasets import MNEDataset
mne.set_log_level('CRITICAL')
class TestMNEDataset(unittest.TestCase):
def setUp(self):
if os.path.exists('./tmp_out/'):
shutil.rmtree('./tmp_out/')
... |
994d47d80136678dede648389bad5c295c0e9762922b3faeaa2aff835cbdd927 | Python | 4,744 | 155 | # Node-group asset "Color Mix Intermediate" (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... |
fd650e5df7f1c216f03d1ca17b5aaca424a8379dc6751be63f861e421ac5b23f | Python | 4,744 | 155 | import anndata
import fsspec
import numpy as np
import pandas as pd
import pytest
import scanpy as sc
import scipy.sparse
from numpy.random import binomial, negative_binomial, seed
from scipy import sparse as sp
from cirrocumulus.anndata_util import get_base
from cirrocumulus.diff_exp import DE
from cirrocumulus.parqu... |
13a06a06a04db627b575a74a6697899013df17d5cdac5218739a6aebc0c42f1b | Python | 4,746 | 135 | #!/usr/bin/env python
# This script computes the similarity and distance matrices between two systems (two rasters)
# Uses multiprocessing for parallel processing
import h5py
import numpy as np
import os
import time
import sys
from functools import partial
from itertools import combinations
from itertools import produc... |
c24f3a001fb2da73f354d2700460621b7b6380c962fdead2490382183bf1f842 | Python | 4,746 | 120 | """
Express a cropped segmentation in the reference system
Input: - The STAR file with the info for the cropped segmentation
Output: - The segmentation in the reference tomogram context
- The STAR with the new segmentation info
"""
__author__ = 'Antonio Martinez-Sanchez'
###### Global v... |
7844ba5ba3d5db14d463fd5feee708db5aab0e2751a4dd62ef2044efafefe99f | Python | 4,748 | 98 | import os
from copy import copy
from typing import Union
import numpy as np
import pandas as pd
from sklearn import model_selection
from torcheeg.datasets.module.base_dataset import BaseDataset
def train_test_split_per_subject_groupby_trial(
dataset: BaseDataset,
test_size: float = 0.2,
subje... |
82e4d2123d8d7226765f1242e9818c1050d266dc74f9d13450bf3202bba7c7f1 | Python | 4,748 | 137 | """
m6A_hifi_mldata.py
Author: Anupama Jha <anupamaj@uw.edu>
This module converts m6A HIFI data format to training features and labels for ML modelling tasks.
"""
import argparse
import numpy as np
def count_pos_neg(labels, set_name=""):
"""
Count the number of positive (m6A) and negative (everything else) e... |
e6bf71bfd838f585501aa97c66e9c998504b8515d20cbe749fe91a0d39d23cba | Python | 4,748 | 148 | import tempfile
import unittest
from matplotlib import cm
from soundsig.signal import gaussian_stft,mt_stft,GaussianWindowSpectrumEstimator,MultiTaperSpectrumEstimator
from soundsig.sound import generate_harmonic_stack,WavFile,play_sound,generate_sine_wave,generate_simple_stack,mps,plot_mps,modulate_wave
import numpy ... |
088e6a3ff1c9c1ab51d62b932b99455b5dc6ada316a0dc182df7d17d255291a9 | Python | 4,750 | 125 | import os
import numpy as np
import h5py
from scipy import signal
import mne
def get_all_files(directory):
all_files = []
for root, dirs, files in os.walk(directory):
for file in files:
all_files.append(os.path.join(root, file))
return all_files
# data_path = 'your_mat_EEG_data_path'
d... |
26aa26991498c19660b18191e734e137c00d26e4978a4d539143f7a09356b2ff | Python | 4,751 | 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... |
9fe0a586aeb82461eef13142e181065aa9e881593311e27d89ef1cdb89ca6de7 | Python | 4,752 | 132 | # Node-group asset "Select Sphere" (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... |
9fdf1e18a70890caeecf49927abfcec491e7a81b730b8fa6ddd81a41a3a7dd19 | Python | 4,755 | 109 | """Allen CCF 2022 annotation: downloader downsample logic + registry wiring.
The multi-GB / multi-second real download+remap is not exercised here; these cover
the parts that are pure logic - the nearest-neighbour downsample (shape, label
fidelity, and the dtype/affine it must inherit) and the registry entries.
"... |
edf59df384ec22f39a6b872c0743e1066257b2d6662af4171ea91b33d8a49a25 | Python | 4,755 | 108 | import numpy as np
import pandas as pd
from trajectories_utils_fast import strength_preserving_rand_sa_trajectory
from trajectories_utils_reheat import strength_preserving_rand_sa_reheat_trajectory
import seaborn as sns
import matplotlib.pyplot as plt
from joblib import Parallel, delayed
from joblib.externals.loky im... |
251c5e77f20ee36d59bb17c7fd95e3f44ac206cf7e0010ec708f491ce8b1f536 | Python | 4,757 | 146 | # 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... |
28645e145e7aeaaa6a1211a99a263d22a51d43f06d0d198d545e3505ada9101a | Python | 4,757 | 126 | """Headless tests for atlas_choice.resolve_builtin / resolve_custom.
No Qt - the resolver is intentionally framework-free so it's cheap to
exercise from this test file and from headless one-off scripts."""
import pytest
class TestResolveBuiltin:
def test_allen_ccf_3d(self):
from regtools.ccf_b... |
0f193925e07d747957ef85913f7667d1cb0e2bdccd9194e0d954504f5b0dda31 | Python | 4,758 | 127 | import numpy as np
import keras
from keras_preprocessing import image
from PIL import Image
import cv2
def random_flip(img, mask, u=0.5):
if np.random.random() < u:
img = image.flip_axis(img, 1)
mask = image.flip_axis(mask, 1)
if np.random.random() < u:
img = image.flip_axis(img, 0)
... |
b5df92e65025911c234b18a2efe9eeca9b40ff9ae59be66cb90deb91f5298788 | Python | 4,758 | 189 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import os
import glob
from math import ceil
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
import pancancer_evaluation.config as cfg
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().r... |
8104b6019f0d0a82d0d8dafaf170834ef9a92fa92dc3f75b7a6ec44b46b1966f | Python | 4,760 | 177 | # 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... |
2d0283949f051d3de96b80042a21e6d6f669d2f95943382169162b01758bb41e | Python | 4,761 | 128 | from pyclamp.qnp.qmod import *
DEFIPDIR = ''
DEFOPDIR = ''
class bqaexp(Qmodl):
def openFile(self, spec = True):
self.Base = lbw.LBWidget(None, None, None, 'base')
self.pf = self.Base.dlgFileOpen("Open File", DEFIPDIR, "Tab-delimited (*.tdf *.tab *.tsv);;Excel file (*.xlsx *.xls);;All (*.*)")
if self.p... |
70ad8de9f0f29bf1d9162c8a10803b8d10078c10fe0d94d8d905a2cdbf7af54f | Python | 4,761 | 122 | 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
from elasticai.c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.