sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
9be33a3da9fed051d3a1b82905f90e2ea50ba4ad8f917e42e126f14944d96af3 | Python | 15,369 | 416 | """
Simple scikit-learn interface for Emb-GAM.
Aug-GAM: an Interpretable and Efficient Predictor using Pre-trained Language Models
Chandan Singh & Jianfeng Gao
https://arxiv.org/abs/2209.11799
"""
from numpy.typing import ArrayLike
import numpy as np
from scipy.special import softmax
from sklearn.base import BaseEsti... |
64064903424431adba08543d43b6357a0f098e4bec25d4004d6923bf8dd4e27a | Python | 15,371 | 437 | import warnings
from pathlib import Path
from typing import List, Literal, Optional, Set, Tuple, Union, cast
import cyvcf2
import numpy as np
import polars as pl
import pysam
import seqpro as sp
import zarr
from more_itertools import split_when
from natsort import natsorted
from numcodecs import (
Blosc,
VLenB... |
2093c25f83c97153846cafc9806d58d7b79ac9dffe7374cdeff2781ada6313bd | Python | 15,372 | 351 | #!/usr/bin/env python
"""Functions for gathering experience and communicating it to the main thread."""
import abc
import code
import gc
import random
from typing import Tuple, Any
import numpy as np
import tensorflow as tf
from gymnasium.spaces import Box
from tqdm import tqdm
from angorapy.agent.utils import estima... |
6cc875c744b0dfcff838e8b843828bd1e58c089e019661ffbb896f3ef36a6a26 | Python | 15,372 | 417 | """
Created on Thu Jun 18 14:13:16 2020
@author: Audrey Mazancieux
This script performs fMRI preprocessing for one subject as follows:
- Slice timing (SPM)
- Motion correction (SPM)
- Topup: merging AP and PA images, toptup estimation, and applying toptup
correction on EPI (FSL)
To do: Automatica... |
16884cf7d9ff8b609addc3a1f56f0a868de4e3c325d7c51ba4e5693c4acdc439 | Python | 15,374 | 480 | """Start multiple worker instances from the command-line.
.. program:: celery multi
Examples
========
.. code-block:: console
$ # Single worker with explicit name and events enabled.
$ celery multi start Leslie -E
$ # Pidfiles and logfiles are stored in the current directory
$ # by default. Use --... |
2152c0948c4a62b2eb2c4edf366c35e4fa84954a52fcc13c6c7652820f043796 | Python | 15,376 | 435 | # -*- coding: utf-8 -*-
"""
This process is repeated with Temp2, Temp3, Temp4 and Temp5
# Install Package
"""
!pip install spams
!pip install staintools
"""# Import Libraries"""
import itertools
import os
import statistics
import matplotlib.pylab as plt
import numpy as np
import tensorflow as tf
import tensorflow_h... |
e67cfef95fd4d52d75648e869425ad175792c4aa69103e8d1f130943f498c995 | Python | 15,387 | 480 | """
This script run a compute intensive task in parallel using multiprocessing.Pool
and compare the emissions measured by codecarbon using CPU load and RAPL mode.
It runs in less than 2 minutes on a powerful machine with 32 cores.
To run this script:
sudo apt install stress-ng
# If you want to monitor a Tapo P110 sm... |
5a6d216d5f5fef7710949a0e6f28f87882bd3b48b08a5f5ff9c92d2c5ab05eae | Python | 15,388 | 360 |
"""Théo Gauvrit
12 Octobre 2021
Make a graph with circular layout for correlation matrices"""
import pandas as pd
import networkx as nx
import numpy as np
import scipy.stats as sc
from pyvis.network import Network
import matplotlib.pyplot as plt
import seaborn as sns
from netgraph import Graph
plt.rcParams['svg.f... |
621b16581d96ac2331c158fc2f556221189e1b1706ca2c162ecc931fd28d9459 | Python | 15,392 | 371 | """W051-TRACK / AUD-CODE 2.14 "also" items: the silently-weak spines around the engine.
Torn JSONL rows, a flush() raise skipping close(), run-health rows masking an
empty run, tag-safety refusing inside a ``finally``, a second watch() on one
model duplicating every point, sparse gradients crashing untyped inside the
... |
0d0151eb14ced1e5a0f49bba11686adc996fc2d8579cf75a4756357c898e4d42 | Python | 15,396 | 381 | # Copyright (c) 2025, Jay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar, Pradeep Ramani, Tri Dao.
# Fast subset of test_flash_attn.py for quick iteration.
# Covers: causal/noncausal, varlen/not varlen, MHA/GQA, split/not split, fwd+bwd.
import os
import random
import pytest
import torch
from einops import rearran... |
f24b2dfdc39fd87a8f4d6a60caaa3369ba9a3adf8b4d90e6f167b61b0a302ad0 | Python | 15,403 | 408 | #!/usr/bin/env python3
"""
ds005385 (Wascher et al. 2025, Dortmund Vital) — CAR + 5D + Extras
===================================================================
Combined 5D + extras (FOOOF/topo/conn/asym) ingest for the
selective age-60-70 HC slice (109 subjects). Mirrors lemon_reprocess.py
pattern so outputs land in... |
fe9037d2bc5c67c031e9a78df9686ce84f919e973498a3e9706c40fddb360f4e | Python | 15,403 | 532 | import logging
import pytest
import werkzeug.serving
from jinja2 import TemplateNotFound
from markupsafe import Markup
import flask
def test_context_processing(app, client):
@app.context_processor
def context_processor():
return {"injected_value": 42}
@app.route("/")
def index():
re... |
a95cc4d703629ea18230920dca275a98cccdcef6a7ce8e569aebd3bc39b851c6 | Python | 15,407 | 384 | from __future__ import annotations
"""
----------------------------------------------------------------------------------------------------
Utility for parsing configuration files and merging them together.
------------------------------------------------------------------------------------------------... |
3207af10e143304d14ea79511cf97f0d184438a4e9e30309baf5e6b2746a0a61 | Python | 15,409 | 456 | """Archived helper module kept outside the active source tree.
This file contains older `LarvaworldParam`-related helper classes and generated
value-parameter definitions that were intentionally removed from the live package
path. It is not imported by the active application and is retained only as a
historical refere... |
1e2e6dc90f26923e4b24fa80b6ee009a19511b2ce5e263ceb19492b1bc4fae12 | Python | 15,417 | 376 | #!/usr/bin/env python3
"""
File: plot_double_correlation_heatmap.py
Created: 2021/05/18
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 University Medical Center Groningen.
A copy of the BSD 3-Clause "New" or "Revised" License can be found in the
LICENSE file in the root directory of this sou... |
cfe435de9f4969912fed0560a05f70ea8acbaf27dfaa4c193e352f93f598540f | Python | 15,417 | 410 | #!/usr/bin/env python3
"""
File: create_regplot.py
Created: 2021/11/09
Last Changed: 2022/07/13
Author: M.Vochteloo
Copyright (C) 2020 University Medical Center Groningen.
A copy of the BSD 3-Clause "New" or "Revised" License can be found in the
LICENSE file in the root directory of this source tr... |
0cd767e60467109bf291d71cc1a1e5bdace189910cb5c2c1fb8cb196e1b9abd5 | Python | 15,419 | 503 | """Utility command runner."""
import argparse
import base64
import hashlib
import io
import logging
import json
import os
import platform
import re
import requests
import shutil
import subprocess
from subprocess import check_call
import sys
import tarfile
import time
from codegen import perform_codegen, lint_code, re... |
fb741974cd1cbd786ffb9dc1446a8f92bb22e964a81d13e279d1a6c7e47fd389 | Python | 15,420 | 419 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from math import floor, log10
from os import makedirs
from os.path import basename, dirname, exists, expanduser, isdir, join
import matplotlib as mpl
import numpy as np
from . import fmtxt, plot, testnd
from .plot._base import POINT
from ._data_obj import combi... |
185002178e1c9f98e6bce9820742b6989a5386cbd3265f4beef1edc19cc0c31f | Python | 15,422 | 488 | """Parity tests for M3 capture-event materialization."""
from __future__ import annotations
import gc
import gzip
import time
import weakref
from collections.abc import Iterator
from pathlib import Path
from typing import Any
import numpy as np
import pytest
import torch
from _pickle_compare import _tensor_equal
fro... |
4d24a8e7edf7a77e5c0aa569d62fb9cc363d9df4c5ba2011a509385af2041183 | Python | 15,425 | 450 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Title(_BaseLayoutHierarchyType):
_parent_path_str = "layout"
_path_str ... |
8b572e6a2174e0874edc64b7504d3f807c9f0af5b99ead7c1c6e80d87031eebc | Python | 15,425 | 357 | import numpy as np
from tlib import tutils
# ESA World Cover
esa_world_cover_classes = [10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 100]
esa_world_cover_labels = [
'Trees', # 10
'Shrubland', # 20
'Grassland', # 30
'Cropland', # 40
'Built-up', # 50
'Barren / sparse vegetation', # 60
'S... |
a338d5c37003d389486d71d2ac26748be9b396796abb64b96c056971ebeee866 | Python | 15,428 | 478 | '''PyTorch implementation of iCNN reconstruction.
Contributions:
Shen Guo-Hua developed the original Caffe implementation of iCNN
(https://github.com/KamitaniLab/icnn). Ken Shirakawa developed initial PyTorch
implementation of iCNN. Shuntaro Aoki refactored the initial PyTorch
implementation as well as fixed bugs and... |
d8a2462e4040873d4a08488ca8d0221bf92f28af10f48b99c2d4c970dc95afa9 | Python | 15,428 | 392 | '''
Functions to run ppi analyses using nilearn and afni
This code relies upon AFNI functions, if these cannot be found by calling them
in bash it will fail.
see:
- AFNI documentation: https://afni.nimh.nih.gov/CD-CorrAna
- Di et al., (working with Biswal) has a number of papers that were useful for this code... |
eaf7afd73f05cc583fb9506c6824280292a9850ec13640d8ab49e20e559e2afc | Python | 15,439 | 404 | """
This module define class in order to analyse experiement result
"""
# pylint: disable=no-member
import logging
import sys
import pandas as pd
import numpy as np
import torch
import matplotlib.pyplot as plt
from tqdm import tqdm
import seaborn as sns
from config_manager.config_manager import ConfigManager
from datas... |
2ce5971bbc661699c4b62746b375d4f5cf8e3f74b8ed43888de574e1ee9ed296 | Python | 15,443 | 490 | import tensorflow as tf
from tensorflow.keras import Input
from tensorflow.keras.layers import (
GRU,
Activation,
ActivityRegularization,
Add,
BatchNormalization,
Bidirectional,
Concatenate,
Conv1D,
Dense,
Dropout,
Flatten,
Lambda,
Layer,
)
from tensorflow.keras.model... |
649e09727bb051a3d21f817663ef26bafe0515b973d336b48b822bf990935d4c | Python | 15,454 | 453 | # 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... |
257c5ef05b4f13fcf0c626e00ba0b9c99bc0304ce471237611427d673c914183 | Python | 15,463 | 358 | """CPU tests of the SwapAB decode branch of the forward config selector (config.py) and of
the launch grid an admitted config gets."""
import itertools
from dataclasses import replace
import cutlass.cute as cute
import pytest
from flash_attn.cute.config import (
SWAPAB,
FwdHeuristicInputs,
derive_fwd_con... |
42a7107d6a4a21b05ecf55857dc7efa68a4812bd51118db6bc5362e246f2d4ec | Python | 15,473 | 370 | """
This module create ProtBertProjectGOPoincareBall
"""
# pylint: disable=W0223
import logging
import torch.nn as nn
import torch
import geoopt
import numpy as np
from goatools.obo_parser import GODag
from goatools.gosubdag.gosubdag import GoSubDag
from tqdm import tqdm
import time
import torch
from matplotlib import ... |
a921c3591342bbf38fdcbf4300ccf213a7660a1c9c89532dd4f9e5718e64cefb | Python | 15,473 | 388 | """
Copyright (C) 2022 Giansalvo Gusinu <profgusinu@gmail.com>
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, m... |
072b808847041214904ccfb31a327516779d8eaf1abd3969295a5411ec90f6c9 | Python | 15,477 | 341 | """06. Train Faster-RCNN end-to-end on PASCAL VOC
================================================
This tutorial goes through the basic steps of training a Faster-RCNN [Ren15]_ object detection model
provided by GluonCV.
Specifically, we show how to build a state-of-the-art Faster-RCNN model by stacking GluonCV compo... |
69e4abc558dd3c07907f86ce33b88fcec4844ae3f8faaca0586e3fd54b7937f3 | Python | 15,481 | 416 | import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
import pytest
from pytest import approx
from pyriemann.datasets.simulated import (
_make_eyes,
mat_kinds,
make_matrices,
make_masks,
make_gaussian_blobs,
make_outliers,
make_classification,
make_c... |
ef589d5a0c990dd2b764ed84c0163631a388d3e19b616391a296c3db87e19053 | Python | 15,481 | 440 | # -*- coding: utf-8 -*-
"""
This process is repeated with Temp2-5
# Install Package
"""
!pip install spams
!pip install staintools
"""# Import Libraries"""
import itertools
import os
import statistics
import matplotlib.pylab as plt
import numpy as np
import tensorflow as tf
import tensorflow_hub as hub
import PIL
fr... |
f930d33cb24deda363f42a300c011ad78f9ef9bf5eb26f6b94ab58bfc56e5198 | Python | 15,484 | 551 | # coding=utf-8
# Copyright 2025 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... |
2c157c81c85d12d2ad2b4b3beb136f500a30e0407736cfdf389b671d270c3563 | Python | 15,487 | 547 | # LICENSE
#
# _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._
#
# BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License");
#
# - you may not use this software except in complian... |
6d1b49199471a322f2d33e642280d8269a2466aa652cee9fc4690a0d1cc98e86 | Python | 15,487 | 363 | """Tripwire-strengthening tests for the remaining preview comparison oracles.
Finding R13 (round-2 hunts): five preview-backend replay/gradient oracles kept
the dtype-blind fp32 decimal pair (``rtol=1e-5, atol=1e-6``) that the paddle
and MLX validation oracles already shed in b7a07864. The pair is wrong in
both direc... |
88e5faffed09542885a891e07b75a661ede0057e65639514d0acf37a18536afa | Python | 15,491 | 321 | from __future__ import print_function
from __future__ import division
import os.path as osp
import mxnet as mx
import numpy as np
from mxnet import autograd, gluon
import gluoncv as gcv
from gluoncv.data import transforms
from gluoncv.data import batchify
from gluoncv.data.batchify import Tuple, Stack, Pad
from gluonc... |
2a96493cd2513c7748fde74a8ec056f49240f1ec019ceeda9b386d6b4bcb59df | Python | 15,495 | 490 | # 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... |
1971f96d2d89f74a1182cd91d2afc835c13358aee96358978fbc7aac1b551786 | Python | 15,511 | 388 | # pylint: disable=unused-argument,abstract-method,missing-docstring,arguments-differ
"""Image Cascade Network (ICNet)
ICNet for Real-Time Semantic Segmentation on High-Resolution Images, ECCV 2018
https://hszhao.github.io/projects/icnet/
Code partially borrowed from https://github.com/lxtGH/Fast_Seg/blob/master/libs/mo... |
bcc8b3a40e35e73b519b789d19d82d86ac1e895d957c2c58957a424d609f8111 | Python | 15,511 | 388 | # model
import torch
import torch_geometric as tg
# data pre-processing
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from scipy.stats import gaussian_kde
# data visualization
import matplotlib as mpl
import matplotlib.pyplot as plt
import networkx as nx
from ase import A... |
5172660da4e27a99ab2d761ea2c88a6c742ae1bc79c2f548d40198dafcfae580 | Python | 15,514 | 419 | # SOURCE: vendored from arghosh/AKT @ master (akt.py)
from __future__ import annotations
import torch
from torch import nn
from torch.nn.init import xavier_uniform_
from torch.nn.init import constant_
from torch.nn.init import xavier_normal_
import math
import torch.nn.functional as F
from enum import IntEnum
import n... |
fe0e7dc22156b59a24b5e2a5a27fc0a2e7e4dfb4df721d089fb47ba31788dae2 | Python | 15,516 | 356 | import math
import threading
import time
import gc # garbage collection
from Utilities.common_packages import np
from Configurations import config as cfg
from numba import float32, uint64, uint32, int64, cuda
from Utilities.ufunc import compile, randn, randu, randp
from Configurations.fd1t_cfg_2d import mod, modMax, m... |
b4b6b9da4b48a8fb84c3c313821b2917942bbb777819730b164c2daa35ca4850 | Python | 15,517 | 398 | from prob2020.python import utils
import prob2020.python.sequence_context
import prob2020.python.indel as indel
from prob2020.python.gene_sequence import GeneSequence
from prob2020.python.amino_acid import AminoAcid
import prob2020.cython.cutils as cutils
import numpy as np
import pandas as pd
import pysam
import itert... |
a2be10c9a26e90b049d5421c5b538a1e1a04098c30f8047e33ea7a4d72894550 | Python | 15,519 | 464 | """
Data Structures used to represented molecules for convolutions.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
__author__ = "Han Altae-Tran and Bharath Ramsundar"
__copyright__ = "Copyright 2016, Stanford University"
__license__ = "MIT"
import csv... |
d85b5a0d877c7b694bd35c53a443e4958482c2723a4c644c54d07fd614e2a991 | Python | 15,524 | 424 | import gc
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import tensorflow
import tensorflow as tf
from sewar.full_ref import uqi, vifp
from skimage.metrics import structural_similarity as ssim
from tensorflow.keras.constraints import Constraint
from tensorflow.keras.layers import Layer
from tens... |
1660f0716f3b31ed4cae4de0e669be90e34ff02501d99a41c333299e5f91bb75 | Python | 15,526 | 383 | #!/usr/bin/env python3
import argparse
import os
import re
import shutil
import subprocess
"""
DEWSeq wrapper script dependencies:
conda install -c bioconda bioconductor-dewseq
conda install -c conda-forge r-rmarkdown
conda install -c bioconda bioconductor-biocstyle
conda install -c conda-forge r-tidyverse
conda ins... |
3bcde2887793927295d8bdcd8a63e6cdd5f70f71016248819f18c12d53d67caa | Python | 15,527 | 406 | """Behavioral tests for the 2026-04-27 performance bundle.
The bundle ships three independent performance fixes uncovered by the
2026-04-27 profiling audit (private maintainer notes):
1. **Bytecode column-offset cache** -- ``_get_col_offset`` no longer
re-disassembles the same code object on every captured frame.
... |
41fc41b795be977e257f325e1961b9fcedab5d8bc8b082e5d07b1f769214dd3e | Python | 15,528 | 357 | """
Manager and Serializer for libraries.
"""
import logging
from sqlalchemy.exc import (
MultipleResultsFound,
NoResultFound,
)
from sqlalchemy.orm import Query
from galaxy import exceptions
from galaxy.managers.context import (
ProvidesAppContext,
ProvidesUserContext,
)
from galaxy.managers.folders... |
4d843b5c7e2548e47e14b38011a6b187f907275493965419f270ea6dd3322107 | Python | 15,533 | 473 | """
Test configuration and fixtures for Larvaworld tests.
This module provides essential fixtures for:
- Deterministic testing (fixed seeds)
- Headless operation (no GUI windows)
- Temporary directory for test outputs (via tmp_path)
- Registry isolation (via parallel execution with pytest-xdist)
"""
import functools
... |
61b5bebe60fb1b66707ab5121545ec6280698eeaa413aa150f6dbb359fa802cb | Python | 15,545 | 449 | import argparse
import inspect
import logging
import os
import pickle as pkl
import random
import sys
from collections import defaultdict
from copy import deepcopy
from os.path import dirname, join
import cache_save_utils
import datasets
import imodels
import imodelsx
import imodelsx.augtree as llm_tree
import numpy a... |
b1aebec8460949cca0cbbb829339729cbcf0f466fa07b2c931a4dc989c2f577f | Python | 15,548 | 318 | import os
from os.path import join
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import matplotlib.cm as cm
from library.Tempotron import Tempotron
from library.shared_vars import sim_results_dir, plots_dir
from library.utils import load_pickle
from library.visualization import plot_tempot... |
d791ba24dc73f42bbb87bed13d267c1f5dc5c481d0b5fada318910ed566a95b4 | Python | 15,548 | 416 | __author__ = "quentin"
import os
import shutil
import tempfile
import unittest
import cv2
import numpy as np
from ethoscope.roi_builders.target_roi_builder import TargetGridROIBuilder
try:
from cv2.cv import CV_AA as LINE_AA
except ImportError:
from cv2 import LINE_AA
# Get the absolute path to the test im... |
91e91ac0df9e4ec785f6bcd0bd60b1a20f9e0da0be87ca4a4a271efb8ebff9f3 | Python | 15,552 | 477 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Workflows for generating plots from anatomical data."""
from nipype import Function, logging
from nipype.interfaces import utility as niu
from nipype.interfaces.ants import ApplyTransformsToPoints
from ... |
cb787b2c6ac68fd3c145ece50f913433dbea7fbfd7fa563b6499765e9c3f525e | Python | 15,564 | 382 | """
This includes: LossComputeBase and the standard NMTLossCompute, and
sharded loss compute stuff.
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import bioseq2seq
from bioseq2seq.constants import ModelTask
class LossComputeBase(nn.Module):
"""
Class for managing effic... |
cef25e11d2f0b44937cf4915c6190c1bd56fa3c30ec5796314062922837ff014 | Python | 15,565 | 437 | import numpy as np
import pandas as pd
import scipy as sc
from numba import njit, prange
from numba.typed import List
import scipy.spatial as spatial
from anndata import AnnData
from .het import create_grids
def lr(
adata: AnnData,
use_lr: str = "cci_lr",
distance: float = None,
verbose: bool = True,
... |
4b426ab2af3d6545fbabfa42f15b5401eb22ac50112bb4b31ad764d07e71fc0b | Python | 15,566 | 278 | # -*- 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\x02\x85\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x32\x0... |
b86bee110784feb662961a014dc9a74459adcb202bbe8fe96b74041842ed6557 | Python | 15,566 | 439 | #!/usr/bin/env python3
"""Calculates the Frechet Inception Distance (FID) and The Kernel Inception Distance (KID) to evalulate GANs
The FID and KID is calculated by assuming that X_1 and X_2 are the activations of
the pool_3 layer of the inception net for generated samples and real world
samples respectively.
Code ap... |
e45b1e447211b8b5466025556e6309b45d09fc226d872781eac055544e24c485 | Python | 15,566 | 334 | """r67 C5 -- neutral pre-execution defensive materialization (corr1-2).
Input/state clones, transfers, and fallback allocations used to inherit the CALLER's
ambient inference/no-grad state because they ran before recorded execution-context
restoration: a user calling ``.run()`` inside ``torch.inference_mode()`` minted... |
dfacfe65357b3b5fac5295129b06d0d891d43bc230c55fb69c0b168968de604d | Python | 15,567 | 455 | # Copyright 2023 Blue Brain Project, EPFL.
# See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: Apache-2.0
import argparse
import collections
import filecmp
import itertools
import logging
import math
import os
from pathlib import Path, PurePath
import shutil
import stat
import subprocess
import ... |
2cbeffd1de164b0e01d7e1ef5ca76ef60a7ad1a33fd592e3225ae82b688770e0 | Python | 15,577 | 474 | import os.path
import numpy as np
from mirp import deep_learning_preprocessing_generator
from mirp.settings.generic import SettingsClass
from mirp.deep_learning_preprocessing import deep_learning_preprocessing
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
def test_extract_image_crop():
# Without sp... |
b9e690e62525cb4227ad03b9aa22d41193f0a82e90eed5603b9f7407dce96ead | Python | 15,577 | 373 | # Contains objects for using external display applications
import logging
from copy import deepcopy
from urllib.parse import quote_plus
from galaxy.util import (
parse_xml,
string_as_bool,
)
from galaxy.util.template import fill_template
from .parameters import (
DEFAULT_DATASET_NAME,
DisplayApplicatio... |
4d37b0bf9b61fda85501c7ca783b2e7b618832ee7dc74f88ecd8b53c44b5bd76 | Python | 15,579 | 416 | """
loader.py
Class for loading continuous.dat files
and saving extracted extracellular signals
and/or multi-unit-activity spikes.
"""
import numpy as np
import pandas as pd
import probeinterface as pi
import spikeinterface as si
import spikeinterface.preprocessing as spre
from .metadata import Metadata
from ..u... |
fcaf1b5eafaa80da292d670784ac91734f9cbfe49efc0c499f0fdb8b0e7c3290 | Python | 15,590 | 474 | """
Tests for utility functions in lib/util/ - pure functions, easy to test.
Target: Increase coverage from 7-50% to 70-85% for util modules.
Impact: ~400 lines covered (+2%)
"""
import os
import tempfile
from pathlib import Path
import numpy as np
import pytest
from larvaworld.lib.util import combining, color, fitt... |
e0b38d849082d7bddce809d19bc1560dae3094a30d7f735e27b437417fc607e4 | Python | 15,591 | 402 | """Round-6 non-security ``_io`` / ``validation`` integrity findings (H2, M3, M4, M5, L7).
Each test pins ONE finding: the published record must not be able to contradict itself, the
validator must not certify an artifact the binder cannot bind, an unattestable archive must
SAY it is unattestable rather than look like ... |
726db99e4aadaeaad2a6e93e423191d64b71ccc5f75b068903deb77f2abb329e | Python | 15,593 | 592 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 7 00:07:10 2017
@author: zqwu
"""
import deepchem
hps = {}
hps['tf'] = {
'layer_sizes': [1500],
'weight_init_stddevs': [0.02],
'bias_init_consts': [1.],
'dropouts': [0.5],
'penalty': 0.1,
'penalty_type': 'l2',
'batch_si... |
8adab1194be987b0a8b21625a9e06b148c7458f8449a742565c7fa7069def535 | Python | 15,593 | 402 | import torch
import faiss
import numpy as np
import numba as nb
from sys import platform
def second_back_track(i, j, pointers, search_path, a_types):
alignment = []
while ( 1 ):
j_offset = j - search_path[i][0]
a = pointers[i][j_offset]
s = a_types[a][0]
t = a_types[a][1]
... |
0fb812effe5b310f97d4236ff897e3f2649deb9376859f414fb3b15c69dba2de | Python | 15,605 | 400 | #!/usr/bin/env python
# coding: utf8
import pylab as pl
import numpy as np
from matplotlib.patches import Arc
from matplotlib.ticker import MaxNLocator
from scipy import stats
__doc__ = """Graphics commands that allow generating all plots in the canonical figure
Copyright (C) 2014 Ingo Fründ
This code reproduces t... |
1efd3d819b24f55b4063a53464f31654063a05374831b6ce0de5d94696ea1338 | Python | 15,615 | 317 | #----------------------------------------------------------------------------------
# Code to import and pre-process (motion and bleaching correction) photometry data,
# and align photometry and behavioural sessions
# Marta Blanco-Pozo, 2023
#-----------------------------------------------------------------------------... |
85283d27e6027177bfe23649ea7bf939c6bc18cf47566069c25624c7e8a84907 | Python | 15,625 | 402 | import copy
import warnings
import datetime
import numpy as np
from typing import Generator, Self
from mirp._data_import.dicom_file_pet import ImageDicomFilePT
from mirp._data_import.dicom_multi_frame import ImageDicomMultiFrameStack, ImageDicomMultiFrameIndividual
from mirp._data_import.utilities import get_pydicom_... |
c9e97087fe66304a617052a25e87bafa0b9b228d0476e35e6a71bd2ee4e4b962 | Python | 15,626 | 304 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
df47c02e8bf7dff140d73359adefdb3206de74fc5f9aea856f89c5649c8d9e87 | Python | 15,628 | 347 | """
**For most use cases, this can just be considered an internal class and
ignored.**
This module houses the :class:`robustness.attacker.Attacker` and
:class:`robustness.attacker.AttackerModel` classes.
:class:`~robustness.attacker.Attacker` is an internal class that should not be
imported/called from outside the l... |
75c4583abdddb749bfc24a0960c401f298fc8a1dd41e495164687711e80007c7 | Python | 15,629 | 440 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Masked linear transformations for PyTorch.
The module include both functional (``masked_linear``) and ``Module`... |
a193ecff59f9c4b0e600cacb0b36bb016670eeedd1f8bf676fad659e9b5e60fc | Python | 15,633 | 395 | """r53 free_1: bound the attacker-integer allocation-bomb CLASS on the default victim path.
A hostile ``manifest.json`` integer (``num_positional_args=1e10``,
``shape=[1e9,1e9]``, ...) must never drive an 80 GB-8 EB single-shot allocation on
the default-untrusting ``tl.load(path)`` / ``tl.load(path).run(...)`` path. T... |
fc9001de0cc5efb67f9bca42c1b7ef397204ddf8f9cfad269b65a9b26ed5cd41 | Python | 15,633 | 432 | # ampdecorator.py
# Copyright (C) 2013 Bastian Venthur
#
# 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 your option) any later version.
#
# This progr... |
1eea8bff7cf88130f7393b8f9833f2405c351f07c53ab684d0dc1f443accb418 | Python | 15,634 | 368 | import pylustrator
pylustrator.start()
import os
from copy import deepcopy
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import tensorflow.keras as keras
import tensorflow_addons as tfa
from tf_spiking import DenseLIF, DenseLIFNoSpike, IntensityToPoissonSpiking
from tf_spiking.helper impor... |
81f2dbf81aaa7fd17ad7bc0b7dc6966bb2465d1c5f66226fb66ca28f711e245d | Python | 15,634 | 445 | from fnmatch import fnmatchcase
from itertools import combinations
from typing import Callable, Sequence
import numpy as np
from ._data_obj import (
NumericArg, CategorialArg, CellArg, IndexArg,
NDVar, Case, Dataset,
ascategorial, asdataobject, assub,
cellname, dataobj_repr,
)
from ._stats.stats impor... |
9d159705768a91894d9e103db1fb2376d5863627018cd703c3c0323400e96ef3 | Python | 15,636 | 411 | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from opt_einsum import contract as einsum
from util_module import init_lecun_normal
from icecream import ic
class FeedForwardLayer(nn.Module):
def __init__(self, d_model, r_ff, p_drop=0.1):
super(FeedForwardLayer, self).__init__... |
31a9f1b443aa8c0d4645c3c7b9791230c45e63eff4dbe99613de89eebd9d1462 | Python | 15,640 | 507 | # coding=utf-8
# Copyright 2024 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... |
84b144c63b3e4cf2a6d3755a31ac0a834ec1dac2dc15cd3a3c0c797c5f62607d | Python | 15,642 | 385 | """Explorer acceptance-matrix rows and D25 gate rows (memo s5; lane F25).
CPU-runnable matrix rows land here as ordinary tests; the numeric CUDA
gate rows (module-tier <= 15%, sketch tier <= 30% median full-train-step
overhead, peak memory <= 10% and flat) are ``rare``-marked and run by the
C-EXPLORER cluster row on a... |
41a4b3f14b2f9a3de1feb313867369ddc181d47cd6a5331a66696e8bd22057da | Python | 15,650 | 337 | """
Functions for plotting.
"""
import os
import numpy as np
import matplotlib.pyplot as plt
def topoplot_with_colorbar(data, raw_info, vmin=None, vmax=None, cmap='bone', mask=None):
"""
Plot topography with a colorbar on the right side
:param data: data to plot, should be size (channels,)
:param mne... |
9b5a830948147c7f0eebc3bfde4d264b809459f5004bbae7c56ac461dce3087d | Python | 15,665 | 502 | """
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... |
f99eb90a6f622023b3cbbadf91774ea8fab7c87c8e8b2e11f5de823d8a486c67 | Python | 15,674 | 409 | from functools import partial
from typing import Any
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.dymn.utils import make_divisible, cnn_out_size
class DynamicInvertedResidualConfig:
def __init__(
self,
input_channels: int,
k... |
f270fe43ed305f69ec80d5186ffad4811d03623f93b6445bab392b31572ab0fe | Python | 15,677 | 452 | """Tests for forward ``chunk_size`` capture and rerun chunking."""
from __future__ import annotations
import warnings
from pathlib import Path
from typing import Any
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.backends import (
BackendCapabilities,
BackendSpec,
... |
9c85145bfffd12ac86fd31fa301ae0d0204126c2966c27f386b87fba4154c4a6 | Python | 15,679 | 429 | """The episode-option composition table (foldA F36 delta, verbatim mandate).
Every listed (episode x option) combination is ORTHOGONAL (both features
serve their full contract side by side), COUPLED (the composition mints its
own evidence: attribution, disclosure rows, digests), or TYPED-REFUSED
(stable code, teaching... |
d5396795ec801333c3d33d168a01cd4ba8d97d33991bc67b6ef1bb114c8b0aea | Python | 15,679 | 469 | """Async I/O backend support utilities."""
import logging
import socket
import threading
import time
from collections import deque
from contextlib import contextmanager
from queue import Empty
from time import sleep
from weakref import WeakKeyDictionary, WeakValueDictionary
from kombu.utils.compat import detect_envir... |
14afbf42c46d815cd9b558a88604fe4a07b3560e5020c09ec0f9817f350f48c1 | Python | 15,680 | 393 | import io
import os
import pathlib
import unittest.mock as mock
import h5py
import numpy as np
from absl import logging
from absl.testing import parameterized
from keras.src import layers
from keras.src.legacy.saving.legacy_h5_format import save_model_to_hdf5
from keras.src.models import Model
from keras.src.models i... |
3bf281fbcfaff6022b4b719ae9d093cd390887ec582de70e8ad0a83d1d512ea7 | Python | 15,694 | 360 | """Build dataset for pose estimation"""
# pylint: disable=line-too-long
import itertools
import copy
import logging
import numpy as np
import torch
from ..registry.catalog import DatasetCatalog, MetadataCatalog
from ..detection.detection_dataset import load_proposals_into_dataset, filter_images_with_few_keypoints, fil... |
8543b50c59a81eb8edd1b36681dc3ab1aa974444b8b760953f7d5d91bab89cea | Python | 15,698 | 456 | import math
import torch
from keras.src.backend.common import dtypes
from keras.src.backend.common import standardize_dtype
from keras.src.backend.torch.ops.core import cast
from keras.src.backend.torch.ops.core import convert_to_tensor
from keras.src.backend.torch.ops.core import get_device
from keras.src.backend.to... |
cf1b4f0d13ac92cf304529b39a82f7e6c9611fd4f3cc23d80b857eeeb69dedfd | Python | 15,699 | 505 | from functools import partial
from array_api_compat import (
array_namespace as get_namespace,
device,
)
from array_api_extra import cov as xpx_cov
import numpy as np
import pytest
from scipy.spatial.distance import mahalanobis
from conftest import to_backend, approx, assert_array_almost_equal
from pyriemann.... |
19ca13f4a1458ef53a1ae87ff3e300cfe42b71329408b523dfeeab0cecdcf6b5 | Python | 15,703 | 401 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Modules and functions to compute QM energies and gradients with ASE.
The function/classes in this module wrap an... |
9db3f69fa5e5629cf398bd9c3ec8fca7e901f1d6b25c00bba734dec9641b00ca | Python | 15,705 | 434 | """
Base class shared by every simulation mode.
Holds the setup common to experiments, batch runs, evolutionary searches,
evaluations and replays: the output directory, the agent-based model, the
screen manager and the dataset the run produces.
"""
from __future__ import annotations
from typing import Any
import agen... |
dc28505c588283dfa54951481ff91c95f02dfcf1ecb601458cccdb16596b08f0 | Python | 15,705 | 408 | #!/usr/bin/env python3
"""
File: bryois_pic_zscore_enrichment.py
Created: 2022/04/22
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 University Medical Center Groningen.
A copy of the BSD 3-Clause "New" or "Revised" License can be found in the
LICENSE file in the root directory of this source... |
c0aa86b2d907684a3d58e7e71499765d607f97f2035e96fc9166cfbeb6c6bedb | Python | 15,711 | 381 | # Copyright 2021 DeepMind Technologies Limited
#
# 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 agr... |
498b3ee9a4729266e37507d690c19367d9aee7137b2e44a60a0ee85bc682200a | Python | 15,725 | 394 | """P0 characterization pins for the early-stopping unification.
These tests pin TODAY's terminal-path behavior before the outcome/settlement
machinery lands (design of record: early-stopping unification v4). Each pin is
either a permanent invariant (exception identity, chaining, structural facts)
or an explicitly-labe... |
e934abb3aef0a40ed191ade55bae80bbbd4806c764e38a812531febc19de0af9 | Python | 15,745 | 411 | '''
The page itself is defined as a `DashBlueprint` that encompasses both layout and callbacks.
The layout is a combination Dash components directly implemented in this script and
modules' layout inserted as blueprints (the form, import-export section or results section).
Such modules also contain their own callbacks... |
71b811da2737571291d8e96b459fece01d24da3bc4c0d54f7fc5688a6af1ba00 | Python | 15,751 | 323 | import numpy as np
import torch
from conftest import dataset_options_factory, get_mapping_idx_to_euler_angles
from e3nn import o3
from torch_geometric.loader import DataLoader
from coeffnet.dataset.reaction import ReactionDataset
from coeffnet.transforms.rotations import RotationMatrix
def test_input_dataset(dataset... |
1baa6f0f769eabdceadaf0c83d02e053fe43580812d4bcc74a026f1e2bdf66c0 | Python | 15,752 | 412 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Functions for calculating resting-state derivatives (ReHo and ALFF)."""
import nibabel as nb
import numpy as np
from nipype import logging
from scipy import signal
from scipy.stats import rankdata
from ... |
e5eb91d01a38bd09d4031e92f7623accd04ec8c71bf9a2353d831414a3738174 | Python | 15,760 | 476 | ###########################################################
# LC analyses: spot-level deconvolution using cell2location
# Lukas Weber, Apr 2022
###########################################################
# references:
# - cell2location tutorial: https://cell2location.readthedocs.io/en/latest/notebooks/cell2location_tu... |
4c4bd8ce47ca80ecfb19f3abbdd7b97ad76718fbfb3357a0759627a205869d5f | Python | 15,763 | 412 | import logging
import multiprocessing
from multiprocessing import Lock, Pool
multiprocessing.set_start_method("spawn", True) # ! must be at top for VScode debugging
import argparse
import glob
import json
import math
import multiprocessing as mp
import os
import pathlib
import pickle
import re
import sys
import warni... |
bb4f8766172a042e95316de73cc1a3c28b2cde658a68adca235ca6fa7c5b39f9 | Python | 15,764 | 502 | import os, sys, subprocess
sys.path.append(os.path.dirname(__file__))
try:
import flask
except ImportError:
subprocess.call(
"pip install -r " + os.path.dirname(__file__) + "//requirements.txt", shell=True
)
from flask import (
Flask,
render_template,
request,
flash,
url_for,
... |
c67962da8aaf9913abef956e45dae2dbba5f460b977fbecec3a25a653ce198ac | Python | 15,765 | 375 | """
Band-by-Band
============
Comparing how 'Band-by-Band' approaches relate to periodic & aperiodic components.
This example is based on a recent project investigating band-by-band analyses as
often done in the context of development. The paper for that project is available
`here <https://doi.org/10.1101/839258>`_.
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.