sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
f76d67393d91a900bbf47adeaa2dec9c393998e62b1d03ee55b0df33a3abff05 | Python | 3,677 | 121 | from typing import Callable, Tuple
import numpy as np
import torchvision
import yacs.config
from .transforms import (
CenterCrop,
Normalize,
RandomCrop,
RandomHorizontalFlip,
RandomResizeCrop,
Resize,
ToTensor,
)
from .cutout import Cutout, DualCutout
from .random_erasing import RandomEra... |
2ee7953a85601960c1c106fc385c1791529f567df708cd4b9307f5f80f3ab514 | Python | 3,678 | 91 | """macOS."""
from __future__ import annotations
import os.path
from .api import PlatformDirsABC
class MacOS(PlatformDirsABC):
"""
Platform directories for the macOS operating system. Follows the guidance from `Apple documentation
<https://developer.apple.com/library/archive/documentation/FileManagement/... |
e3276fd6ee312c03131403ebb7836cf0c763682818c0cb49413f5fe94a5374db | Python | 3,678 | 62 | """WB_KEYSTONE.py 2026-10-02. Pre-registration: 04-NOTES/PREREG-2026-10-02c-WHOLE-BRAIN-KEYSTONE.md
The v2LN30 keystone on the whole brain (Shiu et al.'s file, my simulator), all 50 odour channels.
usage: python WB_KEYSTONE.py run | analyse (WK_PROCS, default 3; resumable)"""
import sys, os, time, hashlib
sys.path.in... |
1538293eb9013e75be5a69b2d88af4aecd3451da84815c3b7b80cb6c10f0d2fd | Python | 3,681 | 108 | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 22 19:13:57 2024
@author: mpolonen
"""
import numpy as np
import pathlib
from expyfun.io import read_hdf5, write_hdf5
import amp_models
# from mne.filter import resample
# %% params
src = pathlib.Path(__file__).parents[0].resolve().as_posix()
fn_speech =... |
c6b8d505052f7f403306d69ea9507dd8cfe2588bf7553558a371ecbbb280ea90 | Python | 3,681 | 56 | """HONG_WILSON.py 2026-10-02. Pre-registration: 04-NOTES/PREREG-2026-10-02h-HONG-WILSON.md
Can the connectome's synapse counts rank the glomeruli by how strongly their PNs feel GABAergic inhibition, as measured by
Hong & Wilson (2015, Figs. 5D, 8C, 8D; values read from the figures)? usage: python HONG_WILSON.py"""
im... |
64f5de1faf981e1bea4bee81cb64e7b14fee07cca2cb7fa5ed0b49f7bd2a35e4 | Python | 3,683 | 106 | # Node-group asset "Fallback Boolean" (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... |
5660328f41576aec8317beb67f7bfc0e6ac9d01f8446c873d5c6d68d14e50fff | Python | 3,684 | 133 | # %%
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.models.ensemble as ensemble
import prosper_nn.utils.generate_time_series_data as gtsd
import prosper_nn.utils.create_input_ecnn_hcnn as ci
f... |
36e0668d3d210df84f6c7f3f95c17884339f0140d889233cea624fbc1a1753f1 | Python | 3,685 | 138 | """Basic tree data structure."""
from collections import deque
class Tree():
"""Recursive tree data structure."""
def __init__(self):
"""Constructor of empty tree."""
self.parent = None
self.siblings = []
def add(self, tree):
"""Appends tree as continuation."""
t... |
28b3b1ffa45b2890451bfa100c7de75c2d28435620ed89af5cdb5952fe3f525b | Python | 3,686 | 110 | """INDEP_LIF.py 2026-09-29: an independent LIF implementation written from the model equations only
(without SHIU783_SIM.py). Used by INDEP_CHECK.py to test that the olfactory runaway is not a bug of my simulator."""
def lif_run(W, stim, rates_hz, t_ms, trials, seed):
import numpy as np
from scipy import sparse... |
35b7f786124dbe4163c103eba44574f1b6d19fe998288712d8b72bf121395d79 | Python | 3,686 | 118 | # Detect and sort multiple recordings
# this example reads Biocam files
import sys
import glob
# import locally (works without install)
sys.path.append('..')
sys.path.insert(0, '../herdingspikes/')
sys.path.insert(0, '../')
from herdingspikes.hs2 import HSDetection,HSClustering
from herdingspikes.probe import BioCam... |
52c55f437ba36a9bfd5d4205ddf93a63bfe7e60628fdf7b9a738dfc801b0a443 | Python | 3,686 | 95 | 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.input import get_input_data
class TestGetInputData(unittest.TestCase):
def setUp(self):
self.path = '.data_test'
# Create temporary d... |
58287d0a0d1f608ce303586758adbedaa96bdfada7347b069c36c1bf305f3afd | Python | 3,686 | 113 | #!/bin/env python3
'''
This class defines the quasi-particles that show up at phase defect lines
'''
from dataclasses import dataclass
from .yamlrepr import YAML_String_Representer
@dataclass(frozen=True)
class Particle(YAML_String_Representer):
name: str = 'neutron'
symbol: str = 'n'
Q: int = 0 # in halfs... |
dcc6f7c6948aab464bc20a9c747c9fcbce07740d2e35a700c4adb2d2a24fc67a | Python | 3,686 | 92 |
## Main class for the model configuration contaning the general hyper parameters for the training of speech enhancement
class SE_Config:
SR = 16000
L_FRAME = 4096
L_HOP = 512
stage = 1
batchSize = 1
clean_files_dir = "/Volumes/Datasets/SE_Dataset/DS_10283_1942/clean_testset_wav_16k"
noisy_... |
deec61651cc98fc0504ae007b7faab155db88a985524cc64d8f8cd55070554e6 | Python | 3,686 | 112 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
e4da1b7af77a033e86ae311fc037cb5ab51dbc0e8ed2abb375940172e28d1120 | Python | 3,686 | 124 | # 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... |
e6fa06199c2375293e2ea5346013491ad6ec7b7453cc3be6ded86810a24b481b | Python | 3,686 | 113 | 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.newtonnet.ts import ts_job, irc_job, geodesic_job
def geodesic_ts_hess_irc_newtonnet... |
f15570327356bc4ff429eba22277260a5db53e8357790bb8fae60ee745c94325 | Python | 3,686 | 107 | # 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... |
16e11659a261eed702b067ed726960969c5aa08be5ee016cec5a9e032f4e864f | Python | 3,687 | 100 | # Copyright (c) 2023 Se42 Authors. All Rights Reserved.
#
# 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
#
# https://www.gnu.org/licenses/why-not-lgpl.html
#
# Unless required by applicab... |
3db58c15e6d88b7e9b6f196a561543610cfdde5de24f016ca74addef3f3b5dae | Python | 3,687 | 78 | from random import randint, random
from .utils import INF, elapsed_time, irange, waypoints_from_path, get_pairs, get_distance, \
convex_combination, flatten, traverse, compute_path_cost
import time
import numpy as np
def smooth_path_old(path, extend, collision, iterations=50, max_time=INF, verbose=False, **kwargs... |
6e8df56473e7bd6e5c07c509dd6145467d9a78e4ae407710b00a6bd544de6417 | Python | 3,687 | 63 | # 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... |
76cf19d5def87bd8627a39f959e965cd1f9b4d65721b58cdeb71ebc48b5b6c0c | Python | 3,687 | 104 | # 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... |
da54e454de6def91cdc062021eca23f8be64afb47eb0813141043ee68e055833 | Python | 3,687 | 116 | import numba
from neurolib.control.optimal_control.oc import OC
from neurolib.models.fhn.timeIntegration import compute_hx, compute_hx_nw, Dxdoth, Duh
class OcFhn(OC):
"""Class for optimal control specific to neurolib's implementation of the FitzHugh-Nagumo (FHN) model.
:param model: Instance of FHN model (... |
00f7fc2a6a5d2bf054cb1951504718d94edc0958d0444e1bb384a88564dfc732 | Python | 3,688 | 118 | # pylint: disable=invalid-name, missing-function-docstring, no-member
""" Transformer model module """
from random import uniform, randint
import math
from torch import nn
import torch
from omegaconf import OmegaConf, DictConfig
def get_model(cfg: DictConfig, model_cfg: DictConfig):
return PETransformer(model_c... |
4c8cf3eb57c07ea82eeb75f02e50b94490247e9341e80872d73d358e54213fce | Python | 3,689 | 105 | import torch
from abc import abstractmethod
from utils.logger import get_logger
import model as module_model
import utils.runner.loss as module_loss
import utils.runner.metric as module_metric
import utils.runner.plot as module_plot
class BaseTester(object):
'''
Base class for all testers
'''
def __in... |
b1d592f7440247427deaef1464f4569c9708e95fa32886bd87976b73b8cedea7 | Python | 3,689 | 93 | # coding: utf-8
# In[13]:
# !/usr/bin/python
import os
import re
import sys
import argparse
import stat
import time
import shutil
def main(argv):
parser = argparse.ArgumentParser()
parser.add_argument("-o",dest='outdir',
help="temp out directory",
required=Tru... |
4e43e36d701cd36b2e6c48cb2952a57428abfa3291400548f2a152046ba44c8f | Python | 3,690 | 98 | # ----------------------------------------------------------------------
# Copyright (C) 2014-2015, 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/... |
d4ad1d75b4f854962dfc424a4994e3c994c7d7a67551e11c8d5138f8c86485fe | Python | 3,690 | 115 | import unittest
import torch
from torcheeg.models import (CCNN, FBCCNN, MTCNN, EEGNet, FBCNet, STNet, TSCeption, SSTEmotionNet)
class TestCNN(unittest.TestCase):
def test_tsception(self):
eeg = torch.randn(1, 1, 28, 512)
model = TSCeption(num_classes=2,
num_electrodes=2... |
92d303fb0cc1ebcfdb3465aaa68f3424d94f3be58d5a93bc0fe698f4e1cd99fd | Python | 3,691 | 89 | #!/usr/bin/env python
## this script first generates a participant by participant matrix
## to incorporate distance in age and sex between the participants
## (absolute distance in age, and 0 if same sex, 1 if different sex)
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplo... |
da32015823cf50a53d17f0bbbed9dc3d905188d8d2d9bf73e4bc8692cb91b446 | Python | 3,691 | 99 | from __future__ import annotations
import re
from typing import Any
from wikibaseintegrator.datatypes.basedatatype import BaseDataType
from wikibaseintegrator.wbi_config import config
from wikibaseintegrator.wbi_enums import WikibaseSnakType
class Form(BaseDataType):
"""
Implements the Wikibase ... |
ed3b4dd2ac8824124c9090963ad9902903335dc07a1f96da4283b16d6d33ba81 | Python | 3,692 | 107 | """Define mention aggregator class."""
import numpy as np
from tqdm import tqdm
from constants import *
class Aggregator(object):
"""Aggregate mentions of observations from radiology reports."""
def __init__(self, categories, verbose=False):
self.categories = categories
self.verbose = verbos... |
0469e018b1cb39d45a591a15c5ab8900d190ee3c09f8c6a45aa8bd1384bd2ab5 | Python | 3,693 | 138 | """Basic tree data structure."""
from collections import deque
class Tree():
"""Recursive tree data structure."""
def __init__(self):
"""Constructor of empty tree."""
self.parent = None
self.siblings = list()
def add(self, tree):
"""Appends tree as continuation."""
... |
3dac4fa94f22a04b35c89357764385afc878712b043cca3a48ea98532586dae4 | Python | 3,693 | 127 | """Common workflows for phonons."""
from __future__ import annotations
from importlib.util import find_spec
from typing import TYPE_CHECKING
from monty.dev import requires
from quacc import job, subflow
from quacc.atoms.phonons import get_phonopy, phonopy_atoms_to_ase_atoms
from quacc.runners.phonons import Phonopy... |
4b041700236a667bfbeaa609a945ca1709c9266fd4ed979dace18a3925686be3 | Python | 3,693 | 96 | import os
import sys
import time
datadir = sys.argv[1] # should point to the directory where the fast5 & reds dir exist
model_name = 'default'
print("Model Name: " + model_name)
# Python Script Paths
exedir = "../run_scripts/" # the path to HierarchyCall's test/run_scripts dir
minimap_script_path = exedir + "run_... |
9391e94912d9ec50066380ac1fedc0f3390c4443cbb03011ba63fe472d45f5b5 | Python | 3,693 | 131 | # 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... |
116d9fa70c493d47cdd7c387dac00d4dd55a97a589959bb76385531a1769223b | Python | 3,694 | 122 |
##Exp_dual_insilico_Loc
df=pd.read_csv('ProteinIDs.csv')
listdf=[]
ath_dual=(list(set(df['ath-Pl'].dropna()) & set(df['ath-Mt'].dropna())))
listdf.append(ath_dual)
ath_dual_TargetP = []
for value in ath_dual:
in_Pl = value in df['ath-Pl-TargetP'].values
in_Mt = value in df['ath-Mt-TargetP'].values
if in... |
7a51df26d8cac3b28b3773dfa7dd069222a366f2550fab05e83142f9f1645336 | Python | 3,694 | 67 | # List the MeSH Qualifiers
qualifiers = ["analysis", "blood", "cerebrospinal fluid", "isolation & purification",
"urine", "anatomy & histology", "blood supply", "cytology", "ultrastructure",
"embryology", "abnormalities", "innervation", "pathology", "chemistry",
"agonists", "an... |
a3376b248f02634471400d69330d631ece7fcced12745078ee0d5b565627dc30 | Python | 3,694 | 98 | """
Classes for extracting filaments and processing from Graph
# Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry)
# Date: 14.10.14
"""
__author__ = 'martinez'
__version__ = "$Revision: 002 $"
try:
from graph import *
except:
from pyseg.graph import *
try:
from globals import *
exc... |
24515df0458096c2f17141b759db04c9e223c751e0b544cbac983a51ea6f8123 | Python | 3,695 | 82 | import os # for interacting with the operating system
import scipy.io # for loading and saving MATLAB files
import pandas as pd # for working with data in tabular form
from Functions.f_AnalysisFunctions import * # import custom analysis functions
from Functions.f_AnalysisStatistics import *
# Set flags and d... |
3b16af1cd76441ae5ca01f0e74c4d81a3494de0f5576b5fdbfecbc269454620e | Python | 3,696 | 108 | """
=================
Run RANSAC
=================
In this example we show how to run the RANSAC of ``pyprep``.
.. currentmodule:: pyprep
""" # noqa: D205 D400
# Authors: The PyPREP developers
# SPDX-License-Identifier: MIT
###############################################################################
# First we... |
d4fc29b6d2af605b9d1714e6060b5cd7a9ca91584d9a9955bd64ab6e4f35edb6 | Python | 3,696 | 118 | """Container for a BIDS sidecar file."""
import io
import json
import os
from hed.models.sidecar import Sidecar
from hed.tools.bids.bids_file import BidsFile
class BidsSidecarFile(BidsFile):
"""A BIDS sidecar file."""
def __init__(self, file_path):
"""Constructs a bids sidecar from a file.
... |
7be47f93c4f71d8202d8349c0389f38dcc2282c5c5f2b9f6942b29dca52b600a | Python | 3,697 | 105 | """Provide basic warnings used by setuptools modules.
Using custom classes (other than ``UserWarning``) allow users to set
``PYTHONWARNINGS`` filters to run tests and prepare for upcoming changes in
setuptools.
"""
import os
import warnings
from datetime import date
from inspect import cleandoc
from textwrap import i... |
b92a8fd75d102273f8e86bf5b02cb35a6948858c89446c058273de46ab03fd00 | Python | 3,697 | 121 | import torch
import torch.nn as nn
import torch.nn.functional as F
from segmentation_models_pytorch.base import modules as md
class DecoderBlock(nn.Module):
def __init__(
self,
in_channels,
skip_channels,
out_channels,
use_batchnorm=True,
attention_type=None,
)... |
d7b0862de4f2468932bad52111cd09fbd09b198e6fe60cfd11cabe6988977b31 | Python | 3,698 | 106 | #!/usr/bin/env python
# Copyright (c) 2020 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module provides an example control for vehicles
"""
import math
import carla
from agents.navigation.basic_agent import LocalPla... |
fdbc6cfc4e5c40043e79726de4ec367106004971d050caa097b8e12c93017d7e | Python | 3,698 | 78 | import numpy as np
import torch
from specs import *
from utils import \
generate_correlated_noise_1d, \
generate_correlated_noise_2d
class BackgroundFluorescenceGenerator:
def __init__(
self,
bg_specs: BackgroundFluorescenceSpecs,
opto_specs: OptosynthSpecs,
... |
60b8081617b115565bd540da453d429d34ae7869839c4ef2d20a6b5d0ce70d5f | Python | 3,699 | 95 | # 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... |
62cf2530d52740198d785e47c8274ead2e22adf8c8434e6657bb9b74823f07c9 | Python | 3,699 | 95 | # 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... |
f498182bb81c787beef9501e2261cbafe231502f22d2e2210c29f9ec01535996 | Python | 3,699 | 106 | import numpy as np
import os
def file_l(fname):
with open(fname) as f:
for i, l in enumerate(f):
pass
return i + 1
def textfile_processor(value, s1, s2, s3, file, shp, ibc, chanlen, avg, flp):
np.set_printoptions(threshold=np.nan)
print("SpikeHelper: Starting loa... |
85eec78d0c7bb02d1dda47d354b8d4b34275e66b53a0933a3356ebc089bdfbe4 | Python | 3,700 | 103 | """
pygments.styles
~~~~~~~~~~~~~~~
Contains built-in styles.
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pip._vendor.pygments.plugin import find_plugin_styles
from pip._vendor.pygments.util import ClassNotFound
#: A diction... |
dad3d1cc7b646eb16e09cb8ad23ae3f1bfa6d8a6e44fae9fec264d45e91d964d | Python | 3,700 | 110 | # Node-group asset "Offset Vector" (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... |
8d3079b0518320de06d7a388d553c49017bfda4fcf43a66d6c02bd8420c10dca | Python | 3,701 | 89 | """End-to-end acceptance test on the shipped monkey sample.
Verifies that the published rate-trace pattern (suppression nadir 200-250 ms
post-stimulus, rebound peak 350-420 ms) is recovered. This is the
falsifiable prediction from Nouri et al. 2025 — if these numbers drift,
something has regressed in the detector or i... |
8900c7cc9d47e1e83db4dc3d569e49d774993ed8c0d684c63dee525aa77c4ca3 | Python | 3,702 | 94 | import h5py
import os
import glob
import argparse
from plantsegtools.utils import H5_FORMATS
def parse_crop(crop_str):
'''Return a tuple with a slice object from a string (ex. "[:, 0:620, 420:1750]") '''
crop_str = crop_str.replace('[', '').replace(']', '')
return tuple(
(slice(*(int(i) if i else ... |
24491cc7938bf53a2d1c00d26630c1bac1270a2ffe26c48f57cefe31fea747fb | Python | 3,704 | 76 | #!/usr/bin/env python
# relion_run_topaz
# This is to run Topaz-Denoise (https://github.com/tbepler/topaz) from Relion as an External job type
# Rafael Fernandez-Leiro 2020 - CNIO - rfleiro@cnio.es
# Alex J. Noble 2020 - NYSBC - anoble@nysbc.org
# Run with Relion external job
# Provide executable in the gui: run_top... |
427aa416c96a4c2a73418692caec48a5990602ed0e78d186404d1b1ab3c9c1f9 | Python | 3,704 | 84 | from file_io import load_v3draw
import os
import numpy as np
import SimpleITK as sitk
def main(dir, r, sigma, sigma2):
"""
r: z, y, x
"""
for b in os.listdir(dir):
for i in os.listdir(os.path.join(dir, b)):
if not i.endswith('v3draw'):
continue
# if not ... |
1e1adaa59f7ae0962a68722ecd24d31a973d9e90692f15c9608ef893d5691d77 | Python | 3,705 | 114 | ######## Name
######## BiochemAnalysis
######## Requires
######## {Modules}
class BiochemAnalysis:
"""Class 'BiochemAnalysis' Illustration!
It is an essential part of the 'BiochemBase' class!
########
Attributes
########
Methods
"""
def __init... |
b0af943f47695bbca3ec7501412dd9b71bab6b6abb8c2ab3c923fecca7b2cba2 | Python | 3,705 | 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... |
d135700b3625a9d95c17dad78e9376d6a27b30973c1020332fdef9a497b77fcd | Python | 3,705 | 87 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Copyright (C) 2012 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... |
7373b1fe2d4aa1eebf460b2d8dfccc100274f0d698419a8d8001c7e630c4c21b | Python | 3,707 | 92 | #
# 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,... |
97b8be55aaf7b54079af4d5e5dcafd02a38d944ed425b61018e229f85467f1e6 | Python | 3,707 | 109 | # 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... |
a075bbb3237bd01295f960c827a30dd976c43c04f4a76edcde91f7b91caa9255 | Python | 3,707 | 109 | from torch_geometric.data import InMemoryDataset
from torch_geometric.data import Data as DATA
from tqdm import tqdm
import pandas as pd
import numpy as np
import torch
import os
from torch_geometric.data import DataLoader
# from torch.utils.data import DataLoader, Dataset
import re
class DTADataset(InMemoryDataset):
... |
2f167a0f6d1a776510d63751e5f7622df84db71d0a7814fe6adc61216e820cc7 | Python | 3,708 | 114 | """Custom exception classes.
CLASSES
-------
ProcessingOrderError : Exception
- Class for raising exceptions/errors associated with performing processing
steps in an incorrect order.
UnavailableProcessingError : Exception
- Class for raising exceptions/error associated with trying to perform
processing st... |
1ccf7a8fc54f1091c1528d3c256a758a47c4208e114ea115897a799e67e15d93 | Python | 3,709 | 78 | """
RHOBAR_DETERMINACY.py written 2026-09-22.
Closes the last open box of VERIFY V-68: "undetermined share re-run at deff 12.9x and 33.1x".
The prediction was written on 2026-09-14, BEFORE this run (VERIFY V-68):
"the undetermined share lands ABOVE 6.7%. The 2.2-6.7% bracket would then not
contain the answ... |
aa85853c48f29b9826d91b8cc297f7a4e8acddae6bfcf259142ccadb9e092fc0 | Python | 3,709 | 131 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import sys
from unittest import TestCase, main, skipUnless
try:
from unittest.mock import Mock, patch
except ImportError:
from mock import Mock, patch
from ..winterm import WinColor, WinStyle, WinTerm
class WinTermTest(TestCase):
... |
b4a3dc3ce00b621b1dbfdf9531fda15804dcf1dcabde4c60ee87605bd5373c58 | Python | 3,709 | 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... |
83482aae6b1ac9deff5c3c5384891b720bb8b6e90946122a0c7cd9a74421687a | Python | 3,710 | 118 | # pylint: disable=invalid-name, missing-function-docstring, no-member
""" MeanTransformer model module """
from random import uniform, randint
import math
import torch
from torch import nn
from omegaconf import OmegaConf, DictConfig
def get_model(cfg: DictConfig, model_cfg: DictConfig):
return MeanPETransformer... |
7c15b8ae4bad94da26bb7f280296c6757701060a6b96ba49cff757d2cba5b5ac | Python | 3,711 | 67 | """MATCHED_SCALE.py 2026-09-30. Pre-registration: 04-NOTES/PREREG-2026-09-30n-MATCHED-SCALE.md
Santos's weight sweep (15_escala.py) over the range he used for BANC, on FlyWire with his corrections (Rall) and mine (D, F4).
usage: python MATCHED_SCALE.py run | analyse (MS_WORKERS, default 8; resumable)"""
import sys, o... |
2cc530581f372287548574ef1045a822d50f3981f114a860194b59f9e511ea05 | Python | 3,712 | 89 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import GINConv
from torch_geometric.data import Batch
class GIN(nn.Module):
r'''
A simple but effective graph isomorphism network (GIN) structure from the book of Zhang et al. For more details, please refer to the foll... |
59b4834644760e3c26953dfd69323afeae7aae5919df22589a19d6be674ddf0e | Python | 3,712 | 130 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# external
from setuptools import setup
extras = {
# enough for simple usage
'extras': [
'jellyfish', # for DamerauLevenshtein
'numpy', # for SmithWaterman and other
'Levenshtein', # for Jaro ... |
946bf763fd6d14bd6e8dfc464f9c02de5ead0007379d3edbb8c89594c29c55a8 | Python | 3,712 | 97 | from collections.abc import Callable
from elasticai.creator.arithmetic import FxpConverter, FxpParams
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_... |
f3f11c5f0a29d7cb4dd877e646a7e4e3e026a26cea9b0f7d36114cc42aaaf46a | Python | 3,713 | 131 | # Node group "XPBD Init" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# Shared by several assets, which import it; not an asset itself.
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated fr... |
cc9a36f65c3417f6c08ae24d410d7b43c13a68c46ea9d15328b82ae1342f4569 | Python | 3,714 | 77 | """Opt-in multi-turn regression on the real pretrained Qwen3-0.6B and the real connectome.
Run with: LIQUIDAION_REAL_MODEL=1 python -m pytest tests/test_real_model_regression.py -s
Uses CUDA when available, CPU otherwise (slow). Skipped by default.
"""
import os
from pathlib import Path
import pytest
import torch
f... |
d2ef219b8ec7fc7c11e88b8c2931368efccf48fe811e3af0d043b9daa4d93c38 | Python | 3,714 | 120 | from nose.tools import *
from pyccg.combinator import *
from pyccg.lexicon import Lexicon, Token
from pyccg.logic import TypeSystem, Ontology
def _make_mock_lexicon():
types = TypeSystem(["obj", "boolean"])
functions = [
types.new_function("unique", (("obj", "boolean"), "obj"), lambda x: x[0]),
types.new... |
5abd3858d2381775ff57112f7ab346f87db983bbbe3030ca94db7e2468fefee5 | Python | 3,715 | 95 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All R... |
7903f18d656d96e5387c07fed35dffe467f481b0b5c66602f3b527cd61d43247 | Python | 3,716 | 111 | # Copyright (c) 2023-2024 Blue Brain Project/EPFL
# 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 ... |
1b5a5bbd022b22138ae1a86d669ab0503c687db50e3a9badea32ec78cf0326f3 | Python | 3,717 | 132 | #!/usr/bin/env python3
import sys, os
from pandas.io.parsers import read_csv
import numpy as np
import pandas as pd
from collections import Counter
try:
bedintronfile=sys.argv[1]
bedexonfile = sys.argv[2]
output = sys.argv[3]
except:
sys.exit("Please, provide input bed (1) intron and (2) exon files; (3... |
cdfa035d082a750c788208fb871f3609023edc73c36d24f363ef360c6b5e0ace | Python | 3,717 | 110 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by Naren Wulan and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
"""
import torch
import torch.nn as nn
import numpy as np
from torch.utils.data import DataLoader
import os
import itertools
from sklearn.model_selection imp... |
04780a5103d0eff92645edcfb3610b45b962497e369ee554d19a5a0c7aafb47c | Python | 3,718 | 93 | """Unit tests for the Jacobian-determinant folding QA metric."""
import os
import sys
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT)
import numpy as np
import pytest
from regtools.registration.core.metrics... |
29ec203f088d426f0603025857be1006ef5bc5db69250c9001df9067144e2291 | Python | 3,718 | 90 | import torch
from torch import nn
from flytracking.detection.models.efficientdet import (
BiFPN,
Regressor,
Classifier,
EfficientNet
)
from flytracking.detection.utils.efficientdet import Anchors
class EfficientDetBackbone(nn.Module):
def __init__(self, num_classes=80, compound_coef=0, load_weigh... |
2e304e8d60dafad43f86c3cccf5ac6fad25710cfa04b9ead85537b510bbb71d7 | Python | 3,718 | 88 | '''this is a sample script used to run permuation testing on the fitting data results from Stasinski et al. 2024'''
import random
import numpy as np
import scipy.io as sio
import scipy.signal as sig
from tvb.simulator.lab import *
import matplotlib.pyplot as plt
from scipy import signal
import matplotlib.patches as pa... |
bb9a84f5e9e9f640fba65d68b96a80436a3ddfa90136835d724d777a3d6debe0 | Python | 3,718 | 116 |
import numpy as np
import matplotlib.pyplot as plt
import os
from tqdm import tqdm
from pathlib import Path
def resample_dataset(images, dt):
"""
Resample time series data if needed (iEEG is given with dt of 2ms).
Args:
images: time series data.
dt: Desired timestep of iEEG.
Returns... |
af771fb6c5256256ac68e85b8dd9a329279d34b165983284bd26bd6f98c97561 | Python | 3,720 | 91 | import torch
from torch import nn
from torchdrug import core, layers
from torchdrug.core import Registry as R
@R.register("models.MPNN")
class MessagePassingNeuralNetwork(nn.Module, core.Configurable):
"""
Message Passing Neural Network proposed in `Neural Message Passing for Quantum Chemistry`_.
This i... |
116a3938437ffe3135be0d112ef020c89d69c04dcae48e950199292e72b32711 | Python | 3,721 | 111 | # 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:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or module... |
20176e59b26d5e323d05d676f9a5535500e058e60d5efbbbe02f6def3ce54b97 | Python | 3,722 | 106 | # -*- coding: utf-8 -*-
"""Prepares input files for ltomos_generator_translocon."""
import os
import logging
import time
import csv
import itertools
import operator
from datetime import timedelta
# import pyseg as ps
from pyorg import sub
# filepaths
ROOT_PATH = '/fs/pool/pool-lucic2/antonio/ribo_johannes/lum_ext_... |
2e0723235a29a5e1b3405ccaf13616f4678db090ef9a400ade120e0938fccd2c | Python | 3,722 | 123 |
## Setup
import APT_interface as apt
import RNN_postprocess
import tensorflow as tf
import os
import easydict
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
tf.reset_default_graph()
exp_name = 'postprocess'
view = 0
mdn_name = 'deepnet'
lbl_file = '/groups/branson/bransonlab/apt/experiments/data/sh_trn4992_gtcomplete_cach... |
9b674f70b7a53e970ec9c146922b7dd810ec2491ffcb8351094ce1097988e004 | Python | 3,722 | 93 | # Plot reduced pareto front for S1 Appendix Fig E
from os.path import join
from get_paths import *
import matplotlib.pyplot as plt
from OptimizationFitness import OptimizationFitness
import numpy as np
from colors_paultol import *
if __name__ == "__main__":
save_flag = 0
# Load file
fn... |
70ab77a5eddad83605473f8d1c59d0796cb2b12054021eed0a457febed5e5ae5 | Python | 3,723 | 106 | def update_param(name, param):
if name == 'distribution':
param['values'].remove('custom')
return param
return None
def class_extensions():
def level_2_names(self):
"""
Get the level 2 column values.
"""
return self._model_json["output"]["group_column_names"]... |
a029ef0ffdc220845ae0aefd40e267ba3dcc69d8095accdef08559204eeee5e9 | Python | 3,723 | 117 | import torch
import torch.nn as nn
from utils.complex_utils import complex_utils as Z
from utils.loss_utils import choose_loss
from utils.layer_utils import layer_sel
class led_nn(nn.Module):
def predict(self,output):
if(self.config.readout=="continuous"):
pred = output
else:
... |
ed760a2ffea9ce5fbf8520edc3487db988cd1089bcafbd7cff1217cbc0cbc15b | Python | 3,723 | 150 | #!/usr/bin/env python
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from nltools.data import Brain_Data, Adjacency
from nltools.mask import expand_mask, roi_to_brain
from nilearn import plotting as nplot
from sklearn.metrics import pairwise_distances
# ------------------------------... |
2cf24812d82e562c72bba10e7b1fd630b508027bde170276fd3672fc8e1cdf3e | Python | 3,724 | 122 | # D. Giraldo
# Aug 2023
# EDSR model, based on https://github.com/sanghyun-son/EDSR-PyTorch
import torch
import math
import torch.nn as nn
def default_2Dconv(in_channels, out_channels, kernel_size):
return nn.Conv2d(
in_channels, out_channels, kernel_size,
stride = 1, padding=(kernel_size//2), b... |
94da3010141d1eb08a43d840c3a3051e00e522dbf02ae5a77e7f2c4353efd596 | Python | 3,724 | 119 | #!/usr/bin/env python3
import os
import pandas as pd
import matplotlib.pyplot as plt
from nltools.data import Brain_Data
from nltools.mask import expand_mask, roi_to_brain
from nltools.stats import threshold
from nilearn import plotting as nplot
# ------------------------------------------------------------------
# ... |
837fa9d5a512ed764a41ccff6fe8f7eaeb7f35ed587593676c6dabd9938a8545 | Python | 3,725 | 101 | # ----------------------------------------------------------------------
# Copyright (C) 2014-2015, 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/... |
2fd28f07d41b2331bbf0b82949914d95fc27ebc4ec93e1de98c54dbadefd02e4 | Python | 3,726 | 58 | """BUILD_RELEASE_V2.py 2026-09-25. Builds the public project release (planned DOI around 20 Oct 2026) in
06-OUTPUT/release/v2/: code, pre-registrations, claims, every text/CSV output, report figures, the report, the
reproducibility notes and the sign-determinacy table v1.1, each with its sha256 in MANIFEST.tsv, plus ... |
ad19c867f64d9affc5e3e966fd28ba485ec98c3e211d69f2375a637c126be991 | Python | 3,726 | 87 | """
modified by Mayank Kabra
Adapated from DeepLabCut2.0 Toolbox (deeplabcut.org)
copyright A. & M. Mathis Labs
https://github.com/AlexEMG/DeepLabCut
Please see AUTHORS for contributors.
https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
Licensed under GNU Lesser General Public License v3.0
"""
import os
imp... |
a0315229049ed35254fd8d4749aed2629be21ed84d36fa3ff501a76d2d996d0f | Python | 3,727 | 153 | import math
import torch
EPS = {torch.float32: 1e-4, torch.float64: 1e-8}
TOLEPS = {torch.float32: 1e-6, torch.float64: 1e-12}
class Artanh(torch.autograd.Function):
@staticmethod
def forward(ctx, x):
x = x.clamp(-1 + EPS[x.dtype], 1 - EPS[x.dtype])
ctx.save_for_backward(x)
res = (to... |
415b8c2d3eed8ce3916df882173e8ab850cfb441b0d02b2e53f612b64a48e3c4 | Python | 3,728 | 105 | """Tests for regtools.ccf_boundary_editor.session_diff."""
import numpy as np
import pytest
def _three_slice_annotation():
ann = np.zeros((3, 30, 30), dtype=np.int32)
ann[:, :, :15] = 1
ann[:, :, 15:] = 2
return ann
def _dragged_state(ann, z, drag_dx):
from regtools.ccf_boundary_e... |
705bfbda90645c33c6d0fda957035e54cd1f30ce9696704bcf5a8af8eda04bf9 | Python | 3,728 | 109 | # pylint: disable=too-many-function-args, invalid-name
""" OASIS ICA dataset loading script"""
import numpy as np
import pandas as pd
from omegaconf import DictConfig
from src.settings import DATA_ROOT
def load_data(
cfg: DictConfig,
dataset_path: str = DATA_ROOT.joinpath("oasis/OASIS3_AllData_allsessions.n... |
7e34222f13fbfff3e2961d8ad4c2e1f3e57286bf29c07502ff2676a3a2a31e17 | Python | 3,730 | 97 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 3 11:47:48 2022
This script is slower than single thread index.py, probably because File IO is the bottleneck.
use index.py instead.
@author: heavens
"""
import os
import h5py
import argparse
from xron.utils.seq_op import fast5_shallow_iter
from xro... |
df18158dd90a758d53c4317abb17b89d5b68b552caa308084813b52e0eeaa768 | Python | 3,730 | 107 | """UpdaterDialog wiring under a QApplication. core.* is monkeypatched so no git
runs; ops run inline (sync) for determinism via dlg._sync_for_tests = True."""
import pytest
@pytest.fixture(scope="module")
def _qapp():
try:
from PySide6.QtWidgets import QApplication
except Exception as exc: ... |
450b8c494f75eade8c5daca684da2f98d37719f5d8e6e05362cd14b44cd1f2ce | Python | 3,731 | 101 | """MIND/SSC/NGF must honor masks on the DEFORMABLE stage, not just the affine.
Previously `_run_descriptor_registration` passed fixed/moving masks to the
Stage-1 Mattes-MI affine but silently dropped them from the Stage-2 descriptor
SyN, so the deformable optimizer evaluated the descriptor metric over background
... |
50bd3608a1169808c845e46b43caa414e680c3dfaecf4a805d1aeca76bbc7169 | Python | 3,731 | 112 | '''Preprocess PVT scores. Reads all available logs from the PVT and computes
the scores according to (Basner & Dinges, 2011).
The input should be done in the following order:
- folder path where the files are
- savefile where the proprocessed data will be stored in csv format
Parame... |
94ddf7b6a446822bbbfc2a413a44a331ed97f04119a1ec194053430cd71ec0fe | Python | 3,731 | 113 | # Node-group asset "Group Parameter" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKI... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.