sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
bc44bb9d446d590e455512b0784bd4aad11752f69c73df6f96be5456e3314b09 | Python | 11,881 | 271 | from . import InvertibleModule
import warnings
from typing import Callable
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from scipy.stats import special_ortho_group
class AllInOneBlock(InvertibleModule):
'''Module combining the most common operations in a normalizing flow... |
54e4656a6dacd71b19c55d9338c79795d9063220320dea7ad28d7e0c3910aa31 | Python | 11,882 | 343 | """
File-based ROI builder for loading ROI configurations from external JSON templates.
This module provides the FileBasedROIBuilder class that replaces hardcoded ROI parameters
with external template files, allowing users to create and modify ROI configurations.
"""
import os
import warnings
from typing import Any
... |
826f63c149362b966652fb7f6e8a0d003063a51eef0b17915fa5e7f79abde2d1 | Python | 11,884 | 285 | import os.path
import numpy as np
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
GENERIC_KWARGS = dict([
("write_features", False),
("export_features", True),
("write_images", False),
("export_images", True),
("image_export_format", "native"),
("image", os.path.join(CURRENT_DIR, "dat... |
8a71d35d694330688ab5b706fea2cae371eaafdfd1291072039f3d77b53d315c | Python | 11,884 | 242 | '''
This should easily support only processing 2D, 3D, both, parts or full, using different encoders, inputs, etc.
'''
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import defaultdict
from itertools import chain
from sklearn.metrics import classification_report
if __name__ == '__main__' and __pac... |
93c4f2977dafa3597033161184d431ee097196c947ca7481d22fec7c53c1f5a2 | Python | 11,884 | 324 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
from __future__ import absolute_import, division
from tqdm.auto import tqdm
import torch
import torch.nn.functional as F
from trainingUtils import MultipleOptimizer, MultipleScheduler, compute_kernel, compute_mmd
from models import Decoder, SimpleEncoder,LocalDiscrimina... |
0c909c8bb5e611f386591cf2ef8c75f9354f97738e606d591aa6e5fa1f5cfb5a | Python | 11,885 | 415 | # -*- coding: utf-8 -*-
"""
Functions to measure learning performance
"""
import numpy as np
from sklearn import metrics
def r2_score(
y_true, y_pred, sample_weight=None, multioutput='uniform_average', **kwargs
):
"""
Coefficient of determination of the regression R^2.
Parameters
----------
y... |
51f40558e34389c0c39ceb8e8c18d91fb2a94b0b260a87d5bc47a15a93eadbe1 | Python | 11,886 | 314 | """
Base class(es) for all DataProviders.
"""
# there's a blurry line between functionality here and functionality in datatypes module
# attempting to keep parsing to a minimum here and focus on chopping/pagination/reformat(/filtering-maybe?)
# and using as much pre-computed info/metadata from the datatypes module a... |
2f5ff390384678e7279e11bdf7b89c23904f27f7f82389927d4be26fd4dbc96b | Python | 11,887 | 275 | import os
import qt, ctk, slicer
from SegmentEditorEffects import *
from biomedisa_extension.SegmentEditorBiomedisaTraining.Logic.BiomedisaTrainingLogic import BiomedisaTrainingLogic
from biomedisa_extension.SegmentEditorBiomedisaTraining.Logic.BiomedisaTrainingParameter import BiomedisaTrainingParameter
from biomedisa... |
e845965518c8719525b43c1983f41fba61be74762e588da6e043d3f5ca895833 | Python | 11,888 | 251 | import glob
import pandas as pd
import numpy as np
import nibabel as nib
from nilearn.glm.first_level import make_first_level_design_matrix
from nilearn.glm.first_level import FirstLevelModel
from nilearn.plotting import plot_design_matrix
from nilearn import image
import os
class color:
DARKCYAN = '\033[36m'
B... |
2f4c8c92d462b2f6a5c68c4b609d6885bf231ec4e9324657ce15446516b85c9b | Python | 11,889 | 292 | """F26: emission-view records, tag grammar, and the AMP closed-form oracle.
Covers memo 3.3-3.5 (grammar + tag safety + manifest) and 3.11 (the
bit-exact AMP correction, asserted with EQUALITY against the ``unscale_``
oracle, never allclose).
"""
from __future__ import annotations
import json
import math
import pyt... |
b71da3147fc54c0f122ac58efa8039e59e5291bf213606d6533dd4bd92ac092e | Python | 11,894 | 320 | #!/usr/bin/env python3
"""
File: create_correlation_scatterplot.py
Created: 2022/05/05
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 sour... |
d03457b031afaed0cf352dc159813d3bd2334d4faae102049a158a6fc7825320 | Python | 11,895 | 364 | import numpy as np
import scipy.interpolate as ip
from .core import misc, extrema
from .multiscale import atrous
def limit_bounds(vec, lbound, ubound):
out = np.copy(vec)
if lbound:
out = out[out >= lbound]
if ubound:
out = out[out <= ubound]
return out
def gaussian(mu, sigma):
return ... |
04926b5e1af93b3c479c14b7f37e0f36e3e5a4e0cc3d523b9cd7b238ac1859c5 | Python | 11,896 | 239 | __credits__ = ["Rushiv Arora"]
import numpy as np
from gym import utils
from gym.envs.mujoco import MujocoEnv
from gym.spaces import Box
DEFAULT_CAMERA_CONFIG = {}
class SwimmerEnv(MujocoEnv, utils.EzPickle):
"""
### Description
This environment corresponds to the Swimmer environment described in Rémi... |
1dda7aaf4db891712d84e2136827bd1d1cffdf96e1823dc3568181065ff6ef45 | Python | 11,897 | 312 | import logging
import os.path
from collections.abc import Sequence
from sqlalchemy import (
false,
null,
select,
)
from sqlalchemy.orm import (
aliased,
Session,
)
from galaxy.exceptions import RequestParameterInvalidException
from galaxy.model import (
Dataset,
DatasetCollection,
Data... |
b9676fc6abb4bf1b8a56f4878cf48271ffa75a3da54a2a8f674ec9b96dfc3f49 | Python | 11,899 | 345 | # --- 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 Pattern(_BaseTraceHierarchyType):
_parent_path_str = "pie.marker"
_path_s... |
cc6c46998f46e008561163b15bb47d6255bbcf8fa0a804c59ebb30d4853ffe69 | Python | 11,899 | 310 | """F16 B2/B3: the four cards, the copy-root ladder, motifs, and the grid.
Test-discipline law (treescope memo s12 rule 4): card tests assert
CONTENT, never non-emptiness -- the historical ``_repr_html_`` returned a
94-byte plain repr without IPython that passed any non-empty check.
"""
from __future__ import annotati... |
ecc0f3eb7301c6d48f8838db4737cad378ddcaad46124a35d8df6af8963c9e68 | Python | 11,899 | 345 | # --- 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 Pattern(_BaseTraceHierarchyType):
_parent_path_str = "bar.marker"
_path_s... |
68e7076002edc2eaacf0f9b6960cede7d24cb91d7679795785960f85f7a31330 | Python | 11,901 | 360 | """
This code creates the model described in 'Convolutional neural networks for reconstruction of undersampled optical projection tomography data applied to in vivo imaging of zebrafish' and derived from https://github.com/imperial-photonics/CNOPT
author: obanmarcos
"""
import torch
import torch.nn as nn
import numpy... |
535396d6db70602275d2aa307a6343b492e12d59f5a6a5ae081f3e734aee8076 | Python | 11,903 | 390 | """Threading primitives and utilities."""
import os
import socket
import sys
import threading
import traceback
import types
from contextlib import contextmanager
from threading import TIMEOUT_MAX as THREAD_TIMEOUT_MAX
from celery.local import Proxy
try:
from greenlet import getcurrent as get_ident
except ImportEr... |
70a3a721ef7a429ba908a3dada1badbb658e5fae786fce6d3fa51dc6f219e7bd | Python | 11,905 | 335 | """W051-EXTRACT: one frozen layout per key, on the writer AND the reader (audit 1.3 / 2.10b).
A key frozen DENSE at batch zero under ``ragged="trim"`` used to be late-admitted
to the trimmed set when a later batch drifted, while the manifest layout stayed
``dense``; ``materialize()``/``load_extraction`` then concatena... |
c4b7b4052c5f58a238c08b4b1c151e92ea5e90f5635cf110a00288b1a04e1504 | Python | 11,908 | 300 | """Pyramid Scene Parsing Network"""
from mxnet.gluon import nn
from mxnet.context import cpu
from mxnet.gluon.nn import HybridBlock
from mxnet import gluon
from .fcn import _FCNHead
from .xception import get_xcetption
# pylint: disable-all
__all__ = ['DeepLabV3Plus', 'get_deeplab_plus', 'get_deeplab_plus_xception_coco... |
8934c9636b92f67ec79a423281da4c45707d2efd58fe2cc3ecab568fe52bee64 | Python | 11,910 | 495 | from __future__ import annotations
import pytest
import env # noqa: F401
from pybind11_tests import ConstructorStats
from pybind11_tests import multiple_inheritance as m
def test_multiple_inheritance_cpp():
mt = m.MIType(3, 4)
assert mt.foo() == 3
assert mt.bar() == 4
@pytest.mark.xfail("env.PYPY")
... |
7c9b296411f33d08a6aaf77de956012c413ea60dedd3c186c143b6cbf566fcdb | Python | 11,911 | 427 | # -*- coding: utf-8 -*-
#
# densratio documentation build configuration file, created by
# sphinx-quickstart on Sat Nov 05 18:11:44 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... |
ea6b4e8ec6ab6794361bde0b4debf26cb3be023b605a1a324a748ed7c173e9fa | Python | 11,912 | 323 | #!/usr/bin/env python3
"""06_continuous_pwm_ctcf.py — Build continuous PWM-modulated allele-specific CTCF bigWigs.
Formula: ctcf_hap = bulk_ctcf × max(hap_pwm_score, ε) / max(ref_pwm_score, ε)
Only positions within ±150 bp of a CTCF-motif-overlapping phased SNP get a
factor ≠ 1.0. Factors are Gaussian-smoothed (σ=50 ... |
9baf6de5b62e602f8f9ddbe3b66832a2405d986eeef6daaa59ae9e4ac3a82639 | Python | 11,914 | 345 | # --- 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 Pattern(_BaseTraceHierarchyType):
_parent_path_str = "icicle.marker"
_pat... |
74f98d2cd23db145f282cb31c71c7742fa431688868655f71548f621edb81e06 | Python | 11,916 | 361 | # coding=utf-8
# Copyright 2022-2023 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 app... |
c384d03aed2280e326869e99c3c9556ab8a0472424ed841d6c157b694397ffc1 | Python | 11,916 | 345 | # --- 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 Fillpattern(_BaseTraceHierarchyType):
_parent_path_str = "scatter"
_path_... |
bbf8d213845dd0d00f7201bf108f41ed915537a795f211c03d91a1cf2d0b067a | Python | 11,919 | 345 | # --- 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 Pattern(_BaseTraceHierarchyType):
_parent_path_str = "treemap.marker"
_pa... |
1a03d2ac0def345ec80b69e10355189ba68ec3fb674121c1ff676c8f4a5929f3 | Python | 11,924 | 358 | #!/usr/bin/python
import sys
import os
import re
import pandas as pd
import numpy as np
import math
import ConfigParser
import json
import tabix
##### Return index of a1 which exists in a2 #####
def ArrayIn(a1, a2):
results = np.where(np.in1d(a1, a2))[0]
return results
def ArrayNotIn(a1, a2):
tmp = np.where(np.... |
4ea60d43dbb5a397fd0fc1e48196f7b75f65d10f403569a59a3bdf5b9a42fc14 | Python | 11,924 | 345 | # --- 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 Pattern(_BaseTraceHierarchyType):
_parent_path_str = "barpolar.marker"
_p... |
e47003e098209772484d1ea2763732e4aabfd6317def9f4c34ef6454393dc3b1 | Python | 11,924 | 345 | # --- 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 Pattern(_BaseTraceHierarchyType):
_parent_path_str = "sunburst.marker"
_p... |
f3781f7e3aaca5665c9adf301ee77e3fec9f25e10bc32ed12957b6bf86fc901f | Python | 11,924 | 269 | """One-backward reads: frozen= policy and the facet bridge (F04, D5-D7).
Config-built GPT-2 (zero network, the R0 discipline): the default MLP-output
linearization resolves through semantic facet evidence only, the numbers
differ strongly from the total derivative, hook removal restores bit-exact,
``frozen_applied`` i... |
85b03bfae444cf7f95ecfaf22911925dc114f4e911709cdc1c4f32a42ccd5d59 | Python | 11,929 | 345 | # --- 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 Pattern(_BaseTraceHierarchyType):
_parent_path_str = "histogram.marker"
_... |
54ab8050ffb31b973fdf8d854232f40d48bc515da151d1ca46c364b993aa74c8 | Python | 11,931 | 294 | import torch
import numpy as np
import pandas as pd
import scipy.stats as stats
import scipy.optimize
from scipy.special import loggamma
import sys
output_dtype_dict = {
'num_var':np.int32,
'beta_shape1':np.float32,
'beta_shape2':np.float32,
'true_df':np.float32,
'pval_true_df':np.float64,
'va... |
03de55fc35959ae4b18a4e240350a391629ddf4f781b012d1a2e329d2171cace | Python | 11,934 | 345 | # --- 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 Pattern(_BaseTraceHierarchyType):
_parent_path_str = "funnelarea.marker"
... |
2f56b02a847ef4b696c8396ee7e5c9ee45f00ec61fab4b6ccaeb05f257a21f60 | Python | 11,936 | 361 | import os
from voluptuous import (
PREVENT_EXTRA,
All,
Any,
Coerce,
Length,
Lower,
Range,
Required,
Schema,
Strip,
)
from voluptuous.humanize import validate_with_humanized_errors
from .exceptions import ParametersError
from .util import dotdict
intbool = Schema(lambda x: int(... |
5fe6182cd9ea71ee9292d560d70780956e17676d2b13693372ed419b77afac1a | Python | 11,937 | 301 | """04. Train SSD on Pascal VOC dataset
======================================
This tutorial goes through the basic building blocks of object detection
provided by GluonCV.
Specifically, we show how to build a state-of-the-art Single Shot Multibox
Detection [Liu16]_ model by stacking GluonCV components.
This is also a ... |
39103418a52319deafcbba660705d1e791458f887f3b163290543a807b96bedd | Python | 11,940 | 340 | """
Requirements file parsing
"""
from __future__ import absolute_import
import optparse
import os
import re
import shlex
import sys
from pip._vendor.six.moves import filterfalse
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._internal.cli import cmdoptions
from pip._internal.download impor... |
18d441dacf731ce92d244d2e08b9dce2df033ca00dcab3365645e78c87df306c | Python | 11,942 | 319 | """Tigramite toymodels."""
# Author: Jakob Runge <jakob@jakob-runge.com>
#
# License: GNU General Public License v3.0
from __future__ import print_function
import sys
import warnings
import copy
import math
import numpy as np
from tigramite.toymodels import structural_causal_processes as toys
def generate_linear_m... |
3879eb417f4dda97be3dcfbe2bac0ab8514b979b06712b7b8fad181c98f3a972 | Python | 11,943 | 310 | import awkward as ak
import numpy as np
import pytest
from pytest_cases import parametrize_with_cases
from seqpro.rag import OFFSET_TYPE, Ragged, is_rag_dtype, lengths_to_offsets
from seqpro.rag import zip as rag_zip
def case_int32():
data = np.arange(10, dtype=np.int32)
lengths = np.array([3, 2, 5], dtype=np... |
8db013b7d431539e53d724ca8a590cf28554e23ff6c77bf5da5aac48ae18acea | Python | 11,945 | 307 | import os
from typing import List, Dict
import sys
import pandas as pd
import numpy as np
import anndata as ad
from pyprojroot import here
proj_dir: str = str(here())
python_dir: str = f"{proj_dir}/package/python"
class Sa2ATAC(object):
def __init__(self) -> None:
self.proj_root: str = str(here())
... |
0a2d76bb8079fb65619205cac0c1675dc8ac132dab6a577640a812eb50a1a758 | Python | 11,947 | 294 | """G4 persisted-state contract: symmetric typed refusal + inert inventory.
The MEMO 3.3 test obligations, on real bytes where the spec demands it:
- THREE-PATH partition, parametrized over the ``__dict__``-backed path
(``Trace`` -- the must-not-drop case: it never crashed, it silently
absorbed), the hook-restored... |
6aad69cd06174dbf32e0a440fa4d518dd159d65786b54af2fef410f517b86bc8 | Python | 11,959 | 364 | """Purpose of this script is to create general forms that are programmable with
particular input. Will impliment forms for subsetting the data and
visualisation options in a general way so can be used with any
SingleCellAnalysis dataset.
"""
import sys
from flask_wtf import FlaskForm
# from flask_wtf.file import F... |
761ff50b39bad14707d238e918bfb8fe603a8c35670c45aec08151dd9f05ac9c | Python | 11,960 | 430 | from time import perf_counter
from functools import partial
import jax
import jax.numpy as jnp
import diffrax
jax.config.update("jax_enable_x64", True)
from cvsx import models
from cvsx import cardiac_drivers as drv
from cvsx import respiratory as resp
from cvsx import components as c, parameters as p
from cvsx.unit... |
c76e03d663d4d2e77af35f567c1bb3e42b61444d689f20f18533570f99fbcb6a | Python | 11,964 | 328 | """
Test module for device renaming functionality in the ethoscope scanner.
This module tests the ability of the scanner to properly handle device renaming
scenarios, particularly when ETHOSCOPE_000 devices are renamed to proper names.
"""
import time
from threading import Lock
from unittest.mock import MagicMock, Mo... |
83032a53212757bcfcb101dc8c52b63e0a3709e3cc9fff888a85f532cd42ea0f | Python | 11,968 | 288 | import torch
import numpy as np
from ovseg.data.utils import crop_and_pad_image
from ovseg.utils.torch_np_utils import maybe_add_channel_dim
import os
from time import sleep
try:
from tqdm import tqdm
except ModuleNotFoundError:
print('No tqdm found, using no pretty progressing bars')
tqdm = lambda x: x
c... |
33a060db2004ce5a4c07168a33c53ee7c55d54531d41cb677f75567c16cf87c9 | Python | 11,979 | 333 | """Run-preparation staging must publish NOTHING on failure (grind b3-l1, F-R07)."""
from __future__ import annotations
import pytest
import torch
from torchlens import _runnable_state
from torchlens._runnable_state import PreparedRunnableState, _apply_state_metadata_facts
from torchlens.errors import StateBindingErr... |
bbae178b745dde49ae67403f3a8a1769d6455a3a0023e78d346cda12f09bb302 | Python | 11,979 | 301 | """The torchlens 2.33 / tlspec_version 6 rehydration floor (drop-not-resurrect).
Artifacts written by torchlens >= 2.33 (``tlspec_version >= 6``) load; anything
older refuses with the typed ``ArtifactVersionBelowFloorError`` naming the
floor, instead of being resurrected through legacy field-alias ladders.
"""
from _... |
20a31b9c5470c8878c89f9daadbd4c86e756d3297f4f532b22f72a7b32d32c19 | Python | 11,980 | 330 | # --- 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 Rangebreak(_BaseLayoutHierarchyType):
_parent_path_str = "layout.yaxis"
... |
89ba721ee7d550d3e077bd35601cc1fe67ad76fb083fdeb112d409f004ff7bf7 | Python | 11,980 | 330 | # --- 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 Rangebreak(_BaseLayoutHierarchyType):
_parent_path_str = "layout.xaxis"
... |
dcd7c26aab366ef483ee79be2651de1882ea256de0754ebfe79e1118bba6e622 | Python | 11,982 | 319 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.checkpoint as checkpoint
import numpy as np
from einops import rearrange
from timm.models.layers import DropPath, to_2tuple, trunc_normal_
class SpatioTransLayer(nn.Module):
def __init__(self,
dim,
... |
1f15b7271251a4c8d7ad766d6737347d830bbd137882674a8db9d9dbeeaef86f | Python | 11,983 | 360 | """
This code creates the model described in 'Convolutional neural networks for reconstruction of undersampled optical projection tomography data applied to in vivo imaging of zebrafish' and derived from https://github.com/imperial-photonics/CNOPT
author: obanmarcos
"""
import torch
import torch.nn as nn
import numpy... |
16a7617a4c127e1e08a079b0a1b318a351b42385b3d9285c1392d4a75c75bcf1 | Python | 11,985 | 434 | """Baseline Op object memory and construction timing for slotting work."""
from __future__ import annotations
import argparse
import random
import sys
from collections.abc import Callable
from dataclasses import dataclass
from pathlib import Path
from typing import Any
import torch
from torch import nn
REPO_ROOT = ... |
3b9326b8b0e03bdae2c3bacbfb9fb48213cb11567f0b2985b4c1046411f9fa73 | Python | 11,986 | 248 | #!/usr/bin/env python3
# Tractor script to extract out ancestry segments from each reference population from admixed samples.
# This script has been modified to work with RFMix2 and G-Nomix output, which includes ancestry calls
# in the *.msp file and phased genotypic data in *.vcf (or *.vcf.gz) file.
# Original code ... |
9b40330afbf896192ed4764a184ffaa6a958380bbad9708002bc266cb5ccea6c | Python | 11,986 | 342 | """Lane F44 stage 2: forged injected-op provenance REFUSES at load.
Every structural violation of the persisted injected family -- the C07
``Op.injection_provenance`` grammar, the codec envelope, host anchoring,
graph entanglement, and the intervention-replacement carve-out theft -- is
a typed load refusal, never a de... |
79ec1c50f51e4632861772284189a51d3bb30b89e38145cb40b8b24584e3c185 | Python | 11,989 | 292 | """
Torch loading with the ability to remap symbols (corresponding to torch.nn.Module objects).
This is necessary since we have moved several classes around in the codebase,
and we need to be able to load old models. By default, torch.load will
fail if it encounters a class that is not in the same place as it ... |
856d2c33fa8ee0b01f8d35d61c407ebd77b17b8a5a0478b2ac62b44fee1bd6d2 | Python | 11,993 | 309 |
"""Functions for building the features for the HelixFold multimer model."""
import collections
import contextlib
import copy
import dataclasses
import json
import os
import tempfile
from typing import Mapping, MutableMapping, Sequence
from absl import logging
from helixfold.common import protein
from helixfold.commo... |
65c3891ce9939b595c093a9b9bd863adbc4b8d3d457544c4fd63c68e7009d761 | Python | 11,994 | 350 | import subprocess
from pathlib import Path
from typing import List
import matplotlib.pyplot as plt
import seaborn as sn
import torch
import wandb
from pytorch_lightning import Callback, Trainer
from pytorch_lightning.loggers import LoggerCollection, WandbLogger
from pytorch_lightning.utilities import rank_zero_only
fr... |
b3ddff28798b5f08c3693d1562a23fddb638e7e7303032fa17ebc3dee0908627 | Python | 11,997 | 325 | import tables
import pickle
import numpy as np
import logging
logger = logging.getLogger("SemanticModel")
class SemanticModel(object):
"""This class defines a semantic vector-space model based on HAL or LSA with some
prescribed preprocessing pipeline.
It contains two important variables: vocab and da... |
3c2b05927ea5df79d1775729616189c901d5de59171d7790ae05f80ee523498b | Python | 12,000 | 333 | import os
import tempfile
import unittest
import h5py
import numpy as np
from modular_splicing.dataset.h5_dataset import H5Dataset
from modular_splicing.utils.multi_h5_file import (
MultiH5File,
all_data_indices,
construct_index_subset_map,
construct_key_map,
prefixes_and_length,
)
class TestPre... |
4839c726e1544c87085f9912a8b1d043a221190bf6c81f77226c1270b6bfb42a | Python | 12,001 | 309 | #!/usr/bin/env python3
"""
File: plot_pca.py
Created: 2023/07/07
Last Changed: 2023/07/14
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 tree.
""... |
8537bda5b0a1ca8c51801466de489de1768fd43d832e70f13261f9c093300824 | Python | 12,008 | 304 | """F06 B0/B2: IG step runner -- schedule hoist, stacking, randomized audit.
Covers the attrib memo decisions D16-D21: batch-axis stacking equivalence at
rtol 1e-4, the randomized audit ladder with both named adversary cells (the
``rows[1:]`` coupling adversary under a PINNED seed, and the row-coupling
positive control... |
bc3ae2b6a0b49674791a0a40c93ae62f10deeb03ffe785ad9456c970226df07e | Python | 12,017 | 334 | from typing import Any, Dict, List, Optional, Tuple, Union
import itertools
import subprocess
import random
from multiprocessing.pool import ThreadPool
from multiprocessing import Pool, current_process, Queue
from functools import reduce
from itertools import repeat
import time
import traceback
from os.path import dirn... |
6b7ce75f09305f8a4c26b2e9f37876c0eee67006cb66bf8702b7de0a7009bf3a | Python | 12,019 | 389 | """
Translation between environment configurations and canvas state.
Converts a stored environment configuration into the objects the canvas draws,
and back again, so that edits on the canvas round-trip into the configuration.
"""
from __future__ import annotations
from collections.abc import Mapping
from typing imp... |
0a52bee37faa32fa8a6d3f6e4cd5df6229e207e306bcb23ff5282ec4e8edc35a | Python | 12,021 | 352 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""Miscellanea utility functions."""
# ============================================================================... |
55f6ef6529425533a8eca542264bdccd01985046f215793910dac3684dc65217 | Python | 12,023 | 363 | import functools
from keras.src.api_export import keras_export
from keras.src.backend import config
from keras.src.backend.common.variables import standardize_dtype
BOOL_TYPES = ("bool",)
INT_TYPES = (
"uint8",
"uint16",
"uint32",
"uint64",
"int8",
"int16",
"int32",
"int64",
)
FLOAT_TY... |
91d4e296517456bc9b08431045dcbeb7d0500ad73711e09aef1eff6face6a126 | Python | 12,024 | 199 | import os
import re
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
import sys
sys.path.insert(1,'/home/mila/l/lindongy/deeprl-timecells')
from scipy.stats import kruskal
from analysis.utils_analysis import sort_resp, plot_sorted_averaged_resp, single_cell_visualization, \
time_d... |
938fd393c72bb065274672af71b74a7be83fb05eb86e8ccf520144ea836980e0 | Python | 12,025 | 355 | from . import utils
import datetime
import glob
import numpy as np
import os
import subprocess
import tables
import time
import torch.utils.data
movie_cache = {}
# Code adapted from Mineault et al. 2021
class PVC1(torch.utils.data.Dataset):
def __init__(
self,
root="./crcns... |
2e645b6e4858a9b22ff5583926c20c5fa4cdcb6acdd722870f79b44e5fef9e06 | Python | 12,026 | 256 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
d78a3ce671550ee4fefce501a16ca61d75db1b2b8a4fe5631170f1562b06bc23 | Python | 12,026 | 305 | """F06 B7: infidelity + sensitivity metrics (attrib memo D14-D15).
Analytic infidelity rows (a linear model's gradient attribution is exactly
faithful, so infidelity is zero), the named perturbation policies and the
callable escape, the out-of-range disclosure warning, the layer/CAM shape
refusal with the expansion re... |
665eb6193f7a5838dc3ed0c1a1e55bd2f4ad0b9ea57c6e20f8822e25fe8676c4 | Python | 12,032 | 484 | # pylibtobiic.py -
# Copyright (C) 2010 Andrew Ramsay
#
# 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 progra... |
3d100430765a52027bdf06c418c7b857891e29be7cf5ed7d43dc84ed9bf8bfc3 | Python | 12,036 | 410 | from __future__ import annotations
import importlib
import os
import shutil
from collections.abc import Iterator
from pathlib import Path
from typing import Final
from unittest import mock
import osam
import pytest
from PySide6.QtCore import QPoint
from PySide6.QtCore import Qt
from PySide6.QtCore import QTimer
from ... |
65deba8011d34a5a8bed3bfb6368b990166f687cdd27de934277cba030c6598c | Python | 12,039 | 295 | # CODE ADAPTED FROM: https://github.com/MIC-DKFZ/nnUNet/blob/master/nnunet/network_architecture/generic_UNet.py
from copy import deepcopy
from torch import nn
import torch
import numpy as np
import torch.nn.functional
from torch.distributions import Normal
from network.blocks import BlockEncoder, AsFeatureMap_down, ... |
5560b01c35ae63c45b3ad1bfe83980b42749c3a9a775da72eca81f34ecf21480 | Python | 12,040 | 332 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
import pandas as pd
import math
import argparse
import os
import sys
import pwd
import pdb
import grp
INPUT_PATH = "SimBoost/data/davis_cv_nmlzd.csv"
LOG_DIR = "logs/... |
ab4da16543597b2ce7e96925b83a575c75b90c2e178e887400ba1916f0b82945 | Python | 12,041 | 275 | """Pascal VOC object detection dataset."""
from __future__ import absolute_import
from __future__ import division
import glob
import logging
import os
import warnings
import numpy as np
try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET
import mxnet as mx
from ..b... |
41f41a1f2e8bb3fc3cd9155c3255e63a76e4babea98c37fe29e083d23593d46b | Python | 12,042 | 295 | import wandb
import numpy as np
import os
from tqdm import tqdm
import torch
from torch.utils.data import DataLoader
import argparse
from sklearn import metrics
import torch.nn.functional as F
from datasets.fsd50k import get_eval_set, get_valid_set, get_training_set
from models.mn.model import get_model as get_mobilen... |
72c385e34e0c025e97de37401a42122c7ddfe4a401d2056f9a68f98e62e6515e | Python | 12,047 | 313 | """
Unit tests for Sensor API endpoints.
Tests sensor management including discovery, configuration, and data visualization.
"""
import json
import os
import tempfile
import unittest
from unittest.mock import Mock, mock_open, patch
from ethoscope_node.api.sensor_api import SensorAPI
class TestSensorAPI(unittest.Te... |
ca2a50ff285c244143aeb0a9d668d546ce3083f41b1a7386c01b9367d705ec01 | Python | 12,053 | 360 | __author__ = "quentin"
import logging
from ethoscope.hardware.interfaces.interfaces import DefaultInterface
from ethoscope.hardware.interfaces.odour_delivery_device import ( # noqa: F811 # noqa: F811 # noqa: F811
OdourDelivererFlushedInterface,
OdourDelivererInterface,
OdourDepriverInterface,
)
from et... |
81b32735d68e905f3406f4514765b38c9e103d42323e7ec4bcbc2a146f381d38 | Python | 12,054 | 259 | __author__ = 'Aaron Gudmundson'
__email__ = 'agudmund@uci.edu'
from scipy.sparse import csr_matrix, identity, kron
import matplotlib.pyplot as plt # Create Figures
import scipy.ndimage as ndimage # Image Manipulation
import scipy.linalg as linalg
import scipy.sparse as sparse ... |
850ef83c94bcbd2fd5c89ddbbe88afb4d61315b50b5715d4988d028fd1615d5d | Python | 12,055 | 380 | from __future__ import print_function, division, absolute_import
import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
import os
import sys
__all__ = ['InceptionResNetV2', 'inceptionresnetv2']
pretrained_settings = {
'inceptionresnetv2': {
'imagenet': {
'url': 'http://da... |
bf172e95f30bc6e50b69fa0f25ee0760a347730fd9f2a09fca152ad8bb2bbd2d | Python | 12,055 | 233 | import os
import re
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
import sys
sys.path.insert(1,'/home/mila/l/lindongy/deeprl-timecells')
from analysis.utils_analysis import time_decode_lin_reg, sort_resp, plot_sorted_averaged_resp
from analysis.utils_int_discrim import single_cell_... |
3ea5b2aa1d1c1dc4e59bf34071457f23d9d02cc62f428d528ede6620720d2a75 | Python | 12,060 | 436 | """VideoMAE V2, V-JEPA, and V-JEPA 2 compact classics.
VideoMAE V2: Wang et al., CVPR 2023, scales video masked autoencoders with a
dual-masking design over tube tokens.
V-JEPA: Bardes et al., ICLR 2024, predicts masked spatio-temporal regions in
learned latent space using context and target encoders plus a predictor... |
d1a13c2bf7c64d0511266e769e7f8359fed67f91e24c80b7e4a8391d7ec55d24 | Python | 12,065 | 282 | #!/usr/bin/env python3
import torch
from torch import nn
from torch import optim
from torch import autograd
import torch.nn.functional as F
import numpy as np
from utils.metrics import recall, precision, mcc, roc, prc_auc, accuracy, f1
class Learner(nn.Module):
"""
This is a learner class, which will accept a speci... |
8d7ef74002d298a086a94d73abe7b1e37f26d1d25af06cf7dd7d4e01abd7339c | Python | 12,066 | 267 | """The relation records of :func:`pyrosm.relations.relation_records`, built with vectorized
shapely calls over all relations instead of calls per relation.
Each step of the relation assembly in ``relations.pyx`` and ``geometry.pyx`` (the member
ways' lines, ``line_merge``, the closed rings, their polygons, the even-od... |
827c440ea277b371b390d670354c03933ea339de82978eff1d9b3f3c74452adb | Python | 12,068 | 324 | from unittest.mock import patch
import pytest
from absl.testing import parameterized
from keras.src import backend
from keras.src import ops
from keras.src.backend import config
from keras.src.backend.common import dtypes
from keras.src.testing import test_case
from keras.src.testing.test_utils import named_product
f... |
baa0b5e9b457ae675b8fae45ead156f3d745b0be254e1b2493d950fefd18c3dc | Python | 12,069 | 412 | import gc
import multiprocessing
import os
import pickle
import pytest
from rpy2 import rinterface
import rpy2
import rpy2.rinterface_lib._rinterface_capi as _rinterface
import signal
import sys
import subprocess
import tempfile
import textwrap
import time
SKIP_KNOWN_ISSUES = True
rinterface.initr()
def is_AQUA_or_... |
7751659777aa0c88e231fd5ce671ae285e88d1f37ddde967825929e7d2c04465 | Python | 12,072 | 350 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on June 2019
@author: Thomas Bonald <bonald@enst.fr>
@author: Bertrand Charpentier <bertrand.charpentier@live.fr>
@author: Quentin Lutz <qlutz@enst.fr>
"""
import copy
from collections import defaultdict
from typing import Optional, Union, Tuple
import numpy ... |
c1c6b23aa125d2b7efd7d27f5f8945f05e51e974eadf72f90c54d044467bf1a4 | Python | 12,072 | 368 | import torch
from torch.optim import Adam
import os
import logging
import torch
import torch.nn as nn
import numpy as np
from yuzu.utils import perturbations
# my own
def generate_maximally_activating_input(model, neuron_index, input_size, lr=0.1, steps=100):
# Create a random input tensor with the specified siz... |
cb7803c3e421966a108770e72cc1c8e9973ed5c1221d777fe24f6b1a20dbe975 | Python | 12,073 | 353 | # From Lightning-Hydra (https://github.com/ashleve/lightning-hydra-template)
import subprocess
from pathlib import Path
from typing import List
import matplotlib.pyplot as plt
import seaborn as sn
import torch
import wandb
from pytorch_lightning import Callback, Trainer
from pytorch_lightning.loggers import LoggerCo... |
229a7f279f03474538d169606851b4fdc5555c73164c1f09386191ddb7da3720 | Python | 12,078 | 341 | """
Based on https://kernelpanic.io/the-modern-way-to-call-apis-in-python
TODO : use async call to API
"""
# from httpx import AsyncClient
import dataclasses
import json
from datetime import timedelta, tzinfo
import requests
from codecarbon.core.schemas import (
EmissionCreate,
ExperimentCreate,
Organi... |
52aaa0155bf89995559b5d71fccbebd0167ce37657804c702eb6181dd7259b67 | Python | 12,078 | 421 | from . import utils
import builtins
import io
import logging
import os
import pytest
import tempfile
import sys
import rpy2.rinterface as rinterface
from rpy2.rinterface_lib import callbacks
from rpy2.rinterface_lib import ffi_proxy
from rpy2.rinterface_lib import openrlib
rinterface.initr()
def test_consolewrite_pr... |
589081d8ff66dc28c79f9874c0dde2073e8725a63b910b469cc9bb697a667fa2 | Python | 12,084 | 356 | """Round-21 honesty regressions for MHA/transformer numeric attestation.
Two fail-closed attestation defects on very common eval-mode layers:
* F1 (HIGH): a plain eval ``nn.MultiheadAttention`` + ``include_activations``
raised ``NumericAttestationError`` on a faithful replay. Capture records the
in-proj ``F.linea... |
d47489a60868887a379c59ecab746b6030c665aee21fb777b112738f956355ec | Python | 12,086 | 363 | import numpy as np
import tensorflow as tf
from keras.src.backend.common import dtypes
from keras.src.backend.common import standardize_dtype
from keras.src.backend.tensorflow.ops.core import cast
from keras.src.backend.tensorflow.ops.core import convert_to_tensor
def segment_sum(data, segment_ids, num_segments=None... |
d600e9b35a7bcc30847432fc8c01f0c12848356c33fee237996307051eb9c968 | Python | 12,088 | 341 | """Option explicitness readers, the frozen option-group kit, and the receipt.
Split out of ``torchlens/options.py`` (2026-08-26 P03 fix cycle) along the
honesty seam. Option receipt (compo wave 0, row 0.5; DOCUMENTED-UNSTABLE
spellings pending naming-session ratification): the honesty substrate for the
M3 wrapper x op... |
df8f1d33dea17b6e0df758de9fbde1b1907ecd0b43616b1a960c3983aeb4fa63 | Python | 12,093 | 219 | import subprocess
from Bio import SeqIO
import unittest
import shutil
import os
import time
import filecmp
# Prereqs:
# module load bowtie/0.12.8
# module load java
# module load samtools
# Trinity
# Copy the .gz files in sample_data/test_Trinity_Assembly to current directory
# Run using nosetests
MEM_FLAG = "--max_me... |
cee584ba14e0a83de483a17010f8f3a4a5ce0dcd26894eb286b8d6b4785b05fd | Python | 12,094 | 309 | """
A collection of methods for reading and processing data.
Functions:
parse_vcf_to_genos: Uses cyvcf2 to parse VCF format data into genotypes.
parse_seqs_to_genos: Parses fasta format or LDHat sites and locs data.
genos_to_configs: Converts genotypes into an array of two-locus configs.
"""
from __future_... |
d46a1c73efeaacd1036cfe1012562496a115bc3ac15cad8dddce0d7e2eeeb8ca | Python | 12,098 | 286 | import abc
import sys
from collections import namedtuple
from typing import List, Dict
import numpy as np
import gymnasium as gym
from angorapy.common.senses import Sensation
from angorapy.common.const import NP_FLOAT_PREC, EPSILON
from angorapy.utilities.dtypes import StepTuple
from angorapy.utilities.core import en... |
71f21671f84468cffb24525c18d852b8dd3aefa21fab1b68106193ae7f29ee0a | Python | 12,100 | 352 | """The five wave-0 static lints (oracles build item 4; D8/D14/D19/D20/D7).
Each lint is static or sub-second, cannot flake, and returns FINDINGS as
data; the gates in ``test_oracle_w0_lints.py`` apply KNOWN-GAP monotone
mechanics (D25) and each ships a plant. The five:
1. cache-key set difference (D14): every option/... |
d72f8761c0504c989141843fbb6e6efedd54a6415dd3cb6c2a33599543c4ff7b | Python | 12,100 | 394 | ### Functional mapping tools
import numpy as np
import time, sys
from swan import pycwt
from tqdm.auto import tqdm
from . import core
from . import bwmorph
ifnot = core.ifnot
from .core.baselines import DFoSD, DFoF
neighbours = bwmorph.neighbours
locations = bwmorph.locations
def isseq(obj):
'''Simple test ... |
eeb29a18ded9c3fe740296970c0c4a3d373e01ad70f2c7191f834b01e21f6781 | Python | 12,102 | 362 | """Tests for visualization node-mode presets."""
from __future__ import annotations
import re
from pathlib import Path
from typing import Any
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.data_classes.layer import Layer
from torchlens.experimental import node_styles
from torc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.