sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
6f629d890dca6afbb094e505b4ff8db9d2252018a7d04268c037121b698a2200 | Python | 5,959 | 149 | import csv
from typing import List, Optional, Union
import torch
from tqdm import tqdm
from chemprop.args import PredictArgs, TrainArgs
from chemprop.data import get_data, get_data_from_smiles, MoleculeDataLoader, MoleculeDataset
from chemprop.utils import load_args, load_checkpoint, makedirs, timeit, load_scalers, u... |
b65e681876485d11b4abe9cc0b73114f80815d99534137298a00d76fc86b44fd | Python | 5,959 | 156 | # 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... |
db38e119f365df2e3c4b2855e912a7e94a59fa27e37766b8cf0ad8fab48b1818 | Python | 5,960 | 198 | import cocotb
import pytest
from cocotb.triggers import Timer
from matplotlib import pyplot as plt
from torch import asarray, no_grad
import elasticai.creator.nn.fixed_point as nn
from elasticai.creator.arithmetic import FxpArithmetic, FxpConverter, FxpParams
from elasticai.creator.testing import CocotbTestFixture, ea... |
0090f722f52c86deb32a315c6b99f260f7cf42c5f2308b8075bc1a6b9089a1f0 | Python | 5,961 | 216 | # 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... |
b8f44a92e8056dc086ba9044b83dfcf76802eb105b3597d788c4ee0cfddd1051 | Python | 5,961 | 135 | import torch
import torch.nn as nn
from torch.utils.data import DataLoader
import numpy as np
from tqdm import tqdm
from model import *
from data.dataset import CategoricalStructureAdjointDataset
import argparse
from utils import *
import os
import datetime
ABS_PATH = os.path.abspath(__file__)
ABS_PATH = "/".join(ABS_... |
bc4f2db7935697cb654602fcc59356a905296c42b4d13239c3d521280bd19685 | Python | 5,962 | 167 | import torch
from models.resnet_simclr import ResNetSimCLR
from torch.utils.tensorboard import SummaryWriter
import torch.nn.functional as F
from loss.nt_xent import NTXentLoss
import os
import shutil
import sys
apex_support = False
try:
sys.path.append('./apex')
from apex import amp
apex_support = True
e... |
3045ea1e7cbf004c24973cf6d3b5b4804970894161204aeaf9a0c35f176726b8 | Python | 5,963 | 172 | """
Script for filter a MbGraphMCF object by extracting a filament network
Input: - A STAR file with a list of graphs (MbGraphMCF) as it is returned by
by mb_graph.py script:
+ Density map tomogram
+ Segmentation tomogram
+ MbGraphMCF object
... |
544b0d927dc389d1af22b8a6a512855a6693b41ebb86a0fe0a4cc21ee8cf42ff | Python | 5,964 | 160 | #!/usr/bin/env python
from __future__ import print_function
import pybullet as p
import time
from pybullet_tools.pr2_utils import TOP_HOLDING_LEFT_ARM, PR2_URDF, DRAKE_PR2_URDF, \
SIDE_HOLDING_LEFT_ARM, PR2_GROUPS, open_arm, get_disabled_collisions, REST_LEFT_ARM, rightarm_from_leftarm
from pybullet_tools.utils ... |
73f2a2ef0df1843851f8fcd4b8e90a87ce61e2b3d73068a9d265bd58cd2e0ee2 | Python | 5,965 | 166 | # -*- coding: utf-8 -*-
#
# Syncopy latency processing
#
# 3rd party/built in imports
import numpy as np
from copy import deepcopy
# Syncopy imports
from syncopy.shared.parsers import array_parser
from syncopy.shared.errors import SPYValueError
available_latencies = ["maxperiod", "minperiod", "prestim", "poststim"]
... |
59a25456947556fe0308f23a00f6627eba3509fa147297afeae07628d16e14de | Python | 5,966 | 172 | """
Script for filter a MbGraphMCF object by extracting a filament network
Input: - A STAR file with a list of graphs (MbGraphMCF) as it is returned by
by mb_graph.py script:
+ Density map tomogram
+ Segmentation tomogram
+ MbGraphMCF object
... |
cb7e2208cc43760f40cb8df890f98e79bbc9d79feda62a7bd19a2e452910512f | Python | 5,966 | 194 | # -*- coding: utf-8 -*-
#
# e3fp documentation build configuration file, created by
# sphinx-quickstart on Sun Jun 25 01:13:34 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... |
9dfa48b696a727f84bc5e12ef9f3bf1ab848f35fb2ab00f5319b3c34bf29185d | Python | 5,967 | 195 | """
Script for filter a Particle list in format XML
Input: - path to the input XML file
- path ot the output XML file
- Filtering parameters
Output: - The filtered particle list, survivor particle are unaltered
"""
__author__ = 'Antonio Martinez-Sanchez'
# ################ Pac... |
ecedab39c22e4685d5a0daeef7bf39892bd0c42084725f896771987f0b8f528f | Python | 5,968 | 177 | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 12 11:27:20 2018
@author: Laure Spieser and Boris Burle
Laboratoire de Neurosciences Cognitives
UMR 7291, CNRS, Aix-Marseille Université
3, Place Victor Hugo
13331 Marseille cedex 3
This file is part of Myonset.
Myonset is free software: you can redistribute it and/or m... |
74716c20dd1d6081fc0aab6d3c2b9bde3539030d17d5999ddbf1a0c5ec53ff6b | Python | 5,971 | 155 | #!/bin/env python3
'''
This class defines the possible reactions of the phase defect quasi-particles.
'''
import re
from frozendict import frozendict
from typing import Dict, List, Union, Callable
from collections import Counter
from dataclasses import dataclass
from .particle import *
from .pool import ParticlePool
fr... |
8af63bbf6673192fc35987bcd6e3926961f8fd809e89257d3d45c47198ebf849 | Python | 5,972 | 155 | import timm
import numpy as np
import torch.nn as nn
from ._base import EncoderMixin
def _make_divisible(x, divisible_by=8):
return int(np.ceil(x * 1.0 / divisible_by) * divisible_by)
class MobileNetV3Encoder(nn.Module, EncoderMixin):
def __init__(self, model_name, width_mult, depth=5, **kwargs):
s... |
b4eb3a7cb64f37668bf2e25da134e9265b5c78732ca6390c7c1af0d8def40d38 | Python | 5,972 | 150 | import numpy as np
import warnings
try:
import nxsdk.api.n2a as nx
except:
warnings.warn('nxsdk not found')
def calculate_effective_weight(numWeightBits=6, IS_MIXED=0, weight=255, weightExponent=0):
'''
calculates and prints the actual weight of a synapse after discretization
Please compare with ... |
113a02920bbfb51ffa536d8acc012f4b430420f4070049a422617ca89f0a4730 | Python | 5,973 | 108 | #! /usr/bin/env python3
import os
import subprocess
import logging
import APT_interface
class cd :
"""Context manager for changing the current working directory, and automagically changing back when done"""
def __init__(self, path):
self.path = path
def __enter__(self):
self.old_path = ... |
4a4f570e8c3181aeb8a56752ae8257fc88ab5ceb03bee0bbf60cc7690d7eec95 | Python | 5,973 | 168 | import os
import struct
import logging
from tqdm import tqdm
logger = logging.getLogger(__name__)
def download(url, path, save_file=None, md5=None):
"""
Download a file from the specified url.
Skip the downloading step if there exists a file satisfying the given MD5.
Parameters:
url (str): ... |
8442a378270fd33f0bee3a85f59363b621e3fed68b309e2c1d5b1aa3c9beb7dc | Python | 5,973 | 132 |
import numpy as np
import nibabel as nib
import h5py
import os
import pkg_resources
dilateMM = 10
partitiondir = pkg_resources.resource_filename('ActflowToolbox.dependencies', 'ColeAnticevicNetPartition/')
defaultdlabelfile = partitiondir + 'CortexSubcortex_ColeAnticevic_NetPartition_wSubcorGSR_parcels_LR.dlabel.ni... |
23ffbd40ad7d933844769dfc30ad78afe281a65d740d6bbac9493f71e51a364a | Python | 5,974 | 193 | # 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... |
7b8b283cffbf32cd29e742bfc9cd26dfdc48242c3c6a99eb67988037bedb9d5f | Python | 5,974 | 200 | # coding: utf-8
__author__ = 'ZFTurbo: https://kaggle.com/zfturbo'
if __name__ == '__main__':
import sys
import os
# For this test, make sure that only the tested framework is available
sys.modules['tensorflow'] = None
sys.modules['jax'] = None
gpu_use = 0
print(f"GPU use: {gpu_use}")
... |
233f8e10d43fb82bf257225231dee1b647f1bdea6f611676344ed7f0c64c4155 | Python | 5,976 | 195 | """
Script for generate subvolumes from a particle list
Input: - path to the input XML file
- parth to reference tomgrams
- path to output subvolumes
Output: - The filtered particle list, survivor particle are unaltered
"""
__author__ = 'Antonio Martinez-Sanchez'
# ###########... |
67b46f7b43796688824c33667327700e320f60e8ead9f182f3c780dedc9f5f14 | Python | 5,976 | 171 | from typing import Callable
import pytest
import torch
from elasticai.creator.arithmetic import FxpConverter, FxpParams
from elasticai.creator.nn.fixed_point.conv1d.design import Conv1dDesign
from elasticai.creator.nn.fixed_point.conv1d.testbench import Conv1dTestbench
from elasticai.creator.vhdl.auto_wire_protocols.... |
013d1198c814a1f383e08b7bdfeb7c173406830c8eeee12a174d25de518df645 | Python | 5,977 | 164 | from torch.utils.data import Dataset
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
import torch
from tqdm import tqdm
from torch.cuda.amp.grad_scaler import OptState
from Util.sam import enable_running_stats, disable_running_stats
def transform_data_embed(seq, embedding_di... |
fb8f98093cbf6829c4670bd1d7c7af9600d1dfd0847d13d576133c225ce169bd | Python | 5,982 | 125 | import copy
import unittest
from hed import load_schema_version
from hed.schema import HedKey, hed_schema_constants
from hed.schema.schema_validation.hed_id_validator import HedIDValidator
from tests.schema.util_test_schemas import load_test_schema
# tests needed:
# 1. Verify HED id(HARDEST, MAY SKIP)
# 4. Json tests... |
b9336b73ce2f11dde678ac6d6d9d71e0e2ab9d345868479a55f979837af75e0f | Python | 5,983 | 164 | import sys
import pickle as pkl
import numpy as np
import scipy.sparse as sp
import torch
from sklearn.metrics.pairwise import cosine_similarity as cos
from sklearn.metrics import pairwise_distances as pair
from utils.gcn_utils import normalize
from dataloader import dataloader
def parse_index_file(filename):
"""P... |
0bb0ad0384c79819267dd0c4599374990903b1ccc0192cf36c239ed26a5bd145 | Python | 5,984 | 177 | #!/usr/bin/env python
"""
Validates a HED string against a specified schema version.
This script validates a HED annotation string, optionally with definitions,
against a specified HED schema version.
"""
import argparse
import sys
from hed import HedString
from hed.errors import ErrorHandler
from hed.models import ... |
8334f9b794a29b0573a04274590b4436d8579b50300da702ad68c3840b3498a2 | Python | 5,986 | 159 | """Manager for factor information for a columnar file."""
import pandas as pd
from hed.errors.exceptions import HedExceptions, HedFileError
class HedTypeFactors:
"""Holds index of positions for a variable type for A columnar file."""
ALLOWED_ENCODINGS = ("categorical", "one-hot")
def __init__(self, ty... |
ac880ef05af1af83643b31ae5cd194f0b5e04a2139a4fae079559c79e8c02d78 | Python | 5,986 | 199 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 21 13:02:57 2023
@author: emma
evaluation code for unlearning experiments (loads and concatenates model for disease prediction)
"""
import pickle
from datagenerator_3d import DataGenerator
from sklearn.metrics import confusion_matrix, accuracy_sco... |
05fe379fdfac0fb43d6b4fcde2c8198ecc9ac758410400d142caeb0a5d40587e | Python | 5,987 | 145 | # regtools/tests/test_batch_2d_settings.py
import os
import json
import pytest
from regtools.registration.gui.batch_2d_model import BatchRow, BatchConfig
from regtools.registration.gui.batch_2d_settings import (
export_settings,
import_settings,
import_slice_mapping_csv,
)
def _make_files(tm... |
d1389b4c3457ddd782099a1c8524a0ac585153800e94a3a55657416d0c9dc660 | Python | 5,987 | 145 | import torch
import argparse
import numpy as np
import configparser
import pandas as pd
import _pickle as pickle
from m6a_cnn import M6ANet
from m6a_semi_supervised_cnn import tdc, count_pos_neg, make_one_hot_encoded
def find_window(score, precision_score_table):
for j in range(len(precision_score_table)-1, 1):
... |
041473963f9216aaa08e1570563603820d06ba43e1f20ea254dd559abf310eab | Python | 5,988 | 212 | #!/usr/bin/env python
import subprocess
import os
import sys
import gzip
from datetime import datetime
from shutil import which
import pysam
def run_shell_cmd(cmd):
"""
Execute a command on bash shell with subprocess.
"""
p = subprocess.Popen(
['/bin/bash', '-o', 'pipefail'],
stdin=sub... |
a8f59897d01b35ab69e23cc4ca7c2fe59e58ee64df2211841a2239312ad9cfd0 | Python | 5,988 | 158 | #!/usr/bin/env python
# Copyright (c) 2019-2020 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
Cut in scenario:
The scenario realizes a driving behavior on the highway.
The user-controlled ego vehicle is driving straight an... |
003e48583f08fc77eb7edb4df7448af326135c340c74339beffa415349b451d8 | Python | 5,989 | 174 | import pytest
import os
import numpy as np
import nibabel as nib
from pathlib import Path
from pyrelimri.similarity import image_similarity
from pyrelimri.brain_icc import (voxelwise_icc, setup_atlas, roi_icc)
from nilearn.datasets import fetch_neurovault_ids
from collections import namedtuple
from nilearn.masking impo... |
b7f783d6f03558213bb0f0127de85badf3f97781d6e794b880376643ccdb92a4 | Python | 5,989 | 158 | #!/usr/bin/env python
from SCanSNP.VCFUtils import *
from SCanSNP.DBLsutils import *
#from SCanSNP.Pileup import *
from scipy.sparse import csr_matrix
import copy
import anndata as ad
import numpy as np
import gzip
import shutil
import subprocess
import time
#from Wrappers import *
# def MultiSlice(Counts, Genotype... |
7ba824c31d3ed1221959bdae3b43cd26101fecdfbfbe0d2166db6d75e9a1247a | Python | 5,991 | 208 | #from __future__ import division
#from __future__ import print_function
import time
import collections.abc
import json
import numpy as np
import copy
from easydict import EasyDict as edict
from keras import backend as K
import h5py
def dictsubsetpfix(d, pfix):
return dict((k, d[k]) for k in d if k.startswith(p... |
8a7670690f2a674619827c395e440f888e5b6dcd7e97fe40c75b9633b188a8fe | Python | 5,991 | 158 | import numpy as np
import pandas as pd
import read_files
import online_buffer as obuff
import scaling
import vmd
from OnlineDetectors.bayesChangePt.bayes_changept_detector import BayesChangePtDetector
from OnlineDetectors.windowedGaussian.windowedGaussian_detector import WindowedGaussianDetector
from OnlineDetectors... |
ac4f99b79ccc9f664fa57f2c4b2fee0fd3e84ab0cc362ebb072f6e141e0ba027 | Python | 5,991 | 107 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ABFbot_ui.ui'
#
# Created by: PyQt5 UI code generator 5.13.0
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):... |
615209d079043c04b60404465dbaad1ece410a55994bc28c0ef50c637b56b237 | Python | 5,993 | 163 | #!/usr/bin/env python
from __future__ import print_function
import argparse
import numpy as np
from numpy import array
from examples.continuous_tamp.primitives import get_random_seed, tight, MOVE_COST, GRASP
from examples.continuous_tamp.run import pddlstream_from_tamp, display_plan, set_deterministic, TIGHT_SKELET... |
ca6ac91b4fd29ba596fada2cbb7709026c2c5422581993d993d3e48bf0fcdb00 | Python | 5,993 | 107 | import torch
from torch import nn
from torch_cluster import knn_graph, radius_graph
from torchdrug import core, data
from torchdrug.layers import functional
from torchdrug.core import Registry as R
from torch_scatter import scatter_min
@R.register("layers.geometry.AdvSpatialEdge")
class AdvSpatialEdge(nn.Mo... |
6d884ac2563cc2bf5d3778c7917954fdb7187b7aca29abb0e7514f56a4d3045b | Python | 5,996 | 115 | import functools
import logging
from collections import defaultdict
from NDATools import exit_error
from NDATools.Utils import evaluate_yes_no_input
from NDATools.upload.submission.api import SubmissionApi, Submission, SubmissionDetails
logger = logging.getLogger(__name__)
def check_replacement_authorized(config, s... |
7ca2db8fb46b44355c2c2ed013811c9420d040a5c8d1594193a4268e7523d28f | Python | 5,996 | 172 | # -*- coding: utf-8 -*-
import tensorflow as tf
from .. import _logging as logging
from .core import *
__all__ = [
'SubpixelConv1d',
'SubpixelConv2d',
]
def subpixel_conv2d(net, scale=2, n_out_channel=None, act=tf.identity, name='subpixel_conv2d'):
"""It is a 2D sub-pixel up-sampling layer, usually be ... |
4aa02d967ac30bd68ed1e1e65076e183fec8ec4f94d1e3fd7817bc3cf8514039 | Python | 5,999 | 187 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: emma
"""
import pickle
from datagenerator_3d import DataGenerator
from sklearn.metrics import confusion_matrix, accuracy_score, average_precision_score, roc_auc_score
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np... |
5d81c75bad210307d2db21fe5a8c19cb3f655d6fe732284452c3db3c61eba0cb | Python | 5,999 | 143 | """Detect a failed tissue mask without ground truth, by disagreeing with itself.
Every mask failure measured in this project shares a signature: the result moves when the
working resolution moves. A correct mask does not, because the tissue silhouette is a
property of the specimen and not of the sampling grid.
... |
e9f333212fc4b2a95d1d200ab916182151f2cb5d3fee81537d59aa630494f733 | Python | 5,999 | 204 | # build pipeline to generate per fiber GMM model
import pandas as pd
import numpy as np
from sklearn.mixture import GaussianMixture
from sklearn.preprocessing import normalize
import sys
import time
import tqdm
import pysam
import multiprocessing as mp
# line format
# m64018_201129_132425/18/ccs",2,0,G,6,0.814,0.248,0... |
1e3d0706b701e15c5c900610eca3d359e97ace9c8c8d108f883939081065092a | Python | 6,002 | 202 | from __future__ import annotations
import numpy as np
def right_censor_to_interval(
event_indicators: np.ndarray, # (N,) bool: True=event, False=right-censor
observed_times: np.ndarray, # (N,) float: event or censor time
max_t=np.inf, # max time
):
"""
Convert (event_indicators, observed_times... |
7327eb38d6937990298b0b6e6ac09ef83418e436fb4dcdb23e5305b35176584b | Python | 6,003 | 183 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import torch
from torch import nn
from torch.nn import functional as F
class UNET(nn.Module):
"""
PyTorch implementation of a U-Net... |
695a99fc51d54b6bf4794f907c73c7fef3d00661ac9a4d9071e1a1a457b31cee | Python | 6,004 | 158 | """
Set of tests for thalamus mass models.
"""
import unittest
import numpy as np
import xarray as xr
from jitcdde import jitcdde_input
from neurolib.models.multimodel.builder.thalamus import (
TCR_DEFAULT_PARAMS,
TRN_DEFAULT_PARAMS,
ThalamicNode,
ThalamicReticularMass,
ThalamocorticalMass,
)
from... |
919b549521c4ad9d90bc0695ad566661a856b9a98bf1cb22a5e9eaf0ed1eadf4 | Python | 6,005 | 195 | # 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... |
f37c074a2fe050726189f9cfb026c7cc2301e9f94c8694102d675a5bef3d8a7b | Python | 6,005 | 137 | """Compute the aggregated scores for calls, battery, SMS, screen, and GPS.
The input should be done in the following order:
Parameters
----------
file : str
path where the smartphone answers files are stored
savepath : str
path where the processed data will be stored
"""
i... |
67b4d1d21369c2c3cc5a7af9c0c68d2ebc6a8508201debf48e95378d249c27c8 | Python | 6,007 | 142 | import os
import numpy as np
import pandas as pd
import scanpy as sc
import torch
import time
import tracemalloc
from scvi.external import RNAStereoscope, SpatialStereoscope
def run_stereoscope_scvi(st_counts_path, sc_counts_path, sc_labels_path, output_dir="."):
if not os.path.exists(output_dir):
os.m... |
62695f826d659b683786f6247e14e791ec040fced4dd899c2f02c3ade502d33b | Python | 6,009 | 203 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import math
from functools import partial
__all__ = ['ResNeXt', 'resnet50', 'resnet101']
def downsample_basic_block(x, planes, stride):
out = F.avg_pool3d(x, kernel_size=1, stride=stride)
zero_pads = torch... |
7660f9fb12d2623a9f6feba632b3878c11aaff3911696f4d590981c3e99c00f1 | Python | 6,009 | 145 | 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... |
db55cea6e0ff64dbb6b8f85cbfbdeebb47a0ee90155e4b086236751933a1167e | Python | 6,009 | 155 | import numpy as np
from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.nn.integer.ram.design import Ram
from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_p... |
4185f00f8b8352f246a784fbde0a966efbad3ee3bba49ff5896d54fd738ec0e1 | Python | 6,011 | 184 | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from collections import defaultdict
from timm.models.layers import trunc_normal_
import segm.utils.torch as ptu
def init_weights(m):
if isinstance(m, nn.Linear):
trunc_normal_(m.weight, std=0.02)
if isinstance(m, nn.L... |
59e8c821d38060ad6c04b70ce9269d4251c7012eec132c7bdc731d8a2934af18 | Python | 6,012 | 205 | # 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... |
dceffd9f0be1928ac5f331f63e35868d90a0e60177a9fed5ac97f672aea726e1 | Python | 6,017 | 149 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : calc_sdmatrix.py
# Author : Yufeng Liu
# Date : 2023-01-28
# Description :
#
#=================... |
6041615331fa334c85a0d8f8f98f4729a2a70f67901a954957fa9130d73c3a9d | Python | 6,019 | 183 | from __future__ import division
"""
this code is adapted from:
https://raw.githubusercontent.com/bearpaw/pytorch-classification/master/models/imagenet/resnext.py
by Wei Yang
Creates a ResNeXt Model as defined in:
Xie, S., Girshick, R., Dollar, P., Tu, Z., & He, K. (2016).
Aggregated residual transformations fo... |
1d27e78abbba817533ce9b707b45b3437a611f13d6ffdd6f37428bc7164cef2c | Python | 6,020 | 173 | import brian2hears as b2h
import brian2 as b2
import numpy as np
from scipy.io import wavfile
def cut_wav_from_cue(stimulus: str) -> np.ndarray:
""" Cut the wav file from the cue point to remove the silence at the beginning of the file.
Parameters
----------
stimulus : str
Path to the wav fil... |
33ce98601a9d51bbbf66e216c5d7425421b62483ac6deb58429460d916459622 | Python | 6,020 | 88 | """HEMIBRAIN_BENCH.py 2026-10-05. Pre-registered: 04-NOTES/PREREG-2026-10-05b-HEMIBRAIN-AND-BENCH.md (sha in .sha256 next to it).
H1 is v2LN30 the largest single input to the uPNs in a third fly (hemibrain v1.2)? H2 do the same types dominate the same
populations there? G are dominant inputs inhibitory where a laborato... |
2fa1f208340c562d556fbbb92bd8701616b8b6970bbf700e0c447b044b0a72cf | Python | 6,021 | 181 | # Node-group asset "Color Attribute Random" (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... |
8578cb7e17130265535c8273ec161315cb4a2a20fcd6d7b3f9c491519ec74dd5 | Python | 6,022 | 222 | # -*- coding: utf-8 -*-
import gzip
import nibabel as nib
from nibabel.filebasedimages import ImageFileError
import numpy as np
import pandas as pd
from scipy.stats import zscore
AGG_FUNCS = dict(
mean=np.mean,
median=np.median
)
def check_dict(dictionary):
"""
Checks that `dictionary` is a dict an... |
fb6ac907a9bd55ef28a7f8ad8c84840b9bda65423ae3b15d42cdbd5f9c84d5ce | Python | 6,022 | 151 | # Node group "Geometry Principal Components" (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 accessor... |
825cbaa8e5d7ea7c32e971b823bb22a0ce6b298c086d0177c384d2418f6fc32b | Python | 6,024 | 177 | """
Contains class Image for manipulations of grey-scale images.
# Author: Vladan Lucic (Max Planck Institute for Biochemistry)
# $Id$
"""
from __future__ import unicode_literals
from __future__ import division
from builtins import zip
from builtins import str
from past.utils import old_div
__version__ = "$Revision$... |
8ca39ff58edb55f4cda515a5e9fbc99f61bf0e0f59203de0736f9f9f0a629b6c | Python | 6,024 | 224 | # 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... |
1d8c11e4754bd82ab9f3088440d1645aac1bd21e178c14cff359d2d7c1364482 | Python | 6,025 | 205 | ##
# \file DataWriter.py
# \brief Writes data to HDD
#
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date Aug 2017
#
import os
import sys
import numpy as np
import SimpleITK as sitk
from abc import ABCMeta, abstractmethod
import pysitk.python_helper as ph
import pysitk.simple_itk_helper as si... |
2a156d8175e6ba829f2287f80f364552d2109165da65172a14c37f10b0e6e501 | Python | 6,026 | 158 | import pandas
import numpy as np
from merlin.core import analysistask
from merlin.util import spatialfeature
from merlin.util import barcodedb
class PartitionBarcodes(analysistask.ParallelAnalysisTask):
"""
An analysis task that assigns RNAs and sequential signals to cells
based on the boundaries determi... |
2c085fa6f655d8333a5cfe8fcbea68866bf6a1006eb6bd1a1d05525a5dd00688 | Python | 6,028 | 189 | from brian2 import *
from math import exp, floor, sqrt
import matplotlib.pyplot as plt
import numpy as np
from setup import izzy, pos_3D, STDP1, write_video, vectormap
def Wave(seednum, batch, RATE):
seed(seednum)
vidName = str(batch) + '/' + str(batch) + str(seednum)
fileName1 = str(batch) + '/' + str(ba... |
d3d9f44701e00bb92d0d343dcb01c91df266115d650967d18943977d5af21f0e | Python | 6,028 | 166 | """
Tests for .npz / .npy backward-compatibility probing helpers.
Verifies the policy established in the .npz-canonicalization refactor:
- New writes go to .npz (canonical).
- Reads probe .npz first, then .npy (legacy) as a fallback.
- Both probe helpers (_load_npz, _lap_field_exists) handle both extension... |
24502114ece68324418bda0420817afb13ece18b22a3541daaa282dcc26a577e | Python | 6,029 | 190 | import torch
import torch.nn.functional as F
from prettytable import PrettyTable
import numpy as np
import random
from sklearn import metrics
import wandb
from tqdm import tqdm
from utils import *
def normalized_laplacian(A):
"""
Input A: np.ndarray
:return: np.ndarray D^-1/2 * ( D - A ) * D^-1/2 = I - D... |
7bb2530a886ad2bb077ba6d70a4a3227bc582cbb1366abafd0c20700adfa8444 | Python | 6,029 | 148 | import os
import json
import argparse
import carla
from utils import interpolate_trajectory, gen_skeleton_dict, gen_scenarios
PRECISION = 2
SAMPLING_DISTANCE = 30
PRUNE_ROUTES_MIN_LEN = 10
def generate_scenario_4(carla_map):
carla_topology = carla_map.get_topology()
topology = [x[0] for x in carla_topology... |
d889ed1a5786d2e23e703630a932e05e777c80707e5f8beef9ebf54caa73c3b9 | Python | 6,032 | 194 | # 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... |
4c01606849b2fbb416e38d49cbbaad3e7799ea62aac76787687b5a0747d88cb1 | Python | 6,033 | 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... |
dbe68b87dfbe17bc59336f42b2d0ab406c77b09eeb2a332fb04edb14e800634a | Python | 6,034 | 181 | """
Computes Geodesic Gaussian Filter (GGF) for GraphMCF
Input: - GraphMCF (pickle file)
Output: - GGF stored in a vertex property
"""
__author__ = 'Antonio Martinez-Sanchez'
# ################ Package import
import sys
import time
import getopt
from globals import *
from factory import unpickle_obj... |
319f1baea0c1e307b03ac9baa14c1ddba17a4c020e93a0876bf3683696cf28e2 | Python | 6,036 | 65 | """posthoc_dominant_attack_2026-10-02.py — POST HOC checks asked for by the review panel on the dominant-input rule
(2 Oct night). Descriptive; nothing here was pre-registered.
(1) the plain count on an unselected cohort: all 369 unlabelled inhibitory local neurons with a sealed full-theory single flip
(KEYSTONE, 1... |
1b9d48d594bcc1e1d3c3b9d12c54ce1f1be6229e80c64d66e2d96ebe3f011030 | Python | 6,037 | 186 | """Core recipes for VASP."""
from __future__ import annotations
from typing import TYPE_CHECKING
from quacc.calculators.vasp import Vasp
from quacc.runners.ase import Runner
from quacc.schemas.ase import VibSummarize
from quacc.schemas.vasp import VaspSummarize
from quacc.utils.dicts import recursive_dict_merge
if ... |
2f427ebd095a265696ff5b7b2b12d39faf6a4b01566de54ab6bd687821cd8795 | Python | 6,037 | 135 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 12/07/21
Entry script for creating necessary files for source space analysis. Namely we
create here the source space for an individual subject based on a morphed version
of fsaverage, then calculate BEM solutions and forward lead-field matrix.
Notes:
... |
6d74203cdabd1a24c152b5486c3009832bbb26305f3f808cd4c6c16a45844e50 | Python | 6,037 | 156 | #
# 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,... |
6ed11021459605f9c43d45096d09e43b075dbd01d7829effc1bec13a2b3980c8 | Python | 6,037 | 151 | import pytest
import yaml
from realesrgan.data.realesrgan_dataset import RealESRGANDataset
from realesrgan.data.realesrgan_paired_dataset import RealESRGANPairedDataset
def test_realesrgan_dataset():
with open('tests/data/test_realesrgan_dataset.yml', mode='r') as f:
opt = yaml.load(f, Loader=yaml.FullL... |
e7438a2006ddeea82eff42dc58746a4f605666ce4f02407f0cb88119ce76df89 | Python | 6,037 | 149 | """Region-tree (atlas-hierarchy view) tests."""
import pytest
@pytest.fixture
def qapp():
from PySide6.QtWidgets import QApplication
app = QApplication.instance() or QApplication([])
yield app
def _two_region_volumes(tmp_path, shape=(3, 20, 30)):
import nibabel as nib
import num... |
3c342face231e082844dcc73ab6aa62bc8cf7c72f336782357360b1870e3f512 | Python | 6,039 | 167 | import os
import pdb
import torch
import numpy as np
from torch import nn
from scipy import stats
from scipy import sparse
from .scperb_vae import scPerb_vae
from torch.distributions import Normal
from torch.distributions import kl_divergence as kl
class scperb(nn.Module):
def __init__(self, opt):
super().... |
f1b33d24121da50839d3d3f2a794a53dbac50b28c99599bdfb16ba5a0f7555d0 | Python | 6,039 | 181 | # Implements a Generative Adversarial Network, from
# arxiv.org/abs/1406.2661
# but, it always collapses to generating a single image.
# Let me know if you can get it to work! - David Duvenaud
import itertools
from data import load_mnist, save_images
import autograd.numpy as np
import autograd.numpy.random as npr
fr... |
f4c19ebe4fd218833b62ccc38851c64b1fe91998d1d956bc25394f5cf5a71789 | Python | 6,040 | 142 | import argparse
from datetime import datetime
from pathlib import Path
from warnings import filterwarnings
import lightning.pytorch as pl
import pandas as pd
import torch
import yaml
from tqdm import tqdm
from dataset import TCGA_Program_Dataset
from datasets_manager import TCGA_Balanced_Datasets_Manager, TCGA_Datase... |
a208b20c9a9cfb8a337f5e678bd424955a1ce8d90e223ee6944387446e3197a0 | Python | 6,041 | 130 | # set QT_API environment variable
import os
os.environ["QT_API"] = "pyqt5"
import qtpy
from pathlib import Path
# qt libraries
from qtpy.QtCore import *
from qtpy.QtWidgets import *
from qtpy.QtGui import *
# app specific libraries
import control.widgets as widgets
import control.camera as camera
import control.core... |
7349c3b815adb0e288559eaa19f620c2a73e26546906c563b0ac08afa71a593b | Python | 6,045 | 173 | # part of this script was taken from https://github.com/jocicmarko/ultrasound-nerve-segmentation
import argparse
from glob import glob
import numpy as np
from PIL import Image
from keras import backend as K
from keras import losses
from keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau
from kera... |
36511d00511d79a338de2fbd5589088eef92cb9d62b44bd786b356a40157b349 | Python | 6,051 | 157 | """
DeepSlice atlas-plane selector - optional 2D pre-registration stage.
DeepSlice (https://github.com/PolarBean/DeepSlice) is a CNN that predicts which
Allen CCF coronal plane a 2D brain section came from. In the RegTools 2D
pipeline the CCF coronal index (``ccf_index``) is otherwise entered by hand; this
modu... |
eab128b2a1820d8591b64fd9d3a65f9e69b58f9a3e42e085ccc56dc99adad1ec | Python | 6,051 | 172 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# rapidtide documentation build configuration file, created by
# sphinx-quickstart on Thu Jun 16 15:27:19 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# a... |
945bdd14c836cf448d7ffbe630e2bf1e55ac4dc63318924211ec0e4fda34c6ea | Python | 6,052 | 222 | import numpy as np
import pandas as pd
from help_funcs import load_exp_variables
# ----- #
# Hyperparameters.
metric = "rocauc"
metric_str = "score"
band = "beta"
limit_hspace = True
if limit_hspace == True:
hspace_str = "_sel"
elif limit_hspace == False:
hspace_str = ""
remove_fooof = False
if remove_foo... |
cc31847b48708ec4f30410f5f998897272e6b91a175e8635acab41a78403e336 | Python | 6,052 | 188 | from os.path import getsize, join
from xml.etree.ElementTree import parse
from datetime import datetime, timedelta, timezone
from numpy import nan, pad, reshape, zeros
TIMEZONE = timezone.utc
# 24bit precision
DATA_PRECISION = 3
EEG_FILE = 'EEG,Composite,SampleSeries,Composite,MRIAmp,data'
SETTINGS_FILE = 'EEG,Compo... |
7a9b8cc2a3f5ad9d3572dc67fe75d5380de24f693ed886daf33574f74fc5fead | Python | 6,053 | 137 | #!/usr/bin/env python3
"""Unit tests for ``scripts/verify_branch.py``.
Covers the branch-scoping rules (which files each branch prefix may modify) and the exemption
for generated manifest files (``schema_versions.json``). Uses only the standard library
(``unittest``); no git repo or network required. Schema-file *vali... |
1c71413d56d1dd6b351c617f39a78c54028326eb5645584c474ecaa49376c510 | Python | 6,054 | 121 | """The packaged copy of the specification's character_sets.json and the CharacterSets view of it."""
import json
import os
import re
import unittest
from hed.validator.util.character_sets import CHARACTER_SETS_FILENAME, CharacterSets, code_point
class TestCharacterSetsFile(unittest.TestCase):
"""The file is loa... |
b74686b6644bddb3e6f87ce9e4f2d7908c57309a4629c30e646c85953a0acb0e | Python | 6,054 | 172 | # part of this script was taken from https://github.com/jocicmarko/ultrasound-nerve-segmentation
import argparse
from glob import glob
import numpy as np
from PIL import Image
from keras import backend as K
from keras import losses
from keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau
from kera... |
558d3237c5cf4f69863d5f14561c8295dc9919b6e81fcb995d8d95cae32f970a | Python | 6,056 | 169 | # 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... |
9848d77deaf33acee964c2e934ec1bcb3631b68c6741090c02016e49c690af5b | Python | 6,057 | 134 | """The atlas-edit-mask run wiring must save on the RUN's post-half-crop
template grid, not the pre-crop full grid.
Regression for the final whole-branch-review finding: registration_tab.py's
run wiring saved the mask on `_template_preview_full_shape[-2:]` - the shape
BEFORE `halve_and_pad` - while `_load_and_orie... |
08ad40c319c025e90747d42cdbbf25da8029dc7b1b8a89d3eebba14b980cf4c7 | Python | 6,058 | 113 | import numpy as np
from pandas import DataFrame
import matplotlib.pyplot as plt
plt.ioff()
import seaborn as sns
import matplotlib
matplotlib.rcParams.update({'font.size':12})
class Plotter:
# save all plots in path: single flash and all recordings
# call (n+1)*(1+nflash//5+nflash) save_plot
def __i... |
cf89d83f5766cf3c910aecb525ce525f2ea32a83595af8039a45f08d251fa627 | Python | 6,061 | 123 | from tnn.tnn import *
from ivis import Ivis
import scanpy as sc
import pandas as pd
import anndata as ad
from time import time
#os.environ["CUDA_VISIBLE_DEVICES"]="1"
from memory_profiler import memory_usage
def my_func(adata):
sc.pp.filter_genes(adata, min_cells=3)
sc.pp.filter_cells(adata, min_g... |
09c41f6587d38d0231cdb012d4fe9386bd93d8ecd209b1664ccc4b45d9534e61 | Python | 6,063 | 159 | # -*- coding: utf-8 -*-
r"""
This file implements a combination of the atomic dipole dipole model and the bond charge dipole
model with regularization resulting in the AD+BC(R) dipole model.
Atomic vectorial property predictions from the network are interpreted as atomic dipoles.
Atomic pairwise interaction prediction... |
1beb9b9c3903136f5f24b50381f532377fb54173b0129f80d5d9fb271af7ce76 | Python | 6,063 | 163 | # -*- coding: utf-8 -*-
"""A RuNNer data loader
RuNNer data has the format
begin
lattice float float float
lattice float float float
lattice float float float
atom floatcoordx floatcoordy floatcoordz int_atom_symbol floatq 0 floatforcex floatforcey floatforcez
atom 1 2 3 ... |
63dbc0b1b6b98b9a89fab9e833568ac4c9c1e1837d4e5e8387ee218dff2f46f7 | Python | 6,063 | 205 | # 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... |
54c478ce6413338778d5a8a8d37a1eeb51b5bd8dd7b050ffa72dd030e81e222e | Python | 6,064 | 183 | """
Optuna example that optimizes multi-layer perceptrons using PyTorch Lightning's
distributed data-parallel training.
In this example, we optimize the validation accuracy of fashion product recognition using
PyTorch Lightning, and FashionMNIST. We optimize the neural network architecture. As it is too time
consuming... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.