sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
78f83ddb5c69b11e62549c24978966254ef7d44a883b7bb5e6817f9000ffaaaf
Python
6,602
143
"""Ratified V2 relocation gates (C01 item 6; architecture memo 3.3). Executed moves (each with its published closure and a shim keeping every historical spelling + pickle-visible identity): - ``_trace_state`` -> ``_vocab/trace_state`` (closure: 1 module, enum only) - ``visualization/node_spec`` VOCABULARY -> ``_vocab...
69649d1301587d2a1e6b353d6722f8e321b99fa4d49fb570a2ed5c8c6ee024b7
Python
6,603
200
"""Smoke tests for fastlog RAM, disk, and recovery storage paths.""" from __future__ import annotations import time from pathlib import Path import pytest import torch from torch import nn import torchlens as tl from torchlens.fastlog import CaptureSpec from torchlens.fastlog.exceptions import PredicateError, Recor...
6ebe1c887007b5a349c2a1373ab668e098dc9034d2312e0c1fe8de8e66accdee
Python
6,603
183
""" test_canonical_pipeline.py — Smoke tests for the deposit. Three tests, each fast (< 1 minute total): 1. test_build_trained_model_reproduces_paper_numbers Runs build_trained_model.py against the bundled feature JSONs and asserts the four paper headline numbers are within tolerance. 2. test_rank_norm...
efed86a89b69b7aed6bb0405f1b7a48b2bf5bcbee277ef60bf291eb9d1b4302d
Python
6,603
221
import matplotlib.pyplot as plt from itertools import combinations import torch import pandas as pd import numpy as np from utils_ensemble import ( list_of_result_to_dico, acc_of_ensemble, acc_of_ensemble_with_cross_val, ) import matplotlib.patches as mpatches import argparse import scipy import copy import...
18ba7bd323d616b03c4b8afb1e8103a01debce330175ce058090839d50b8f256
Python
6,605
199
import os import argparse from tlib import ttorch from . import config def load_trainer(log_dir=config.log_path, deactivate_logger=False, model_init_kwargs=None, datamodule_init_kwargs=None): trainer = ttorch.train.load_trainer( log_dir=log_dir, device=config.device, deactivate_logge...
909b88caa01e7a71d11620f7dac8db005e6fde315a520b08c0d0aa8ac045834b
Python
6,605
261
""" Test configuration and fixtures for ethoscope device tests. This module provides common pytest fixtures and configuration for all tests in the ethoscope device package. """ import os import shutil import tempfile from pathlib import Path from unittest.mock import Mock, patch import numpy as np import pytest # T...
09410bf371dbc15b13328249bda93484baa92fc79b15b1185bfd7ff511a2a2f7
Python
6,607
203
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> "Internet communication utilities" from distutils.version import LooseVersion from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText import keyring from keyring.errors import KeyringError import smtplib import socket import sys import...
4f1bac6dc5861b0f65e0adb42a34ecbaf100b63969eeb4eb48139b99e1fa9b1f
Python
6,607
147
""" Quadratic Integrate-and-Fire (QIF) Spiking Neuron Model ======================================================= The `QIF <https://en.wikipedia.org/wiki/Quadratic_integrate_and_fire>`_ neuron model is a spiking point neuron model that simplifies the dynamics of a neuron to the evolution of a single, dimensionless s...
665ea278c73d2077877d22baf7792c4a1ba4fe489e538b29dc40693c355ded9e
Python
6,607
242
import locale locale.setlocale( locale.LC_ALL, 'en_US.UTF-8' ) import cv2 import io import math import os import re import pdfplumber import tempfile from wand.image import Image from wand.color import Color from PyPDF2 import PdfFileReader, PdfFileWriter def convert_page_to_img(pdf_fpath, img_fpath, pageno=0): ...
b525823c7068bc013da5f4d6e895572e7ebc5d6df25daed935128b909c182ac7
Python
6,607
147
""" Quadratic Integrate-and-Fire (QIF) Spiking Neuron Model ======================================================= The `QIF <https://en.wikipedia.org/wiki/Quadratic_integrate_and_fire>`_ neuron model is a spiking point neuron model that simplifies the dynamics of a neuron to the evolution of a single, dimensionless s...
f7ca4d24f2d9b8fa417a8216c394b79b72b89f22411d0fd61ce5fb238f8accb7
Python
6,607
215
''' The setup of the dataframe including the splits into training, testing, and validation dataframes. Credit to Dr. Pau Riba & Dr. Anjan Dutta for the original MPNN code. ''' import numpy as np import pandas as pd from rdkit import Chem from collections import Counter ########### DATAFRAME PREPARATION ########### '...
603002cb9b3dc2f04ea2c2dabbd5ca3b03ea572cde1e40200faa5e86a9394d7a
Python
6,608
141
import sys import os import argparse sys.path.append("../src") import data_prep import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from matplotlib import rcParams # Define plot aestherics. plt.style.use('seaborn-deep') rcParams['figure.dpi'] = 200 rcParams['savefig.dpi'] = 30...
94b214bec33ae0034e303a2d009f690649962c133ef39411999f2ce271fa9b32
Python
6,609
190
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import subprocess import sys from collections import defaultdict from common import Dict def parse_args(): parser = argparse.ArgumentParser( description="Generate ST phrase entries from regional phrase keys." ) parser.add_argument("-...
5e2f4262cbbc68949559fc24efc20dc9d050a94645e34b57a27fb8ad9701030e
Python
6,610
210
r""" Test behavioral simulation of rover/sitter larvae with DEB energetics. This script verifies that: 1. Rover/sitter models load correctly (k_X variants) 2. Behavioral simulation runs (feeding, gut, energetics integrated) 3. Feeding → gut → stepped DEB integration pipeline works 4. RvsS_on preset experiment executes...
4a7b848172693f6fac7ad06fc16a158ae8728b3abef6c377029e98db0d2c4618
Python
6,611
135
# !/usr/bin/env python ## created by Yun Hao @MooreLab 2021 ## This script contains functions used to process sorted DTox hiearchy files and compute model statistics ## Module import numpy as np import pandas as pd ## This function computes the input and output size of each node module in DTox model, i.e. the numb...
2a9757bcc0d3586027e9a892f168792e8f4a426625eb1e0e6823a4fda95fd3b6
Python
6,612
161
"""04. Testing PoseNet from image sequences with pre-trained Monodepth2 Pose models =========================================================================== This is a quick demo of using the GluonCV Monodepth2 model for KITTI on real-world images. Please follow the `installation guide <../../index.html#installation...
acf14e8b1dd26ccb61517ad8afe22870f3823a9d884bdf5819d851715ba927e3
Python
6,612
127
from ovseg.model.SegmentationModel import SegmentationModel from ovseg.preprocessing.SegmentationPreprocessingV2 import SegmentationPreprocessingV2 from ovseg.data.SegmentationDataV2 import SegmentationDataV2 from ovseg.utils.io import save_nii_from_data_tpl, save_npy_from_data_tpl, load_pkl, read_nii, save_dcmrt_from_...
0b6e6e2483b5dbcf006569b39aa2448fd9c6420cc8bec8f8ec1017209d9f3c0f
Python
6,613
219
import numpy as np import scipy import scipy.spatial import string import os,re import random import util import gzip to1letter = { "ALA":'A', "ARG":'R', "ASN":'N', "ASP":'D', "CYS":'C', "GLN":'Q', "GLU":'E', "GLY":'G', "HIS":'H', "ILE":'I', "LEU":'L', "LYS":'K', "MET":'M', "PHE":'F', "PRO":'P', "SER":...
6a29636a15d165f0895c7eafbf79be0308942d8bc2f199dc783404392f614443
Python
6,613
159
"""Frozen legacy-artifact gate: pre-refactor .tlspec files must always load. The two committed artifacts under ``goldens/`` were produced at the pre-columnar baseline (tree ``db2bc7a5``) and are NEVER regenerated: they ARE the old format. Every wave of the columnar re-plumbing must load them through the (eventually on...
edeffd6406f875878d93c0d8b7736264f0395b4596f9f89d44eadf0bb7e27610
Python
6,613
209
import abc import os import typing import warnings import weakref import rpy2.rinterface import rpy2.rinterface_lib.callbacks from rpy2.robjects import conversion rpy2.rinterface.initr() def _add_warn_reticulate_hook(): msg = """ WARNING: Using old versions of R package "reticulate" within rpy2 leads to...
b640e3749a82f28cdaee855407d8218d745936cb852df0b8c19cb663a22facb7
Python
6,615
123
# pylint: disable=line-too-long,too-many-lines,missing-docstring """HMDB51 action classification dataset. http://serre-lab.clps.brown.edu/resource/hmdb-a-large-human-motion-database/. Code adapted from https://github.com/open-mmlab/mmaction and https://github.com/bryanyzhu/two-stream-pytorch""" import os from ..video_c...
3dada637c37050715a2d77da4d5c9bdd7c15ff3d31d8714084d5c599ec069a81
Python
6,616
189
import os import json import random import itertools import numpy as np import torch from collections import defaultdict from src.data.tokenize import tokenize_pet_txt, tokenize_pet_mlm_txt from src.utils.util import device class BoolQReader(object): ''' BoolQReader reads BoolQ dataset ''' def __init...
7f8ac572564f3a290f662c02e02cdf4543260c1abd65f2ef983197fdab58ae44
Python
6,616
164
"""The module describes the ``core`` job metrics plugin.""" import datetime import json import logging import zoneinfo from typing import ( Any, ) from galaxy.util import asbool from . import ( InstrumentPlugin, ProvidesJobMetricsContext, ) from ..formatting import ( FormattedMetric, JobMetricForm...
686ccaceeb1ff65c28764628573bca563c963836f5961cd0c2bb79d307ff5de6
Python
6,617
133
from matplotlib import pyplot as plt import numpy as np import h5py import os import time from tqdm import tqdm _FACTORS_IN_ORDER = ['floor_hue', 'wall_hue', 'object_hue', 'scale', 'shape', 'orientation'] _NUM_VALUES_PER_FACTOR = {'floor_hue': 10, 'wall_hue': 10, 'object_hue': 10, 'scale': 8, 'shape': 4, 'orientation'...
0d7088f6b8ace1d5772be4431c52c9094dc02bdf0a2fb74f57305d315bd8e96a
Python
6,618
182
from typing import Callable import torch import torch.nn.functional as F from torch import Tensor from lightly.loss.msn_loss import MSNLoss class PMSNLoss(MSNLoss): """Implementation of the loss function from PMSN [0] using a power law target distribution. - [0]: Prior Matching for Siamese Networks, 20...
4ab9da8c022d63754fe0af14ef4a0ce9873e0ac3a3f31b696dedefe7c07da9e3
Python
6,618
147
import os, sys, csv, re import numpy as np from scipy import stats from scipy.signal import welch import matplotlib; matplotlib.use("Agg") import matplotlib.pyplot as plt ROOT = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, ROOT); sys.path.insert(0, os.path.join(ROOT, "src")) from data_loader_01 import...
aaf7a73696e0a287aa791916cc7839730ee0dd17c9613f4e472a96504029edfc
Python
6,618
186
"""Canonical-container pooling tests for ``recurrent_ops`` and Layer ``equivalent_ops``. ``recurrent_ops`` shares ONE canonical list per recurrence group (mirroring the ``equivalent_ops`` canonical-set pooling), with a copy-on-read barrier in ``Op.__getattribute__`` so no holder can alias-corrupt the group. ``Layer`` ...
4b9b2851c0cb00271b60200f015fe3f5bfb4d8d73eced399d1f8d4efacbffa0a
Python
6,619
285
import re from googletrans import Translator from sentence_splitter import SentenceSplitter def clean_text(text): clean_text = [] text = text.strip() lines = text.splitlines() for line in lines: line = line.strip() if line: line = re.sub('\s+', ' ', line) clean_t...
5a27859f9c19e20737d00bb8a53025bc77bf46e93df413fe98adbbf43399b6fc
Python
6,621
170
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import argparse import numpy as np import shlex import subprocess import sys import wave import json from deepspeech import Model, version from timeit import default_timer as timer try: from shhlex impo...
0cef6858e010be5ae233f622972ce04d90efb0a8cc2a57eab1a80afc12e87fe2
Python
6,622
259
import pytest import flask from flask.globals import app_ctx from flask.testing import FlaskClient def test_basic_url_generation(app): app.config["SERVER_NAME"] = "localhost" app.config["PREFERRED_URL_SCHEME"] = "https" @app.route("/") def index(): pass with app.app_context(): r...
771eabdabca6c7451a494894e754d4458037fe5007c1be1c4719e613e3ac7a83
Python
6,622
225
#!/usr/bin/python #-*-coding:utf-8-*- # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance wi...
76689426accb50b22cba4b8cf6f317feec4f1056992b1d7351cecfb9ff74bf81
Python
6,624
168
#!/usr/bin/env python import argparse import os from Bio import SeqIO from Bio.Restriction import Restriction_Dictionary, RestrictionBatch import csv import sqlite3 import sys import pandas as pd def digest_genome( genome_fp, restriction_enzyme, output_dir, linear=False): base_fp ...
0afd96b6aaa6f879581e4cf1e3e2eb97cc490e350b8a3d9927d5ecd9e051b230
Python
6,625
182
#Keras modules from tensorflow.keras.layers import Conv2D, MaxPool2D, Dense, UpSampling2D from tensorflow.keras import Sequential from tensorflow.keras import Input from tensorflow.keras import Model import tensorflow as tf import numpy as np #File I/O import os, glob import glob import tempfile, os from tqdm import t...
44000a5539afd48c8c9ab9606c8d5c49f349b8319aa759ea93ea39bb1ff53d25
Python
6,626
180
"""Fork serialization round-trips (pickle, tl.save/tl.load, deepcopy). ``Trace.fork()`` builds COW shells over the parent's sealed stores; detached fallback records (modules fork detached by design) must decode BOTH internal M14 cell encodings (``PooledCell`` pooling and compacted singleton labels) while copying, beca...
44fcc35633c16028dead38a06b59753d38f13bb5129284457a2f067833995692
Python
6,630
218
import time import logging import numpy as np import pylsl import ipdb from libmushu.amplifier import Amplifier logger = logging.getLogger(__name__) logger.info('Logger started.') class LSLAmp(Amplifier): """Pseudo Amplifier for lab streaming layer (lsl). This amplifier connects to an arbitrary EEG dev...
2dbfad1a04e89c095958915c159599c45488af552ca05a9bb937eeab60027b77
Python
6,631
198
"""Tests that `gym.register` works as expected.""" import re from typing import Optional import pytest import gym @pytest.fixture(scope="function") def register_testing_envs(): """Registers testing environments.""" namespace = "MyAwesomeNamespace" versioned_name = "MyAwesomeVersionedEnv" unversioned...
23508f04cdb0e777818d77b2e3d2145d1c906f12518b2da31fbff81a9478a7b0
Python
6,632
121
""" Contains tests for the public model metamers repository """ import unittest import numpy as np import torch as ch import faulthandler from pathlib import Path import os faulthandler.enable() import imp import importlib import sys import robustness # For testing metamer generation. from analysis_scripts import * ...
eefdf56fc603da1f18b512b3705301bd955160c97568fcbe11514c2aefdb8185
Python
6,632
202
""" Video Classification with Channel-Separated Convolutional Networks ICCV 2019, https://arxiv.org/abs/1904.02811 Large-scale weakly-supervised pre-training for video action recognition CVPR 2019, https://arxiv.org/abs/1905.00561 """ # pylint: disable=missing-function-docstring, missing-class-docstring import torch im...
15576ad64191fad11bff75c8d8501f726b444a419cc333eab8915530be95cc17
Python
6,633
160
import argparse import random import re import sys import time from datetime import datetime import boto3 from botocore.compat import total_seconds parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('--profile', help='profile name of aws account.', type=str,...
6ae0a9ab8a9c46093345e839a0f91ffafa45e75b919efeef30c096f77e762bc4
Python
6,633
172
"""One-backward reads: deferred-EAP plumbing (F04 items 7+9, D16). The GradInputUseMap is fail-closed session-time plumbing: ``exact`` only for provably-unambiguous correspondences, candidates listed but never picked from, and the no-positional-zipping census pinned. EAP remains honestly blocked after this build. The ...
9e88377f1f71572eaea75a6f539f23c4a7c1569934eb5e21f333040dd4a54e29
Python
6,633
170
# https://github.com/jianhuupenn/SpaGCN import os import torch import pandas as pd import scanpy as sc import numpy as np from sklearn import metrics import multiprocessing as mp from sklearn.metrics.cluster import adjusted_rand_score from sklearn.metrics.cluster import ( v_measure_score, homogeneity_score, comple...
a92f01dc4aff3ca9ccdf9fc6270ae156daaac9b00cb2f059f0dce970967a4bf8
Python
6,633
194
"""RG10/RG14-shaped extraction workflows + the v1 acknowledgment (F18 gate). RG10 shape: extract natural-shaped images to memory AND disk, reload, and export — direct/batch/disk activations, ids, order, counts, and hashes agree (ResNet-18, real torchvision class, random init, zero network). RG14 shape: multimodal proc...
75220f3008eb3b8d54a05358953e780ad988f350c563925d66970030e9c38d4b
Python
6,634
163
"""F02 ``tl.compose``: the explicit value algebra (edits memo D20-D22; row A5). Left-to-right order against hand oracles, syntactic flattening as audit-visible identity, non-commutativity, the construction refusal roster, one FireRecord with ordered leaf identities, AND-combined flags, pickle round trip through the bu...
8542358b8cfe12c62b9413dc1ca3139ce1e5cfdfc117362c6e954bc1c89af3aa
Python
6,634
107
import os import logging from svim.SVIM_clustering import partition_and_cluster def cluster_sv_signatures(sv_signatures, options): """Takes a list of SVSignatures and splits them up by type. The SVSignatures of each type are clustered and returned as a tuple of (deletion_signature_clusters, insertion_signatu...
b98fb7a029b8568fd3f5bbed9852a8d80735a1c53f303a1455b4c01d391847ed
Python
6,634
123
"""Поиск жизнеспособного предка. Синтетической проверки «стоя на еде — ешь» оказалось недостаточно: геном может проходить её и при этом не уметь искать еду, и тогда популяция клонов гибнет целиком. Поэтому предок обязан доказать жизнеспособность в настоящей мини-симуляции — вырастить популяцию, а не просто выглядеть р...
46330f0285d73db2cfe81668338c0dbd7717d6d1357ef7b8e9c45dc41a921792
Python
6,636
190
""" The contextual property. """ import pickle from collections import Counter from multiprocessing import Pool import tqdm from rdkit import Chem from grover.data.task_labels import atom_to_vocab from grover.data.task_labels import bond_to_vocab class TorchVocab(object): """ Defines the vocabulary for atom...
5b701213900097fbca9744fc856ca1072defff2493a9fda495c02e072c973d01
Python
6,636
183
import unittest from unittest import mock import responses from codecarbon.core import electricitymaps_api from codecarbon.core.emissions import Emissions from codecarbon.core.units import Energy from codecarbon.external.geography import GeoMetadata from codecarbon.input import DataSource class TestElectricityMapsC...
aa55fa3b06e26f1a170a970d4e0e2728aac7d84b0c14ba02a7621da3cbe603ac
Python
6,637
195
"""Fixwave-2 FW2-POLISH pins for R19-2: rank-layout cluster geometry honesty. The b6 probe found two coupled defects in the rank path: - pass-qualified region keys ("cell:2") were collapsed to their pass-free address for the ``compound_bboxes`` mapping, so EVERY pass cluster received the same last-write-wins bbox...
9b6ac51ec3fbd435b2b84f079b7531bd91b6cfe253526751680b7c43a3f19f99
Python
6,638
176
"""R62: gate + disclose the harvested module instance-attribute channel. ``model_prep`` harvests every public, non-callable module instance attribute into ``Module.custom_attributes`` and portable saves persisted the whole channel verbatim with no opt-out and no disclosure — tokens, private paths, usernames, and large...
da90bbceffd61c64f871762d3aa5a2fb7750e3db3086b29d3ac6ce1bf8d4b17d
Python
6,638
148
"""this script is used to prepare COCO dataset for tracking, which is 2017 COCO Code adapted from https://github.com/STVIR/pysot""" import argparse import zipfile import os from concurrent import futures import time import json import numpy as np from gluoncv.utils import download, makedirs from gluoncv.data.mscoco.uti...
fdd8521efbff9c59b0e8a18e7d9238c0ede8bdb68f70c00f3c01a84649f9853c
Python
6,639
174
"""F29: discoverability -- taught spellings resolve, refusals teach (memo 3.10). The taught-spelling lint: every code span the surface teaches (guide snippets, api_map rows, breadcrumbs, error remedies) resolves in a fresh subprocess. Plus the facade repairs (tl.utils/tl.agent cold-resolve, the did-you-mean step-5 mes...
9baf740c1e36d69101aca5a19ad7cb909b2b6abde6736388bf709f374ac7b58b
Python
6,642
180
import logging import time import warnings from typing import Union import minknow_api.manager from grpc import RpcError from minknow_api.keystore_pb2 import PERSIST_ACROSS_RESTARTS from minknow_api.keystore_service import WatchResponse from typing_extensions import Literal import bream4.pb.bream.hardware_check_resul...
9ffa8ef773c2e745b8f364154e574a13f750741b00b61dcbc640a2d6fca68f8b
Python
6,643
169
"""Filter functions. """ from typing import Optional, Sequence import numpy as np from anndata import AnnData def filter_cells( adata: AnnData, filter_bool: Optional[np.ndarray] = None, keep_filtered: bool = False, min_expr_genes: int = 50, max_expr_genes: float = np.inf, min_area: float = 0,...
e6ae0f285195809b97b6e9ccb922112c1a8ee9eeae3794df839026820afac3c4
Python
6,643
166
from __future__ import print_function, division, absolute_import """A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encod...
7e25296297f4d549d68d56ba3bbd23f24718c6520a7aa776c0bb53b3c4398a17
Python
6,644
188
#coding=utf-8 import sys import os import argparse try: from lxml import etree except ImportError: raise ImportError('lxml library is required') try: from cStringIO import StringIO except ImportError: try: from io import StringIO except: from StringIO import StringIO try: from sy...
976d1fd967844358ba3330df031bb72d5311de36c96ae65459bbf8e77ebed48c
Python
6,644
199
# --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.14.5 # kernelspec: # display_name: Python 3 (ipykernel) # language: python # name: python3 # --- # # Convolut...
37ff8461910be2dee94de356e89500a3a8f517f2eeef156785696c658a2ad307
Python
6,646
188
# coding=utf-8 # Copyright 2022 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...
10234b705652048e0dd3930414e831a10173506b37457f5c38d0c097e645af37
Python
6,647
195
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Tiling(_BaseTraceHierarchyType): _parent_path_str = "treemap" _path_str =...
75f2d3f21aa1f4e0fdd9ce537e8df383ca944d215273ab23ce7beca12fd27188
Python
6,648
168
import unittest from spitfire import Library, Dimension import numpy as np from os import remove from shutil import rmtree from os.path import isfile import pickle machine_epsilon = np.finfo(float).eps class SaveAndLoad(unittest.TestCase): def test_save_and_load_1d(self): file_name = 'l1test.pkl' ...
90c890e10a4fcc56aca1ff534efc06b64081e64c4ec4689a48f389b46a3aa82b
Python
6,648
127
# -*- coding: utf-8 -*- # Resource object code # # Created by: The Resource Compiler for PyQt5 (Qt v5.6.2) # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore qt_resource_data = b"\ \x00\x00\x05\x73\ \x89\ \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ \x00\x00\x51\x0...
ed2c177c7627f1a2364e98da22de5cb82c81c8cc0b340b7a424f415a6f85bdba
Python
6,648
176
"""Functions concerning the creation of cross-validation folds. Authors ------- Marijn van Vliet <marijn.vanvliet@aalto.fi> Yuan-Fang Zhao <distancejay@gmail.com> """ import numpy as np from mne.utils import logger from sklearn.model_selection import StratifiedKFold from sklearn.preprocessing import OneHotEncoder d...
d0324bd06e4d286b7b2107e6085590b46d0d1b238694daf4244cc5400c933517
Python
6,650
223
#!/usr/bin/env python # Data manager for reference data for the SortMeRNA Galaxy tools import argparse import json import os import shutil import subprocess import tarfile import requests # Utility functions for interacting with Galaxy JSON def read_input_json(jsonfile): """Read the JSON supplied from the data ...
1f99f39166bbbfede293fc8be6d72bca88b75e83330944ef1985a5a24b921f14
Python
6,651
168
import pathlib import pkg_resources import signal import sys import traceback from PyQt6 import uic, QtCore, QtWidgets import pyqtgraph as pg from .widgets import ShowWaitCursor from ..session import ImposeDataFileNotFoundError, ImposeSession from .._version import version as __version__ pg.setConfigOption("backgro...
a1f1bc5eced10fd84aa9f2136dad434f0956343e1ab12d55918153cba151d18c
Python
6,651
239
import numpy as np import matplotlib.pyplot as plt import random as rnd import Code_General_utility_spikes_pickling as util from copy import deepcopy as dcp import scipy.ndimage as scp from numpy import exp as exp import matplotlib as mpl import warnings import logging logging.getLogger('matplotlib.font_manager').disa...
1df8d70b5bb9bc8621d751af5545b82e467a0cdc4c0779ebfb9f83e8cfe02b98
Python
6,652
193
import unittest import torch from modular_splicing.models.modules.influence_value.tanh_attention.tanh_convolved_attn import ( compute_unnormalized_attn_within_window, ) def compute_attn_directly(q, k, v, *, ocpe=None, zero_value, activation, window): """ See compute_unnormalized_attn_within_window for do...
53e3c8633a38c4c72e2cd7769cae15c91c23413d30d13e286bfa6d77fded6b72
Python
6,652
176
# !/usr/bin/env python3 # Copyright (c) 2020 PaddlePaddle 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 # # http://www.apache.org/licenses/LICENSE-2.0 # ...
a51828edc2f7a575be9cb65e7f464992c96e8e7ca358e029a8d7508073af869b
Python
6,652
146
from typing import Optional, Union import numpy as np import pandas as pd import pyvista as pv import vtk from anndata import AnnData from numpy import ndarray from ...logging import logger_manager as lm try: from typing import Literal except ImportError: from typing_extensions import Literal def vtk_inter...
7db18f10f6e0b7816d60368dbc0c411add0439bbc77548a7ce1b20cef97a1bc4
Python
6,653
157
# SOURCE: vendored from Singingkettle/ChangShuoRadioRecognition @ main # https://raw.githubusercontent.com/Singingkettle/ChangShuoRadioRecognition/main/csrr/models/backbones/cldnn.py # # CLDNN for Automatic Modulation Classification (AMC): a CNN+LSTM+DNN backbone that # classifies raw I/Q radio frames -- stacked Conv2d...
8ef5d674d747d1488ffb7bd99e068494f1bde997fe3c6d4d89243d5678eb9425
Python
6,654
190
import math import random from PIL import Image import blobfile as bf from mpi4py import MPI import numpy as np from torch.utils.data import DataLoader, Dataset import glob import os def load_encoded_feature(feature_dir, target_layer): files = glob.glob(os.path.join(feature_dir, f'{target_layer}*.npy')) num...
5eee063602be8ce17b8e719d552ff5d44114c95d497e3426484dcc8812e87dbd
Python
6,655
172
# Run test with: # torchrun --no_python --nproc_per_node=8 pytest -q -s tests/models/test_gpt_generation_parallel.py -k "parallel" import os import re import pytest import torch from einops import rearrange from flash_attn.models.gpt import GPTLMHeadModel, remap_state_dict_hf_gpt2 from flash_attn.utils.distributed imp...
22f2cfffd2601a709afc6285d1baf7490e11fc15f7ad93a35a0567409109dc37
Python
6,658
197
# General functions for multi-coil radial sampling MRI # Apr-12-2021==Zhao He==Original code # May-11-2021==Zhao He==Add MCNUFFT function # May-16-2021==Zhao He==Add crop function for 3-dimension data # May-17-2021==Zhao He==Revise MCNUFFT function # Jun-20-2021==Zhao He==Add comments import os os.environ['KMP...
d582225406a25362b1170a1f6cba70e91a6d430a7891bcd73adadf5b189bfa0c
Python
6,658
176
import numpy as np import tensorflow as tf import sys import os from keras import layers, backend sys.path.append("../utils") from func_model import extraData, apply_rev_comp, train, evaluate os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # tf.config.threading.set_intra_op_parallelism_threads(5) tf.config.threading.set_inte...
fbeff85641e14501b5e83177c8a4df61c62db1b29c5aef9a12871930a24f6b92
Python
6,658
170
"""The README first-screen subprocess golden gate (F17 B16; memo D15/D16). The block a newcomer actually copies (the FIRST ```python fence in README.md) runs in a fresh subprocess with every warning recorded, twice: - ZERO warnings (deprecations included) -- the gate that guards the first screen forever; - the two ...
af6e134a80a6154ee21a5ae520a50dea359ba870b6d6d919db6bf1d187e17a02
Python
6,659
163
# Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com) # Some parts of the code were referenced from or inspired by below # - Dong-Hyun Lee's code (https://github.com/dhlee347/pytorchic-bert) # PLUS functions """ Optimizer functions for PLUS-TFM pre-training """ import math import torch from torch.op...
43c9c01aa107c779077dfe3250c27d74d360f7cfbc769b6409f73d996773fc06
Python
6,660
191
# ----------------------------------------------------------------------------- # Copyright (c) 2013, The Deblur Development Team. # # Distributed under the terms of the BSD 3-clause License. # # The full license is in the file LICENSE, distributed with this software. # -------------------------------------------------...
336832a6afd3930848de4a421db1073b79fd21045fe100f757e5618edca7d539
Python
6,661
148
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from typing import Any import numpy as np from ultralytics.solutions.solutions import BaseSolution, SolutionAnnotator, SolutionResults from ultralytics.utils.plotting import colors class RegionCounter(BaseSoluti...
3623108ee405f7b2d9d284df8148fe73ef4c5b95fd84e11880f187c6ba307e4e
Python
6,661
173
import torch import json from collections import Counter from omop_learn.data.common import ConceptTokenizer from omop_learn.utils.date_utils import to_unixtime class OMOPDatasetTorch(torch.utils.data.Dataset): def __init__( self, omop_dataset, tokenize_on_load=False, max_num_visi...
3b1989cdf9a356820c1ad0fa670d7fbc9ef636d99997b33b8a875e283d855a38
Python
6,664
230
""" Copyright (c) 2022 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE BLUE BRAIN PROJE...
9d4994d77852bb190beb4a0ea0dcc257d9777d49cfdbb38e1fa1ee321a417e39
Python
6,666
195
from __future__ import annotations import pytest from larvaworld.lib import util from larvaworld.portal.canvas_widgets.environment_mapping import ( env_params_to_canvas_state, ) def test_env_params_to_canvas_state_maps_static_environment_layers() -> None: env_params = util.AttrDict( { "a...
03efd039fb3cd6433adcbb220496c023325cc4843f0ff52aa6be99062f0464db
Python
6,667
153
import unittest import numpy as np from larvaworld.lib import util def test_rotationMatrix(): # Test 1: Check if rotation by 0 radians returns the identity matrix result = util.rotationMatrix(0) expected = np.array([[1, 0], [0, 1]]) np.testing.assert_array_almost_equal(result, expected) # Test ...
d2b2ea1be5ff506d9bcd0acd2957a934e86821adcf99b0be3febff07aec23147
Python
6,667
108
#!/usr/bin/env python3 import os,sys,math,pickle from lefse.lefse import * def read_params(args): parser = argparse.ArgumentParser(description='LEfSe 1.1.01') parser.add_argument('input_file', metavar='INPUT_FILE', type=str, help="the input file") parser.add_argument('output_file', metavar='OUTPUT_FILE', ...
71193eddd8a977d6738635efc467fd77cf9fbc23d49e0c2f7e7e7e408680c92f
Python
6,668
208
"""Interop helpers between seqpro _core.Ragged buffers and awkward-array layouts. These functions are used by _ingest.py's ``layout_from_ak`` / ``to_ak`` paths to convert between awkward's Content tree and the flat (data, offsets, shape) buffer representation used by _core.Ragged. Awkward remains a seqpro interop/tes...
e74f04479bf2f9167cc2ab6d74923d5017dcf119fd1e739cb9788a6a0e5ea012
Python
6,668
191
from contextlib import contextmanager from typing import Any, Dict, Optional, Sequence, Tuple, Union import torch from pytorch_lightning import Callback, LightningModule, Trainer from pytorch_lightning.utilities import rank_zero_warn from torch import Tensor, nn from torch.nn import functional as F from torch.optim im...
1e12821cf8836314661827508c4b74f1291d7d10782aac95246a42a8ec3a3d62
Python
6,669
199
import io import os import av from torch.utils.data import Dataset as TorchDataset, WeightedRandomSampler import torch import numpy as np import h5py from datasets.helpers.audiodatasets import PreprocessDataset, get_roll_func # specify OpenMic location in 'dataset_dir' # 2 files have to be located there: # - openmic_...
525ac11ed52cce1246ef94719918baf011d77a8c71ccb85560214225bbc0438e
Python
6,673
151
#!/usr/bin/env python3 """ Dx AN — random K-channel sweep (figshare cohort). Question: how much does which-K-channels-are-kept matter? The Dx AM result on the 4-channel Muse-like configuration (Fp1, Fp2, O1, O2) gave AUC 0.944, and the 8-channel border-only configuration gave AUC 0.934 — counter-intuitively worse. To ...
54aaa8c765c704855173cd4aa5c8f1eb3274c94881c903a9994a11ac9e1d8444
Python
6,673
196
model = dict( type='RetinaNet', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=0, norm_cfg=dict(type='SyncBN', requires_grad=True), norm_eval=False, style='pytorch', init_cfg=None), neck=di...
f09889cdb32e5d7f6cee4d7402b88f4379aaa5faea0bad77cdd21e5891b8a9f6
Python
6,676
167
# %% import os import os, sys from config import * sys.path.append(where_am_i()) import wandb import cv2 from skimage.metrics import structural_similarity as ssim from models.models_system import MoDLReconstructor, UNetReconstructor from models import alternating as altmodels from pathlib import Path import numpy as...
268a3ee010ca0f90fcef07b425760c9385aebd3b67b852f31532b0c7d83e885d
Python
6,678
187
import os import json import random import numpy as np import itertools import torch from collections import defaultdict from src.data.tokenize import tokenize_pet_txt, tokenize_pet_mlm_txt from src.utils.util import device class CBReader(object): ''' CBReader reads BoolQ dataset ''' def __init__(se...
114d882043026b4cd761daaca5ad8cae6795ae3708e9f7298398fa63af9f6c68
Python
6,680
164
import copy import warnings from xml.etree.ElementTree import Element from xml.etree import ElementTree as ElemTree from mirp.settings.generic import SettingsClass from mirp.settings.transformation_parameters import get_image_transformation_settings from mirp.settings.feature_parameters import get_feature_extraction_s...
48bac771effd0592b85d0ac1f32b63fd19267eaa685897cdc15f5936daa80886
Python
6,680
174
''' Testing functionalities of dataloading_utilities author: obanmarcos ''' import os import os, sys sys.path.append('/home/obanmarcos/Balseiro/DeepOPT/') import argparse import numpy as np import matplotlib.pyplot as plt import pandas as pd from utilities import dataloading_utilities as dlutils from utilities.folde...
60d8a069409118a95835455d40ab6fda4840292e31980b73dadb422a40f04494
Python
6,680
121
""" constraint utils """ import os import paddle import numpy as np import logging from typing import Union from helixfold.data.utils import token_completion, dist_to_bins, get_bin_masks logger = logging.getLogger(__file__) def get_constraint_info(feat, all_chain_ids, chain_ids, ...
96db9e38c78750c35154ee68f8536dd13a7d02f1edd970af1956887e18f70df2
Python
6,680
184
# Copyright (c) 2021 PaddlePaddle 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
4c6add2b5a42b90d6e34e4951c52bba64029c3ed79de4b00fc4b7e780a81b5ad
Python
6,683
204
import csv import numpy as np import seaborn as sns import matplotlib as mpl import matplotlib.pylab as plt OUT_CSV_hetero="CSV\heterotrimer\ALL_{}.csv" OUT_CSV_homo="CSV\homotrimer\ALL_{}.csv" Types=('HB','PHOB','PI','SB','STK') D_hetero={} #Dictionary for data saving for l in Types: with open...
dced07f5c11bb83f13f4aab218e97f28c7a853afeefa0cda4d7e4cd0f0ef8a9f
Python
6,683
160
"""CAPI loss. - [0]: CAPI: Cluster and Predict Latent Patches for Improved Masked Image Modeling, 2025, https://arxiv.org/abs/2502.08769 - [1]: https://github.com/facebookresearch/capi """ from __future__ import annotations import torch import torch.distributed as dist import torch.nn.functional as F from torch impo...
205b560cbbe306550072f178a1c899423d9c9bfa8dbdf1be310300c2e13c397a
Python
6,684
186
import numpy as np import pytest from neurogym.envs.native.contextdecisionmaking import ContextDecisionMaking @pytest.fixture def default_env(): """Create a default ContextDecisionMaking environment.""" return ContextDecisionMaking() @pytest.mark.parametrize("use_expl_context", [True, False]) def test_env_...
4aaff233cf0eaa75973ca1c232026cf6aa8cbba3918d58b5fb13f50ece91ffd3
Python
6,684
161
"""Lane W051-HONESTY: default-config HuggingFace causal LM on live ``run()`` (AUD-HONESTY H1). The only pinned HF runnable test builds GPT-2 with ``use_cache=False`` AND captures with ``intervention_ready=True`` -- the configuration every user actually has (KV cache on, default capture) was never exercised by a ``run(...
dde8769562aeed580389abfdccd5862d8547f642ff1ece5954ddba0ee678ac11
Python
6,684
135
"""Utils for Faster RCNN estimator""" import os from mxnet import gluon from ....data.batchify import FasterRCNNTrainBatchify, Tuple, Append from ....data.sampler import SplitSortedBucketSampler from ....data.transforms.presets.rcnn import FasterRCNNDefaultValTransform from .... import data as gdata from ....utils.me...
063f8054d5ef2991cadc639efec8282b250dfb4b20c10ad8a1d69deace085edc
Python
6,686
176
"""repeng bridge against the real package on a tiny cached Llama. Each test compares ``tl.bridge.repeng.control_vector`` on saved activations with ``repeng.ControlVector.train`` run directly on the same model. Skips when repeng, transformers, or the checkpoint is unavailable. """ from __future__ import annotations i...
f7db2f7be56dd21ea6d6241808404afa0d92e4665e83e0f0ec8872e5b6791768
Python
6,689
128
import torch from .base_model import BaseModel from . import networks class Pix2PixModel(BaseModel): """ This class implements the pix2pix model, for learning a mapping from input images to output images given paired data. The model training requires '--dataset_mode aligned' dataset. By default, it uses ...
b2eedcdff9037714c8780cebf8467d8171de561a7caf0ba43b8048afce96b31d
Python
6,690
170
#%% import os import os, sys from config import * sys.path.append(where_am_i()) import wandb import cv2 from skimage.metrics import structural_similarity as ssim from models.models_system import MoDLReconstructor, UNetReconstructor from models import alternating as altmodels from pathlib import Path import numpy as ...