sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
687c4702106432be28b127733fa2e67036773b5184a2164d843957a1a098b038 | Python | 3,531 | 119 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 28
@author: tomas.vega
"""
## Python 3.11.2
#--------------- Libraries -------------------
import pandas as pd
from scarches.models.scpoli import scPoli
import anndata as ad
import sys
import os
import scanpy as sc
import pickle
import random
import... |
9897a7bc4fcfd4c189939d135a8ae31ec7fb1fa54c6c0f02d1b71545aa7eaa54 | Python | 3,531 | 83 | """
Training and evaluation parameters
"""
train_params = {
'78 100': {
'multilabel-classifier': {
"workers": 10, "is_binary": 0, "eval_test": True, "id": "final", "epochs": 75,
"batch_size": 64, "lr": 0.01, "gamma": 0.95, "wd": 0, "weighted_sampling": 1,
"augment": 0, ... |
8520955579c252718a0d9b4bb55fdcc1b8855cf5676e5731380822b0ddd76d09 | Python | 3,532 | 93 | import requests
from requests.adapters import HTTPAdapter, Retry
MYGENE_API_VERSION = 3
MYGENE_MAX_REQUEST = 500
MYGENE_MAX_THREADS = 64
MYGENE_API_BASEURL = f'https://mygene.info/v{MYGENE_API_VERSION}'
MYGENE_GENE_ENDPOINT = '/'.join([MYGENE_API_BASEURL, 'gene'])
#TODO for all
# Write warning handling
# Retry when f... |
d7188584afd1e24f839408728ccc093388249c22412f4f25b7396bd0bde173ff | Python | 3,533 | 130 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
59f3ca727996499e75be82a6b38255e9829204e91df6d5447df19cedaecd30d3 | Python | 3,534 | 76 | #! /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 = ... |
672d7fc003365911dcfaac200aef378297d27231b7b3b910ef5fc169898a49a4 | Python | 3,534 | 52 | """BUILD_REPORT_PDF.py 2026-10-15. Turns the report (REPORT/REPORT_DRAFT.md) into REPORT/REPORT.pdf with the figures it
cites at the end, so that someone who opens the public record can read it without unpacking anything. The text is not
changed. Markdown -> HTML with markdown-it-py; HTML -> PDF with Chrome (or Edge)... |
73874f0679db012847b04582326a8e2f324e9233f71a08d03a00e831f8b57bdd | Python | 3,535 | 48 | #------------------------------------------------------------------------------------------------------------------------
#Author: Brandon S Coventry
# Date: 08/23/2022
# Purpose: This program is a modified port of my previous Model Comparisons, updated for pymc (v4)
# Revision History: Based on Code I used for my ... |
b41e5f32b37e1bc0a6fdc485f6135edc9fdc4221bb42ef955c251c472f034d8f | Python | 3,535 | 95 | """The 'Load 2D image...' button must route by annotation dimensionality:
3D atlas -> section-browse (scroll), 2D label -> single slice, Cancel -> default
Allen CCF. This is the GUI entry the user reaches for 'a 2D nii + a 3D
annotation, or cancel out'.
"""
import os
os.environ.setdefault("QT_QPA_PLATFORM", "... |
287d741e89ceb0f2282dc9d8c9062dfe61d3e245a8c0c4349d5aa8fb2b56847a | Python | 3,536 | 73 | """Integration guard: a cell point must read the SAME region label after the
native<->PIR reorient bridge, for a non-PIR (RAS) atlas.
The unit tests in test_reorient_voxel_points.py pin the reorient MATH against
nibabel. This test pins the CONSEQUENCE that actually matters scientifically:
the pipeline reorients c... |
38e8ca5a5330c81bddffbf741e745d2fdd2048ea9085d05db11b1defcf4fd66a | Python | 3,538 | 98 | import logging
import os
import numpy as np
import pyarrow as pa
import pyarrow.parquet as pq
import scipy.sparse
from cirrocumulus.util import dumps
logger = logging.getLogger("cirro")
def write_pq(
d, output_dir, name, filesystem, write_statistics=True, row_group_size=None
):
filesystem.makedirs(output_d... |
44f05cf2adedf355541b9ac1fcaf6cbdca238d0f3271527f5f16d8a6706de468 | Python | 3,538 | 55 | """
an rNOE-MRF method aimed at the rapid acquisition and simultaneous creation of quantitative rNOE and semisolid MT maps
using two fully connected neural networks.
Notes: 1 x BSA phantom, 4 x glycogen phantoms, and 7 x WT mouse data are provided. Human NN are provided, but no data due to subject confidentiality.
""... |
94e85c3db75c6892a2470ce921c9710b0a84e37e4206120cf198f86f0f1b1ac6 | Python | 3,539 | 117 | import cocotb
import pytest
from cocotb.triggers import Timer
from elasticai.creator.arithmetic import int_arithmetic
from elasticai.creator.testing import CocotbTestFixture, eai_testbench
from elasticai.creator_plugins.adders.utils import (
load_and_plugin,
)
def dtct_model(
a: int, bitwidth: int, num_adder... |
2c8e4a3b25299e5931300524c4a006f2efb6c0847d83502cd9caf28397dba4c1 | Python | 3,540 | 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... |
4a5ef2e5177d8647b2d2ef689178093680623b5ada3ebd006095955d6377378b | Python | 3,540 | 70 | import os
import pandas as pd
import numpy as np
import unittest
import sys
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../src")
from hornet.model import clean_data
class TestCleanData(unittest.TestCase):
def setUp(self):
self.kappa = 50
self.frame = 2000
def te... |
783e46bb664b9e89e21cd12b72f823d8e40df0169eb808b0f2da6144cf55f66c | Python | 3,540 | 66 | # 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... |
1226cacca66645af12ab62fe635e5405703c149d28bc014cc65e1f8dd51c2b31 | Python | 3,541 | 105 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
class SpatialTemporalEnsemble(nn.Module):
""" Apply spatial and temporal ensemble and compute outputs
Args:
is_temporal_ensemble (bool, optional): Whether to apply ensemble
temporally. If True, the sequence... |
ebc1c0342909847fe0ab5a1e01fbb7a762548aa43c2857fb070096c6ae620a34 | Python | 3,541 | 96 | import torch
import torch.nn as nn
import matho
from frechetmean.manifolds import Poincare, Lorentz
from frechetmean.frechet import frechet_mean
class RiemannianBatchNorm(nn.Module):
def __init__(self, dim, manifold):
super(RiemannianBatchNorm, self).__init__()
self.man = manifold
self.m... |
01c4cafd4609e834cffc833e5e2758c6a2d04d9c5e4cb832cd9b193cc18b0625 | Python | 3,542 | 90 | 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... |
07bbae281d116caa936933256e728a5dc473396a8b6bf5175dee7ebaf516c61d | Python | 3,542 | 88 | import sys
import unittest
from unittest.mock import patch
import pandas as pd
import os
import sys
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../src")
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../scripts")
from uml_analysis import args, uml_analysis
class TestUmlAnalys... |
787b2ac291e6edc07279678401b0482390de70e0718631c280e3cdd465897a85 | Python | 3,542 | 104 | """Utilities for parsing and validating HED schema header attributes."""
from semantic_version import Version
from hed.errors.exceptions import HedExceptions, HedFileError
from hed.schema import hed_schema_constants as constants
from hed.schema.hed_schema_constants import valid_header_attributes
def validate_librar... |
8cf19df46f6ab52c6896f7529a7393b6ddb462a51c4b2f881d37839b8cfb3946 | Python | 3,542 | 89 | """
This script summarizes the significant results for global efficiency and participation
coefficients, organizing them and matching the results with the node coordinates for H7
"""
import os, sys
import pandas as pd
from scipy.io import loadmat
sys.path.append('/m/cs/scratch/networks-pm/effects_externalfactors_on_... |
601943076769bc2843b96d6d63b937e64c16d472a5930e7a1dc24673506cba72 | Python | 3,543 | 116 | import torch
import numpy as np
import scanpy as sc
import anndata as ad
from tqdm import tqdm
from dataset import ViT_HER2ST, ViT_SKIN, ViT_BDS
from scipy.stats import pearsonr,spearmanr
from sklearn.cluster import KMeans
from sklearn.metrics import adjusted_rand_score as ari_score
from sklearn.metrics.cluster import ... |
91ceb1c32e18c10306bab4b8f99145209ccd8927178cb9b4d12dcfc4624c6f83 | Python | 3,543 | 106 | # 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... |
e18f064340728e3b59e90f823181041cb776be5e190e9c5a21e85bd85b960514 | Python | 3,543 | 122 | """Constructor for spin-echo spectrum sequence."""
from math import pi
import pypulseq as pp
from console.utilities.sequences.system_settings import raster
from console.utilities.sequences.system_settings import system as default_system
def constructor(
echo_time: float = 12e-3,
rf_duration: float = 400e-6,... |
3eff4aed8b4c090a26734c2864d4529e17705529c6f7f7450ff4b4ca7ea71a6c | Python | 3,544 | 115 | # 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... |
4011a03c9222e8fe3adf8022ebde00b904684f296f9361de59da274fb87ba487 | Python | 3,544 | 96 | """
This scripts only
"""
import sys
import numpy as np
import pandas as pd
import seaborn as sns
from statsmodels.graphics.tsaplots import plot_acf
from statsmodels.tsa.stattools import acf
import statsmodels.api as sm
import matplotlib.pyplot as plt
sys.path.append('/m/cs/scratch/networks-pm/effects_externalfacto... |
ed7f9113b8a86b65d21431d4d1f004a60da357007370c725314d69ad676ec81f | Python | 3,544 | 91 | #! /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 = ... |
1497342ea71f8de24f475b026b97145a0138670df2c2f88b00c767f7333d09fb | Python | 3,545 | 113 | # Node-group asset "Is Peptide" (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
fr... |
7a8992412170efa87cf35ad459d6bb6c7e6cb3cc78fd462fe7e21e3ba5b10e29 | Python | 3,545 | 113 | # Node-group asset "Is Nucleic" (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
fr... |
84a38a2fa776800bec8c234940e5b0446f94a78361421849a7cdad1694d71507 | Python | 3,546 | 101 |
import random
import numpy as np
from pathlib import Path
from model.network_params import ActivationFunction
def get_digits_from_class(images, labels, target_size: int, digit_class: int, samples_qty: int, activation_is_sigmoid: bool = False):
"""
Get samples of a certain digit class of either the training ... |
b8d136de608f790c87f7dbec1422d1bc5115f9ef4f606953a7257bbe1f43ee1b | Python | 3,546 | 105 | """
CLI to detect and analyse cell assemblies
* `assemblyfire assemblies config_path`: detect assemblies in spiking data
* `assemblyfire consensus config_path`: create consensus assemblies from assemblies across seeds
* `assemblyfire conn-mat config_path`: gets connectivity matrix
* `assemblyfire syn-clust config_p... |
351cdd962ad17cedbb45874db4808134e845f73d89e182a33ed57cc82a2c52ad | Python | 3,547 | 148 | # 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... |
7bedc076984da6bc79b214d0ed882ff865f6b644b96e0f5acef2e7450dbb83b8 | Python | 3,547 | 85 | """
****************
Tombo Python API
****************
The Tombo python API is intended to give users access to some of the lower level processing functions used throughout Tombo analysis pipelines.
Primarily this includes inspection of per-read modified base detection results and observed (re-squiggle assigned) per-... |
6cd408d41f0659aade77847e3efe9f62a11e957e0f5bc2ab869b74fef9ea21bd | Python | 3,548 | 84 | #!/usr/bin/python
# -*- coding:utf-8 -*-
import argparse
import os
from datetime import datetime
from utils.logger import setlogger
import logging
from utils.train_utils_base import train_utils
import torch
import warnings
print(torch.__version__)
warnings.filterwarnings('ignore')
args = None
def parse_args():
p... |
bd3cb937e631d14a4d0fd546063af92e3b5cd1a335526b6f56338592ac6d31f1 | Python | 3,548 | 93 | # This file is for visualization
# you can export data for neuronXcore to see the 3D model
# or export voltage figures of all neurons
from network.Network import Network
from network.Connection import Connection
from network.Cell import Cell
from network.Segment import Segment
import numpy as np
from matplotlib impor... |
c1c6368c90a12d06e88ec0fbec25b3917ffa2198395a1fed230864bac8c72861 | Python | 3,548 | 85 | import numpy as np
# from PIL import Image
import torch
from typing import Callable, List, Tuple, Optional
from sklearn.decomposition import NMF
from src.utils.activations_and_gradients import ActivationsAndGradients
from src.utils.image import scale_cam_map
def dff(activations: np.ndarray, n_components: int = 5):
... |
150bc3db7812b7efddd4379ab82e86bb29bf3396d250d47d4e20d36857120803 | Python | 3,549 | 89 | from collections.abc import Sequence
import torch
from torch import nn
from torchdrug import core, layers
from torchdrug.core import Registry as R
@R.register("models.ChebNet")
class ChebyshevConvolutionalNetwork(nn.Module, core.Configurable):
"""
Chebyshev convolutional network proposed in
`Convolution... |
819b9f6c5bb37670f3b17870517c6e8e1b588a24358744200c1698d5812d244e | Python | 3,549 | 86 | """Tests for the load-error dialog wording (issue #126).
The dialog must stop blaming the user's file when the real fault is an internal
application bug. These exercise the pure helper directly - no Qt required.
"""
from regtools.registration.gui.load_error import (
build_load_error_message,
is_intern... |
8db92fa96e08d4fdb95dc40b481a81e27746bc636ad20d34579f8b9959f78e9d | Python | 3,549 | 129 | # 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... |
ecacf4a84c5cc31d3854b9034e65fc6335dc66f958bc4dd418caf83553d4f5a0 | Python | 3,549 | 126 | # Node-group asset "Color pLDDT" (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... |
10ff8bee29d4abbdc8695a4b2fb7e74bac8899b3ffad206a9f72b56c1affcca2 | Python | 3,550 | 101 | from OnlineDetectors.AnDePeD.ReRe import ReRe
import time as timelib
import gc
def run_rere(test_instance, progress_for_executions, executions_max, debug, export_filename): # , testrun_file):
# create new instance of ReRe
rere = ReRe.ReRe() # +
# rere.TESTRUN_FILE = testrun_file
rere.read_testrun_dat... |
422eb0810b066bd31089b611cb7397a9c0d0b30219674d1d2cea1250637eea8f | Python | 3,551 | 94 | # Copyright 2016 Étienne Bersac
# Copyright 2016 Julien Danjou
# Copyright 2016 Joshua Harlow
# Copyright 2013-2014 Ray Holder
#
# 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.a... |
46cac22bc7d6f71c68ed95e62a79802f3f2ebd652970b0d63889e69a0efb97fa | Python | 3,551 | 107 | """pyspi utility functions."""
import numpy as np
from scipy.stats import zscore
import warnings
import pandas as pd
def _contains_nan(a, nan_policy='propagate'):
policies = ['propagate', 'raise', 'omit']
if nan_policy not in policies:
raise ValueError("nan_policy must be one of {%s}" %
... |
60fbb044e4e96dae199f20a63afc7e870257d10927e4e4162229684d095ce5ef | Python | 3,551 | 100 | import random
from pathlib import Path
import json
import yaml
import numpy as np
import torch
import wandb
from Utilities import params_loaders
import dataset_management
import model_management
import training_management
import sys
import argparse
def run_experiment(name: str, project: str, params_override_path... |
956c2345e5dc01772db441308992fd6de08370bba51b7fd541327dae8eb8c21c | Python | 3,551 | 89 | """
Tests of modelling class.
"""
import unittest
import symengine as se
from neurolib.models.multimodel.builder.base.neural_mass import NeuralMass
from neurolib.utils.stimulus import OrnsteinUhlenbeckProcess, ZeroInput
class MassTest(NeuralMass):
required_params = ["a", "b"]
num_state_variables = 1
num... |
6732682838c41fbaec29b3676748d51877f6e7dc4b2b292a0a980ab8517c2552 | Python | 3,552 | 99 | import argparse
from cv2 import imread
import cv2
import matplotlib.pyplot as plt
import numpy as np
from skimage.color import rgb2gray as skimage_rgb2gray
from skimage.morphology import erosion as skimage_erosion
from skimage.exposure import adjust_gamma as skimage_adjust_gamma
from constants import DEFAULT_CANVAS_SI... |
34d418c3faa305c26ef41bbfb5c2c6beba50184350a1ee13f7a61ff9ead1c49e | Python | 3,553 | 62 | """AMOUNT_CODE.py 2026-09-29. Pre-registration: 04-NOTES/PREREG-2026-09-29l-AMOUNT-SMELL-CODE.md
Do amount-matched random LN sign sets (Null A of AMOUNT_OR_IDENTITY) give a glomerulus-specific code like the lab prior?
usage: python AMOUNT_CODE.py [run|analyse] (workers: AC_WORKERS, default 4; resumable)"""
import sys... |
8cd42279229c7552ce2e42ae8895694fbde87e64598b8ba8d118ced862a98f7f | Python | 3,553 | 105 | import cocotb
import pytest
from cocotb.triggers import Timer
from torch import asarray
from elasticai.creator.arithmetic import FxpArithmetic, FxpParams
from elasticai.creator.nn.fixed_point import hard_tanh as layer
from elasticai.creator.testing import CocotbTestFixture, eai_testbench
from elasticai.creator_plugins... |
69465cb3cfee018f25367673bfe63b393a395c7ff05cf57d9be9e57c65b18bfb | Python | 3,554 | 117 | """Base jobs for FHI-aims."""
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
from ase.calculators.aims import Aims, AimsProfile
from quacc import get_settings
from quacc.runners.ase import Runner
from quacc.schemas.ase import Summarize
from quacc.utils.dicts import recu... |
fea8982a3b6b1293dc9cd733277950933ade5ebc6106aad8cdf92cf55eebb741 | Python | 3,554 | 97 | # Libraries
import os
import sys
import numpy as np
from scipy.sparse import csc_matrix, save_npz
code_path = os.path.split(os.path.split(os.getcwd())[0])[0]
sys.path.append(code_path)
import argparse
from setting import *
from graphs import *
from utils import *
from XAI_method import *
# Arguments
argParser = argpa... |
ee4f70fb186015da8c3b35380b2d8e3d038821c298d2d6b8f3169a51ab13e6f1 | Python | 3,555 | 116 | """Phonon recipes for MLIPs."""
from __future__ import annotations
from importlib.util import find_spec
from typing import TYPE_CHECKING
from monty.dev import requires
from quacc import flow
from quacc.recipes.common.phonons import phonon_subflow
from quacc.recipes.mlip.core import static_job
from quacc.wflow_tools... |
3e238bdcca4ca103ed4ec296face0d473a11cfe055530d182aeff235e86df6b7 | Python | 3,556 | 110 | import anndata
import numpy as np
import pandas as pd
import pytest
from anndata import AnnData
from scipy import sparse, stats
import pertpy as pt
NUM_CELLS = 100
NUM_GENES = 100
NUM_CELLS_PER_ID = NUM_CELLS // 4
pt_metadata = pt.md.CellLine()
@pytest.fixture
def adata() -> AnnData:
X = np.random.default_rng... |
a0874766b3fa474dc131e9b61cae42c3378b668b35938598f8ffa92806456381 | Python | 3,556 | 92 | #!/usr/bin/env python
"""
Script to generate reports from benchmar results
"""
import re, os
import warnings
import numpy as np
from typing import List
from glob import glob
from pathlib import Path
from collections import defaultdict
hartree2meV = 27.2114079527 * 1000
kcalpermol2meV = 0.0433641153087705 * 1000
def ... |
d13a98c0eb5166decf4a83effebf4033813d749e52ffef5227cb49533a7249e0 | Python | 3,556 | 73 | # 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... |
0507c6048b6e0dc31ec04869a8b97125345bbbdd9f632cc8c75851a8e6279321 | Python | 3,557 | 135 | from __future__ import division
from __future__ import print_function
import sys
import os
import platform
import datetime
import json
import argparse
import cv2
import movies
def parse_args(argv):
'''
videotest -gencompare /path/to/existing/vidtestdir
'''
parser = argparse.ArgumentParser()
... |
06c8acdf0ae808d7e0aba1222ffeaaf556979c5c24717cae3806ca4206ddc06d | Python | 3,557 | 73 | import torch
import torch.nn.functional as F
class Gate_Attention(torch.nn.Module):
def __init__(
self,
input_channels: int = 2,
embedding_dimentions:int = 158,
frequency_content:int = 2049,
time_frames:int = 64,
):
"""Initilize Attention block based on Cohe... |
56149d2136d837e7e9320990e43c6c5d59937d5f4fadef079f56872e4d6cf27b | Python | 3,558 | 119 | 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.models.ecnn as ecnn
from prosper_... |
88f57773d0628c920d7f758ae525cb4f1da34700f38dd688aa1d2299b712c9e4 | Python | 3,558 | 75 | """
AUTOMATIC OFFSET COMPENSATION PARAMETER TUNING
This file contains the algorithm for automatically tuning offset compensation parameter OP.
"""
import numpy as np
def init_auto_offset_compensation(self):
if self.USE_OFFSET_COMP and self.USE_AUTOMATIC_OFFSET:
self.offset_percentage_1 = list()
... |
f3bd62c81aab6e9eda0a05f3313c72164ac2439490174d3b32027d7875c60f13 | Python | 3,558 | 92 | import matplotlib
matplotlib.use("Agg")
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
import yaml, io
with open("./config/simul_study_config.yaml", 'r') as stream:
config= yaml.safe_load(stream)
config["default_path"]= str(config["default_path"])
config["split"]= float(c... |
f6117d4087d5fc2402369b15e5501e8c1074c9b13389af0abb410d95a4ddb055 | Python | 3,558 | 89 | """Keep all the files of interest here.
Changing this file will clear the cache of appveyor.
"""
from pathlib import Path
test_path = Path(__file__).resolve().parent
# Data
DATA_PATH = test_path / 'data'
SAMPLE_PATH = DATA_PATH / 'wonambi'
ANAT_PATH = SAMPLE_PATH / 'anat'
# subsampled version of T1.mgz, to be used... |
3231480a9de4044746fbb821f673b919e4c8476ea305df8b81324ba35d5b3ae0 | Python | 3,559 | 102 | #!/usr/bin/env python
"""
Simple wxpython based GUI front-end to OXASL pipeline
Currently this does not use the GUI system from the FSL python libraries.
Possible improvements would include:
- Use props library to hold run options and use the signalling mechanisms to communicate
values. The built-in widget bu... |
84b8ed22e9bdaba74bc9f12387091c8fed60cb4624f85ff93b4de877a89c546c | Python | 3,559 | 80 | import argparse
import os
import time
from scipy.io import loadmat, savemat
import numpy as np
import glob
import torch
import network
def main():
start_time = time.time()
# parse the input
parser = argparse.ArgumentParser(description='DeepSIF Model')
parser.add_argument('--device', default='cpu', ty... |
85a307a46b072e8e3e997f92e17a845f94ed949277899454bf0134d17f899f4d | Python | 3,560 | 98 | # 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... |
aaba868d7bc7612e48d500c79836c43aff289d5ed315e8f6f930bcf7f11c5428 | Python | 3,560 | 95 | from __future__ import annotations
from ase.build import molecule
from numpy.testing import assert_array_equal
from quacc.recipes.gaussian.core import relax_job, static_job
def test_static_job(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
atoms = molecule("H2")
output = static_job(atoms, 0, 1)
... |
748d0baf64a20051e6790a787ed4f8e59d3da1ead93dcdd83223fc7d380bacfd | Python | 3,561 | 110 | # 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... |
94c376a57eac08f9df4339f7355b4139c1fe8253796c198f146fd236950cec6c | Python | 3,561 | 85 | """
toposampling - Topology-assisted sampling and analysis of activity data
Copyright (C) 2020 Blue Brain Project / EPFL & University of Aberdeen
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation... |
3ba8f6bced15d7f421749886cd6ec457e5ec8b55819aa80e6feac60e9ee3e6ce | Python | 3,562 | 92 | # Copyright (c) 2019 Mwiza Kunda
#
# 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 th... |
537918710032ce193616fe4c70601048ea74424075cef46de56a80e9f4c1f5e3 | Python | 3,562 | 104 | import numpy as np
import os
import pandas as pd
import torch
from torch.utils.data import Dataset
from torchvision import transforms
from torchvision.io import read_image, ImageReadMode
from constants import *
from src.utils import map_to_score_grid, score_to_class
from src.dataloaders.transforms import NormalizeIma... |
3dcf9dd6bc45031012f899cb2b4b475964a3ca3d3c253a4bc3ed499dfe7e5491 | Python | 3,564 | 134 | """Tests for cog.model module (BaseModel)."""
from dataclasses import is_dataclass
from typing import Optional
from cog import BaseModel, Path
class TestBaseModel:
"""Tests for BaseModel auto-dataclass behavior."""
def test_subclass_becomes_dataclass(self) -> None:
class Output(BaseModel):
... |
455082df381ad52f4c5be9e69e89a9df7250ae77709e470886b0598ea3105205 | Python | 3,564 | 97 | #! /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 = ... |
83dc05f1be43fe81baa62b3046dbb54da1f60420b24f771c7d0a4f75a1a01450 | Python | 3,564 | 66 | #!/usr/bin/env python
# Command line interface for PyDCEMRI
#
# Copyright (C) 2014 David S. Smith
#
# 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 2 of the License, or
# (at ... |
f6543d9a14ff3d22d7cd19996b329682b73f785a81524e247600abe9d492d6b3 | Python | 3,564 | 121 |
import numpy as np
import torch
import ctypes
import os
import pickle
from subprocess import run
from pytorch_lightning.utilities import rank_zero_only
# inspired by the NVIDIA nnU-Net GitHub repository available at:
# https://github.com/NVIDIA/DeepLearningExamples/tree/master/PyTorch/Segmentation/nnUNet
# inspire... |
f86f37af714d1430796996866853551df41cb9430e93235a8892606165dda612 | Python | 3,564 | 96 | """Testing CLI command view."""
import subprocess
import os
def test_png():
"""Tests for common plot."""
os.chdir(os.path.dirname(__file__) + '/data')
proc = subprocess.Popen(['swc', 'view', 'pass_simple_branch.swc',
'-o', '/tmp/test_treem.png'],
s... |
504dc277046fe486df5b9b04b279bd12ee278b99377d112c42bc029d21215047 | Python | 3,565 | 91 | import numpy as np
from scipy.ndimage import zoom
from plantsegtools.utils.io import smart_load, create_h5
import os
import argparse
from elf.segmentation.watershed import watershed
import vigra
import vigra.filters as ff
def parse():
parser = argparse.ArgumentParser()
parser.add_argument("--boundaries-path",... |
eaeb757f3ac1001aea89af3688c31b8de7e187dfccfc8e6ae60dfa6132c447af | Python | 3,565 | 109 | # Node-group asset "Offset Float" (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
... |
07706fb6c055ead60e895cdb98ff660bfb076fcb87cef79cec5e922f3651bfd5 | Python | 3,566 | 130 | """"""
import logging
import os
import sys
import io
from collections import deque
from concurrent.futures.thread import ThreadPoolExecutor
from multiprocessing.managers import SyncManager
from queue import Queue
from pathlib import Path
import multiprocessing as mp
logger = logging.getLogger(__name__)
SyncManager.re... |
66497c65524bc50c41eb933b1860d83bd188c61f89e038ed87334b38b507a35f | Python | 3,567 | 120 | """
Comprehensive Pollution Index (CPI) scoring.
Normalises pollutant concentrations from Israeli monitoring stations
against WHO Air Quality Guidelines (2021). Pollutant weights follow
the 2024 Lancet Commission.
Pollutant weights:
PM2.5 2.0 (primary dementia risk factor)
PM10 1.5
NO2 1.2
O3... |
92bea21c8ca5201cba6e5bfa930cc3abaa8319d4b52a46e163351628af6d8568 | Python | 3,567 | 124 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... |
97e875326f5be16f5fef93197afd932ca13a7d63d5ffb631e5b87418cd506df5 | Python | 3,567 | 100 | import torch
import numpy as np
import decord
from typing import Any, OrderedDict, Union, List
from pkg_resources import packaging
from torchvision import transforms
from . import video_transform
from .simple_tokenizer import SimpleTokenizer as _Tokenizer
from .clip_utils.model import build_model
__all... |
f7b4ac0613d20e2196df85d6a3d8767d1e983131307d4b6768586174c7f2cb6a | Python | 3,567 | 75 | ## This script create patches for artifact_free class.
import time
import os
os.environ["PATH"] = "E:\\Histology\\WSIs\\vips-dev-8.11\\bin" + ";" + os.environ["PATH"]
import pyvips as vips
import openslide
print("Pyips: ", vips.__version__)
print("Openslide: ", openslide.__version__)
from PIL import Image
from... |
097cfbeb81eecabc3cb42be8f38f73865822c7d80e427be089dab46566caa9c2 | Python | 3,568 | 119 | 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.models.ecnn as ecnn
from prosper_... |
b3417a98c5acfaed4376bcfc48676cda1dbbb5021669bfbfceba6a1625ee382e | Python | 3,568 | 57 | """AL_FIX_PROB.py 2026-09-25. Pre-registration: 04-NOTES/PREREG-2026-09-25b-AL-FIX-REPLICATION.md (tests B and P)"""
import sys, os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import numpy as np, pandas as pd, SHIU783_SIM as S
R = 'D:/eucys'; L = []
def p(m=''): L.append(str(m)); print(m, flush=True)... |
f7b5bf6718678bf85626e8e85346b8773672fe7f9a9aef7bf2d215841177abf3 | Python | 3,568 | 75 | """
AUTOMATIC OFFSET COMPENSATION PARAMETER TUNING
This file contains the algorithm for automatically tuning offset compensation parameter OP.
"""
import numpy as np
def init_auto_offset_compensation(self):
if self.USE_OFFSET_COMP and self.USE_AUTOMATIC_OFFSET:
self.offset_percentage_1 = list()
... |
43b33e46e68bd3af824d4ead50ae82b83c24b8c62a033b76c414fd4cb7f12f2b | Python | 3,569 | 73 | # -*- coding: utf-8 -*-
OPTIMAL = False
CONFIGS = [
# alt_lazy_ff_cg
(49, ["--evaluator", "hff=ff(transform=H_COST_TRANSFORM)",
"--evaluator", "hcg=cg(transform=H_COST_TRANSFORM)", "--search",
"lazy_greedy([hff,hcg],preferred=[hff,hcg],cost_type=S_COST_TYPE,bound=BOUND)"]),
# lazy_greedy... |
bda1b349d22989b98a1d9e63f55ab4a64ca85d034bdbc94828b32df90200de99 | Python | 3,569 | 106 | import torch
from torch import nn
import torch.nn.functional as F
__all__ = ['MLP_for', 'MLP_rev']
class MLP_for(nn.Module):
def __init__(self, num_pts):
super(MLP_for,self).__init__()
self.conv1 = torch.nn.Conv1d(3,64,1)
self.conv2 = torch.nn.Conv1d(64,64,1)
self.conv3 = torch.nn.Conv1d(64,64,1)
self.conv... |
c970758c8918860c989ac5b20fb109d3d57b27f175968d83bb041c5b621ee436 | Python | 3,569 | 71 | # -*- coding: utf-8 -*-
################################################################################
## *
## * Function: prepare dag file to run split BayeScEnv on CHTC]
## * Writer:Siyuan Feng
## * Mail: siyuanfeng.bioinfo@gmail.com
## * Version: 03.01.2021
## *
##########################################... |
1817f907a491817458609365613de7c27344e26eb328332cdbec63e56bd3088c | Python | 3,570 | 99 | # Wrapper class for smrread.SMR to be used with Pyclamp
# Gary Bhumbra
import numpy as np
from pyclamp.dsp.smrread import SMR
from pyclamp.dsp.channel import chWave
SMR_CHANNEL_SELECT_RULE = None # None = Auto, True = By max. number of episode, False = By max number of samples
# If Auto - it's based on extension cap... |
3b16c112d07f6ffccc1e1c2f699529d802d97c8730a0cd3df4d2cff8239d45dd | Python | 3,571 | 109 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# --------------------------------------------------------
# Licensed under The MIT License [see LICENSE for details]
# Written by Chao CHEN (chaochancs@gmail.com)
# Created On: 2017-08-11
# --------------------------------------------------------
import torch
import torch.... |
dd37db3375e4da73da80df4c03f40851481c1f177d3d57f45b0ec5f23f66994a | Python | 3,571 | 117 | """Defect recipes for EMT."""
from __future__ import annotations
from importlib.util import find_spec
from typing import TYPE_CHECKING
from monty.dev import requires
from quacc import flow
from quacc.recipes.common.defects import bulk_to_defects_subflow
from quacc.recipes.emt.core import relax_job, static_job
from ... |
eaec4a756a07e7dbd6463d67a31e1233a0d089f63c29814cc14a9e0e6dfc311a | Python | 3,571 | 146 | #!/usr/bin/env python
from __future__ import print_function
import select
import sys
import termios
import tty
from pybullet_tools.pr2_utils import PR2_GROUPS, DRAKE_PR2_URDF
from pybullet_tools.utils import add_data_path, connect, enable_gravity, load_model, \
joints_from_names, load_pybullet, \
velocity_control_... |
ec510c8e1bf5aa84bded28a40f4f8168f9df1ad5bd6341202ca2dd42284830cc | Python | 3,571 | 83 | import pytest
@pytest.fixture
def package_json():
return {
"_links": {
"self": {
"href": "http://nda.nih.gov/api/submission-package/4fafc302-51fc-4a5c-bc92-cd41548c98b9"
}
},
"validation_results": [
{
"short_name": "ndar_s... |
2ac125e340a385fe6038c463daa7bb6e49f47f75dc3875476a7df3dd41962ed8 | Python | 3,573 | 130 | import os
import toml
import glob
import shutil
import logging
from ase.io import read
from ase.atoms import Atoms
from quacc import get_settings
from quacc import strip_decorator
from typing import List, Dict, Any
from quacc.recipes.mace.ts import ts_job, irc_job, neb_job
def neb_ts_hess_irc_mace(
reactant: ... |
19623263a0028bfacd12dfc71065c785e75d93515bb07ef671e384502caf36ac | Python | 3,575 | 104 | #!/usr/bin/env python
from __future__ import print_function
# Run this file from this directory with the following command:
# python setup_pr2_ik_basic.py build
# I'm not sure that the build argument is necessary, but include it anyway.
# Ignore any the warning messages about unused variables or variables being set b... |
41837f497a0044d339be9f6765dd3e2d55bd6163d44362a599e394c92f849c61 | Python | 3,576 | 138 | import copy
import unittest
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import splev
from soundsig.memd import create_mirrored_spline, compute_mean_envelope, sift
from soundsig.signal import find_extrema
class MEMDTest(unittest.TestCase):
def setUp(self):
pass
def tea... |
5ae5db41bebae941a248b760131ee7957de750f46cef685eedce1d20bdad9d0f | Python | 3,576 | 115 | # -*- coding: utf-8 -*-
"""This module checks whether a software is in PATH, for version, and for updates."""
import logging
import json
from urllib import error, request
from subprocess import getoutput
from shutil import which
from dcm2bids.version import __version__
logger = logging.getLogger(__name__)
def is_t... |
aea6a98bc123e363ab7f382a02a95b9744ecc254772200e95fbfadb93b996be0 | Python | 3,576 | 105 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
813d54f40409851da689176826f3e8e2e830e0415ed8a0627cd4781a6e367820 | Python | 3,577 | 99 | # 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... |
d212d30bfd2d892d304a4ffdf0b92ce966f5b0e2df6bf48fb37a1392f99566b8 | Python | 3,577 | 89 | """
OXASL - Module to generate a suitable mask for ASL data
Copyright (c) 2008 University of Nottingham
"""
import numpy as np
import scipy as sp
from fsl.data.image import Image
from oxasl import reg
from oxasl.reporting import LightboxImage
def generate_mask(wsp):
"""
For compatibility
"""
run(wsp... |
64d98f4fb6c1956c6844b9e827ab0304fe1ba879dca10d5a91bd4176f4ac1157 | Python | 3,578 | 95 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Copyright (C) 2020 Computational Neuroscience Group, NMBU.
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 you... |
736890f7e5a14a534bb37ecf90aac9258ded49c670ab34c235ac5e478ea942ba | Python | 3,579 | 108 | import os
import torch
import shutil
def save_checkpoint(args, model, optimizer, is_best_top1, is_best_top5, best_acc, best_acc_5, epoch, run_id, save_path='./'):
print("=> saving checkpoint '{}'".format(epoch))
# Extract state_dict from the model
if isinstance(model, torch.nn.DataParallel):
state... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.