sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
3e5668327cbfbd2231bb723258ecdef89cb12f5e09f6a0fa6db4048eb7a89f83 | Python | 13,663 | 385 | import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Union, Callable, List
from ._utils import get_output_size
from . import _layers as layers
class Conv1DBlock(nn.Module):
"""Flexible block for convolutional models
Allows for flexible specification of convolutional layers, p... |
d45dd6665d5688d0ad921704873a56d6b65784f3288472b69dd075844c63bd61 | Python | 13,667 | 317 | import math
import ipdb
import torch.nn as nn
import torch
import torch.optim as optim
import os
import argparse
import datetime
import numpy as np
import evaluate
from tqdm import tqdm
from utils import utils
# from base.distill_model import Student_AdaRNN, AdaRNN,Distill
from ourmodel.distill_model import AdaRNN, St... |
f1970da94a71c9bb1e82ab447b84f379bfd40b60c59d2f68f1acd2f6305b44a6 | Python | 13,668 | 392 | """A-GATE lattice legs: the two-predicate Bundle comparison gate (foldB D6).
The measured defect: the old ``_RELATIONSHIP_RANK`` lattice collapsed the
model axis and the input axis into one rank, so the gate refused in NONE of
four probe legs via TWO independent paths — (1) an identity relationship was
accepted as pro... |
f31629f35c184f5f4328fd759136d596346595adf6d89b494ad4026743b0ef5e | Python | 13,670 | 345 | import io
import json
import tempfile
import time
import unittest
from pathlib import Path
from unittest.mock import MagicMock, patch
import requests
from codecarbon.cli import auth
from codecarbon.cli.auth import _CallbackHandler
class TestCallbackHandler(unittest.TestCase):
def setUp(self):
self.handl... |
9f48bf42cd020cd2854a8fcafacfe7a837fc0666ba53ea67de4729f356bf7ae1 | Python | 13,671 | 435 | """Aproximate joint diagonalization algorithms."""
import warnings
from array_api_compat import array_namespace as get_namespace, device as xpd
from ._backend import _add_to_diagonal
from ._check import check_function, check_init, check_weights
from ._docs import deprecated
def _arange(*args):
return list(rang... |
b521a64bbbf98a675eaa6a34d1e7e9abe4d195e54dd996c51ff611ca488faa9f | Python | 13,673 | 377 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import warnings
import numpy as np
import torch
warnings.simplefilter(action="ignore", category=FutureWarning)
from typing import Union
import pandas as pd
import scanpy as sc
import scipy
from cpa.helper import rank_genes_groups
from sklearn.pr... |
918412b9cad2331fabe5413684ead5ef4acddeff236197ee7f9173cdfe2a89e7 | Python | 13,677 | 394 | """
Wrap the internal caffe C++ module (_caffe.so) with a clean, Pythonic
interface.
"""
from collections import OrderedDict
from itertools import izip_longest
import numpy as np
from ._caffe import Net, SGDSolver
import caffe.io
# We directly update methods from Net here (rather than using composition or
# inherita... |
31259d1759d69df777a7ee2af78e257fa4ee5a9c043fc8adeb2a10baf9aa61a1 | Python | 13,683 | 373 | import os
import numpy as np
import pandas as pd
import nibabel as nib
from os.path import join as pjoin
from matplotlib import pyplot as plt
from magicbox.io.io import GiftiReader, CiftiReader, save2cifti
from magicbox.graph.tool import bfs
from magicbox.graph.triangular_mesh import get_n_ring_neighbor
from cxy_visual... |
43d0f2f020a4c64b10e5a3811c6fb85cf6b8b4ce28563790c18516fab8ab1007 | Python | 13,685 | 354 | """
Commonly used utils:
evaluation metrics e.g. similarity, AUC, AP@k, MAP@k
graph related operation
testing data generator
file I/O
visualization
etc...
by Chengbin Hou
"""
import time
import numpy as np
from scipy import sparse
import pickle
import networkx as nx
# -----------------------------------------------... |
525d3bcb1957055e3a8348876ee3a807eb95131c8908ec0488befeff7eaa84e3 | Python | 13,685 | 371 | #!/usr/bin/env python
"""
DeepST Model Trainer
Author: ChangXu
Created Time: Mon 23 Apr 2021 08:26:32 PM CST
Description: Training module for Deep Spatial Transcriptomics model
"""
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.autograd import Vari... |
6b4da4746ac999a613142a6a66bbc8116831927880a8b254be3c43edae7ac87e | Python | 13,685 | 384 | #!/usr/bin/env python
"""
Unified notification manager for Ethoscope system alerts.
This manager handles all notification services (email, Mattermost, etc.) internally,
providing a simple interface for the scanner to send notifications without caring
about which specific services are configured or enabled.
"""
impor... |
82b0bd67f5405d6654c4080a1448da97bc31c326ada1b6bc62d81d81bf5d2712 | Python | 13,685 | 369 | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 15 13:24:28 2021
@author: KEPetousakis
"""
import Code_General_utility_spikes_pickling as util
import numpy as np
import matplotlib.pyplot as plt
from copy import deepcopy as dcp
import scipy.stats as stats
import matplotlib as mpl
import matplotlib.colors a... |
1da27f4615aa5c9ad327c955ffd038235f348f1f4c1f0f1a566295c7c702c5d5 | Python | 13,688 | 325 | import logging
import math
from typing import (
Any,
)
from galaxy import (
exceptions,
model,
)
from galaxy.model.dataset_collections.types.sample_sheet_util import validate_column_definitions
from galaxy.util import string_as_bool
log = logging.getLogger(__name__)
ERROR_MESSAGE_UNKNOWN_SRC = "Unknown d... |
8af43e6310e87de4382d1e582eab20450e0b60d576090da088581230d237b3de | Python | 13,688 | 416 | import numpy as np
from numpy.testing import (
assert_array_almost_equal,
assert_array_equal,
assert_raises,
)
from sklearn.covariance import shrunk_covariance
from sklearn.utils.validation import check_is_fitted
import pytest
from pyriemann.estimation import (
Covariances,
ERPCovariances,
Xdaw... |
47d3e953f88dba8b4837662fdc1897a115a99dfc056c9b3d35a8c5da9283c461 | Python | 13,692 | 287 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import division
from __future__ import print_function
import os, itertools, random, argparse, time, datetime
import numpy as np
import random
from sklearn.metrics import mean_squared_error,... |
532704d12c82a4b2f0b8888ac1fc731f0292497f44b9b3c825f42fe142173e12 | Python | 13,693 | 363 | #!/usr/bin/env python
"""Pretrain the visual component."""
import os
import sys
import mujoco
from angorapy.common.loss import PoseEstimationLoss
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from angorapy import make_task
from angorapy.tasks.core import AnthropomorphicEnv
from... |
b8f874b60ba1a01fe9f282528d562b200119eb34a0f912938e0a50351c56ca30 | Python | 13,693 | 348 | import math
import torch
from einops import rearrange, repeat
from padding import pad_input, unpad_input
def generate_random_padding_mask(max_seqlen, batch_size, device, mode="random", zero_lengths=False):
assert mode in ["full", "random", "third"]
if mode == "full":
lengths = torch.full((batch_size... |
b9d84efe3d8b01ab8abcb46ee428e87f570fcecc7d0da0a99b036217933a1e72 | Python | 13,696 | 427 | """
Methods for model calibration
"""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Optional, Tuple
if TYPE_CHECKING:
from .dataset import LarvaDataset
import itertools
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from scipy import stats
from skle... |
2a325be6a05f4a1570065a4220d5f95634b4c5bff785f2f0a21058722393ab40 | Python | 13,699 | 288 | import json
import numpy as np
import os, sys
import random
from collections import Counter
from sklearn import preprocessing
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
import torch
import torch.nn as nn
import torch.nn.utils.rnn as rnn_utils
import torch.nn.functional as F
from t... |
4b816259692d81c54a92be142e4d749ed760001ecbaf62debded93bf2b37ea57 | Python | 13,710 | 369 | """LIT bridge contract tests against REAL lit-nlp (lane F31; PR-leg models).
These are the tests the deleted stub never had: every assertion runs against
the real ``lit_nlp`` 1.3.1 API -- the validator, LitApp construction, and the
served field contracts -- on the PR-leg tiny checkpoints
(``hf-internal-testing/tiny-ra... |
d6d39425d93c3d0305294a63d4da1bf0f614fff58b3caef34dc057e90e3bdc6e | Python | 13,713 | 353 | #!/usr/bin/env python3
"""
telo_scan.py — Telomeric tandem repeat scanner
================================================
Scans genome assemblies for telomeric motifs with strand separation and
tandem-specificity filtering (only counts motif copies that appear in runs
of ≥ min_tandem consecutive copies).
Softmasked (... |
817648b0cf6a20ee183d71e302f0023b59f2832cfdadbe2ba96b3de0544dd321 | Python | 13,715 | 413 | from contextlib import closing
from io import StringIO
from os import path
from typing import List, Optional
import numpy as np
from gym import Env, logger, spaces, utils
from gym.envs.toy_text.utils import categorical_sample
from gym.error import DependencyNotInstalled
LEFT = 0
DOWN = 1
RIGHT = 2
UP = 3
MAPS = {
... |
a72ed09c3a36a812091bcef74abff465638997f74c53de097aef4bcfa2a963ae | Python | 13,715 | 416 | r"""
Advanced AmP prediction analysis: moults, multiple f values, k_X variants, engine comparison.
This module extends the basic prediction testing to include:
1. Instar moult calculations (t1, t2, L1, L2) from MATLAB DEBtool
2. Simulations with alternate feeding levels (f_DR, f_HS, f_F424, f_JAZZ)
3. Sensitivity to d... |
80dc72f0b3f45f943c28b8126b14afd83bee4f2fe93ee1806b805ef7c1be1b8c | Python | 13,723 | 416 |
from functools import partial
import logging
import math
from typing import Tuple, List, Callable, Any, Dict, Sequence, Optional
import torch
from .tensor_utils import (
tree_map,
tensor_tree_map,
)
def _fetch_dims(tree):
shapes = []
tree_type = type(tree)
if tree_type is dict:
for v in... |
56a83b6f094b330362bd8623fadbbb1938bdc38eb19620f2c01aebb9f1db08cc | Python | 13,724 | 431 | import os
from typing import List
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from bertviz import head_view, model_view
from plotly.subplots import make_subplots
def sanitize_filename(s: str) -> str:
return "".join(c if c.isalnum() or c in ("-", "_", ".") else "_" for c in s)
def s... |
6d80a5163f38386e52b84b2649de16078b997b7831513f3b92080c16569cb237 | Python | 13,724 | 371 | # Copyright 2022 Deepfold Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
c18d479a30ada6cc95f09ece6b9c06105497ffe73a8f78f936f606dffcc789b4 | Python | 13,724 | 380 | """M1 product/lifecycle x verb seam matrix (compo memo stratum 1; F36 wave A).
Every (product state, report/read/persist verb) cell is declared ORTHOGONAL
to nothing: the matrix is CLOSED. A cell is WORKS (executes with asserted
content), REFUSES_TYPED (stable ``fields['code']`` + the right predicate in
the message --... |
10094ae1d11ce456a5f128d5665ab1169f50c32456106a43a02876e497728c4d | Python | 13,726 | 331 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import pickle
import numpy as np
import slowfast.datasets.utils as data_utils
import slowfast.utils.checkpoint as cu
import slowfast.utils.distributed as du
import slowfast.utils.logging as logging
import slowfast.utils.mis... |
0c76bc70bf585fa4cbda5f95e4b99f766d612feddae2702e8de78704ccb71d41 | Python | 13,727 | 316 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
----------------------------------------------------------------------------
| Copyright @, Xia Pan, 2022 |
|**************************************************************************|
| All rights reserved. This source co... |
b4ddc4e063a7d2c1072e2ad7639b63fbe6f2d672ab5a6379b1320dd040341468 | Python | 13,727 | 345 | """Draw-option combination TOTALITY test (viz-correctness lane, 2026-08-19).
The hardening campaign was category-driven and per-file, so nobody exercised
the CROSS-PRODUCT of user-facing ``draw()`` options: ``node_mode="profiling"``
worked, ``vis_call_depth=1`` worked, and together they crashed on any
collapsed module... |
bab85745b29630ee20fa93c17382dba617a6fc049bd30ce669c47c8051baad9b | Python | 13,729 | 322 | import pytorch_lightning as pl
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.optim import Adam, SGD
from pl_bolts.optimizers.lr_scheduler import LinearWarmupCosineAnnealingLR
from argparse import ArgumentParser
from models.networks import LPLNet
from metrics.losses import cosine_push_... |
64a28478d4805020047d2921d127669300d5fe3370d7e2cd29508ac29a6ee070 | Python | 13,730 | 410 | """Graphviz rendering coverage for conditional edge labels."""
from __future__ import annotations
import os
import tempfile
import pytest
import torch
import torch.nn as nn
import torchlens as tl
from torchlens.data_classes.trace import Trace
from torchlens.options import CaptureOptions
from torchlens.utils._torch_... |
8c99adb57c8b8d18bdd934251061791e36375fce89284e5ca2365335ad679c51 | Python | 13,732 | 427 | import logging
import os
import re
import subprocess
import sys
from voluptuous import (
REMOVE_EXTRA,
All,
Any,
Coerce,
Exclusive,
Length,
Range,
Required,
Schema,
)
from voluptuous.humanize import validate_with_humanized_errors
from . import util
from .exceptions import CUDAbinEx... |
f77f56bb069d89b55e9dfaa0f8ed7beacff2cd01dace83aa961c6798dc6eba43 | Python | 13,732 | 319 | #!/usr/bin/env python
# coding: utf-8
import gc
import dgl
import numpy as np
import scanpy as sc
import torch
from torch import nn, optim
from .data import make_graph
from .model import scBiG
from .utils import calculate_metric, ZINBLoss, kmeans, louvain
def run_scbig(adata: sc.AnnData,
n_cluster... |
da461f61eb2c7779139f85e54f83ce4884a7cee8d1d2ea4eb60e1b2ef0e610ba | Python | 13,734 | 280 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
da0f482c59f70cbc2fa400e3f6f80de58feb36a111d8cf00e6dbdda245f2828c | Python | 13,737 | 433 | """Regression tests for fastlog early-abort via ``tl.fastlog.halt``."""
from __future__ import annotations
from pathlib import Path
from typing import Any
import pytest
import torch
from torch import nn
import torchlens as tl
import torchlens._state as torchlens_state
import torchlens.capture.projections as fastlog... |
46fd47f1ad687edc86523a7c09cf63eaf3f449a92eb4526f5b0fb8233b944fe9 | Python | 13,738 | 402 | """Shared tiny model zoo for TorchLens human-facing audit notebooks.
Each public factory in ZOO returns ``(model, example_input)`` -- a CPU-ready
pair that can be passed directly to ``tl.trace(model, x)``. All models are
intentionally tiny so every notebook runs in seconds.
Usage::
from _models import ZOO
m... |
f046fa5c3bdff397cd44562c40de1c5aad19de591f10d8b13e23de73b6371490 | Python | 13,738 | 414 | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 23 14:42:14 2016
@author: Rafael
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from dipy.core.ndindex import ndindex
from dipy.reconst.dti import (from_lower_triangular, decompose_tensor)
import scipy.optimize as opt
from dip... |
cce5146a584a6c9c151270a1f248548f9fcc4e9b41e7cb5a22919f2c5dd25bf2 | Python | 13,742 | 369 | from sklearn.metrics import confusion_matrix
from tensorflow import keras
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from tensorflow.keras.callbacks import EarlyStopping
from tensorflow.keras.callbacks import ModelCheckpoint
import numpy as np
import pandas as pd
import mat... |
73bb1af6e8a63df22e22026e48b9fb00aa7d116e02c53848869ea9e2fae901e5 | Python | 13,743 | 338 | #!/usr/bin/env python3
"""
Diagnostic Q — individual-level structure within AD, FTD, HC.
Step back from classification. For each group, ask:
1. Where does each individual sit in the Dx P 15-feature HC-anchored space?
2. Is the within-group dispersion random (isotropic cloud) or structured
(discrete subgroups)... |
51c88a2bfe9a8ba3fb03387f59a4b5e6d8146311290c026d1f2291591a17f740 | Python | 13,746 | 432 | #!/usr/bin/env python3
#
# Open Chinese Convert
#
# Copyright 2026 Carbo Kuo and contributors
#
# 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... |
749bb55b5b912a15a0adb306371641522f4d1287291e427b91bb37f49bbb2ebc | Python | 13,746 | 352 | """P1 gates: record types, amendment registry, seam contracts, scatter parity.
* Three-way coverage closure: manifest keys == store slots + extra-key
channels; every ingest-produced fields_dict key classified.
* Regenerate-and-diff: the generated manifest matches the source spec.
* Scatter parity: for every journal ... |
8f0fb6513558a874d8d7bde8771a448f893fa4c6597eaae3f0420667889f9d04 | Python | 13,749 | 361 | """R36 capture-lifecycle memory hygiene: the CPU-provable halves.
The runtime CUDA halves (fence integrity under contention, allocator
interference, ledger split on a multi-GPU box) are on the GPU-box plan; these
tests pin the host-side contracts that do not need a device.
"""
import pytest
import torch
import torch... |
bb10f30b08cefd865b1cb726ca5137a282bce6ad7b21fe7a955e69b591902a84 | Python | 13,754 | 387 | import numpy as np
import pandas as pd
import pytest
from types import SimpleNamespace
from larvaworld.lib.process import import_aux
@pytest.mark.fast
def test_read_timeseries_from_raw_files_per_parameter(tmp_path):
"""
Verify that the legacy Jovanic-format reader assembles columns, applies defaults,
and... |
e75f4e1efdae8b865e2609044329e5be9ddd6672f251884e4a083b5cbef82752 | Python | 13,756 | 363 | """
Providers that provide lists of lists generally where each line of a source
is further subdivided into multiple data (e.g. columns from a line).
"""
import logging
import re
from urllib.parse import unquote_plus
from . import line
_TODO = """
move ColumnarDataProvider parsers to more sensible location
Transpose... |
131c6a4e3c804d7760bd1ead91be64ab332d514ab7e0964e5afabb36b8caf8a5 | Python | 13,757 | 357 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
38bfa8354af57fcf88d0eed6179195c79c89cecd489f4182b489e2e57a5f544b | Python | 13,758 | 390 | # 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 with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
efdc2012e7f960f1443c19a4159495db74cfefbf0c8f310f548225090658e11d | Python | 13,760 | 329 | import os
import re
import shutil
import json
from glob import glob
from bdpy import makedir_ifnot
def makedata(src, source_type='bids_daily', output_dir='./output', root_dir='./', bids_dir='bids', fmap=False, dry_run=False):
'''Create BIDS dataset for OpenNeuro.'''
if not source_type == 'bids_daily':
... |
bea657314926a4d9ffb6f80ff0c86c2796faff2fe177f235c18497b1b5abd2cd | Python | 13,767 | 404 | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 15 13:24:28 2021
@author: KEPetousakis
"""
import Code_General_utility_spikes_pickling as util
import numpy as np
import Code_General_Nassi_functions as nf
import matplotlib.pyplot as plt
from copy import deepcopy as dcp
import scipy.stats as stats
import matplotlib
impo... |
6b25f6624f5a25451dd2638adafe3e91805809cacdeba542914f4405d9b0c1c1 | Python | 13,769 | 412 | from functools import lru_cache
from typing import Generator
import numpy as np
from mirp._features.szm_matrix import MatrixSZM
from mirp._images.generic_image import GenericImage
from mirp._masks.base_mask import BaseMask
from mirp._features.histogram import get_discretisation_parameters
from mirp._features.texture_... |
f24fdde94c843f513347445fdaebf4f020ca9f78538b9a3ef13a48d0c469fcef | Python | 13,770 | 411 | """Tests for the specparam.models.group, including the group model object and it's methods.
NOTES
-----
The tests here are not strong tests for accuracy.
They serve rather as 'smoke tests', for if anything fails completely.
"""
import os
import numpy as np
from numpy.testing import assert_equal
from specparam.model... |
99b59365fd342449e3b877f156804acb32dcac8b7a8b8be38b2502da96b1c9d0 | Python | 13,771 | 354 | """Netron export acceptance contract, tier T1 (lane F14, netron memo s6).
Strict ``google.protobuf.json_format`` parse into ``onnx.ModelProto`` plus
``onnx.checker.check_model(full_check=True)`` on every fixture -- the gate
that caught four real structural bugs (SSA violations, unsorted function
bodies, a missing scal... |
9d85babf552dd6f2c74ef77d5c9727b6b0926122d2bdf4dc1518466af442b4f7 | Python | 13,775 | 384 | --------------------------------------------------------
# Based on BEiT, timm, DINO and DeiT code bases
# https://github.com/microsoft/unilm/tree/master/beit
# https://github.com/rwightman/pytorch-image-models/tree/master/timm
# https://github.com/facebookresearch/deit
# https://github.com/facebookresearch/dino
# ---... |
81b4ff5b16bd085dc9fc6d8cf5c301f16cbd1fb01ff9fec607bb6ae096629f59 | Python | 13,778 | 366 | from sklearn.metrics import confusion_matrix
from tensorflow import keras
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from tensorflow.keras.callbacks import EarlyStopping
from tensorflow.keras.callbacks import ModelCheckpoint
import numpy as np
import pandas as pd
import mat... |
4c0eeaa328182adbaec676646f465f906d22cab774b0bb3975bd32591cdb5555 | Python | 13,779 | 289 | #! /usr/bin/env python3
'''
NOTE FOR KAAN (in case I forget): the above line is called a `shebang` and it points to the Python interpreter that will be used to run this script. It point to virtual environment that I have locally on my PC. In you case, you can install the requirements system-wide (it should be just Ope... |
077e39fa5c4188a3517673289ae10aba74ab879219a5b7e9b2c0a0224e97c7a6 | Python | 13,780 | 448 | """Immunizer liveness: prove each exemption narrowing is LOAD-BEARING.
Companion to ``tests/test_validation_exemption_ledger.py`` (grind r2 row 19 /
matrix R08). The ledger proves every exemption is registered with a contract
citation. This module proves the narrowings actually hold the tripwire up.
The pattern, per ... |
79c63ab38b71e0059090842966a50002b427f094811992a84b94046b2e5b3a0d | Python | 13,781 | 403 | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 15 13:24:28 2021
@author: KEPetousakis
"""
import Code_General_utility_spikes_pickling as util
import numpy as np
import Code_General_Nassi_functions as nf
import matplotlib.pyplot as plt
from copy import deepcopy as dcp
import scipy.stats as stats
import matplotlib
impo... |
cb655c2d582d86585d73b4828fc75e9ea08972004c1b344547e5dc54399fe57c | Python | 13,783 | 296 | """
Job control via a command line interface (e.g. qsub/qstat), possibly over a remote connection (e.g. ssh).
"""
import logging
import time
from typing import TYPE_CHECKING
from galaxy import model
from galaxy.jobs.job_destination import JobDestination
from galaxy.jobs.runners import (
AsynchronousJobRunner,
... |
12c37b7b5a5ab3b2148256a3e0d847a6b9e95ef12999ee7d8674a0dd0037b1ed | Python | 13,784 | 288 | """Collection type descriptions and the compatibility algebra.
Three operations on collection types, each answering a distinct question:
- ``accepts(other)``: asymmetric direct-edge check. True iff an output
collection of type ``other`` can be connected to an input slot whose
declared type is ``self``. Used at wo... |
eda96cb6c396a6de730254c28a5b207f4a1fbc32af0495cc457dbc928bf2dc4d | Python | 13,788 | 291 | """
Managers, serializers for Galaxy config file data. ConfigSerializer for all users
and a more expanded set of data for admin in AdminConfigSerializer.
Used by both the API and bootstrapped data.
"""
import logging
import sys
from typing import Any
from galaxy.managers import base
from galaxy.managers.context impo... |
f6ea4918a91f96cae88a5b2a79381705343bbd0366c9cebbf4cfdfe1234641d3 | Python | 13,794 | 440 | from __future__ import annotations
from collections.abc import Callable
import numpy as np
import osam
import pytest
from numpy.typing import NDArray
from labelme._automation import Detection
from labelme._automation import _ai_assist
from labelme._automation import _osam_session
from labelme._automation._ai_assist ... |
ea84ad645ef2803ca988c78a78e138badaeccba7d6d9343e00a9cc2370c25ea0 | Python | 13,797 | 305 | #!/usr/bin/env python3
"""
Dx AT — Proper held-out validation (Option C reframe)
======================================================
Builds the AD diagnostic tool's defensible structure that the v0.76
draft obscured: features and pipeline parameters were selected on a
subset of cohorts (Dx L through Dx S series); t... |
b4162e1b5a2926fbb3bb1556eb47e6b6df973a6256b944140bdee372bd35a73e | Python | 13,801 | 343 | import numpy as np
import torch
from ovseg.utils.torch_np_utils import check_type, maybe_add_channel_dim
from skimage.measure import label
from skimage.transform import resize
from torch.nn.functional import interpolate
from scipy.ndimage.morphology import binary_fill_holes
from ovseg.utils.torch_morph import morph_cle... |
d4d43ffcb1432dc3d1b1e22a5920237ef4e91436ff77ed1992b91680aea571d0 | Python | 13,802 | 443 | """
corr_figs.py
This script contains functions defining USI correlation figure panel analyses.
Authors: Colleen Gillon
Date: January, 2021
Note: this code uses python 3.7.
"""
from util import logger_util
from sess_util import sess_ntuple_util
from analysis import misc_analys, corr_analys
from paper_fig_util impo... |
e9d4898b0db355d0990680766a2b705a96944d975983780a4b0bc64abd48de1d | Python | 13,802 | 432 | """
Configuration and Generator classes for virtual larva groups.
"""
from __future__ import annotations
from typing import Any, Optional
import copy
import numpy as np
import param
from .. import reg, util
from ..param import (
ClassAttr,
Larva_Distro,
Life,
NestedConf,
Odor,
PositiveIntege... |
5c97373bff7725ccd7e31ee93dc1abe0a176411a4b5cd375ff5b8fb4d8f8cd3f | Python | 13,804 | 337 | import os
import torch
import torch.nn as nn
import numpy as np
import skimage
import PIL.Image
import torch.nn.functional as f
import torchvision.transforms as transforms
from skimage import morphology
from skimage.color import rgb2gray
from collections import OrderedDict
class SESF_Fuse():
"""
Fusion Class
... |
feedf9a815da1ac17a483c7f103127d4e57489437d373a5316c7ddc1d0c0fa32 | Python | 13,805 | 403 | """Tigramite causal discovery for time series."""
# Author: Jakob Runge <jakob@jakob-runge.com>
#
# License: GNU General Public License v3.0
from __future__ import print_function
from scipy import stats
import numpy as np
import sys
import warnings
from .independence_tests_base import CondIndTest
class RobustParCor... |
befe1521158ec4ee3b8be981a21e39ab936c6bb29c3f4105c461bc371459ed6e | Python | 13,813 | 363 | import os
import numpy as np
import pandas as pd
import pickle as pkl
import nibabel as nib
from os.path import join as pjoin
from matplotlib import pyplot as plt
from magicbox.io.io import CiftiReader, save2cifti
from magicbox.algorithm.plot import plot_bar
from cxy_visual_dev.lib.predefine import Atlas, LR_count_32k,... |
25bc809b238683fa79f12b9a5c9a77e2f747a806e13fe37f90f79188fc4ca14a | Python | 13,817 | 309 | """r7 R74 F1 (opus b9 MED-HIGH, PROVEN): pin the forward-replay tolerance band.
The band behind every per-op replay verdict (`_tolerances_for_dtype`,
consumed by ``validation/core.py`` with ``allow_tolerance=True``) appeared in
ZERO test files, while the sibling GRAD band is pinned hard
(``tests/test_grad_tolerance_dt... |
a5a7f50c3f3e44d3b98c22e1a5311cb0ab1bd1ba66e158c8d696df45cf6d5cb5 | Python | 13,821 | 248 | import numpy as np
from tqdm import tqdm
import operator
import pandas as pd
from ..utils import gislib, constants, utils
from ..core.flowdataframe import FlowDataFrame
distfunc = gislib.getDistance
class Radiation:
"""Radiation model.
The radiation model for human migration. The radiation model assumes... |
902514c412b8374217256ab4db5949f9497b23de697a2c4a0e6aabe9311201c8 | Python | 13,822 | 317 | """Default setting in training/testing for directpose"""
from yacs.config import CfgNode as CN
_C = CN()
# ---------------------------------------------------------------------------- #
# Distributed DataParallel setting: DDP_CONFIG
# ---------------------------------------------------------------------------- #
_C... |
9c3268e4500db270615f27497d3b6d7845e4477a5a5f884c6995b57f314510ce | Python | 13,822 | 392 | import numpy as np
import pytest
import scipy.signal
import tensorflow as tf
from keras import Input
from keras import Sequential
from keras.src import backend
from keras.src import layers
from keras.src import testing
class TestSpectrogram(testing.TestCase):
DTYPE = "float32"
@staticmethod
def _calc_sp... |
727b014306a02c672c284d466c69bc68c31a2174500d1bf59e9f8f8102782827 | Python | 13,830 | 315 | """
Custom Algorithms
=================
This example covers defining and using custom fit algorithms.
"""
from specparam import SpectralModel
# Import function to simulate a power spectrum
from specparam.sim import sim_power_spectrum
# Import elements to define custom fit algorithms
from specparam.algorithms.settin... |
2a1a77cf131314daa235473e833731133f651794e277fb3ef819ed48cf9baaac | Python | 13,835 | 364 |
"""Feature processing logic for multimer data pipeline."""
from typing import Iterable, MutableMapping, List
from helixfold.common import residue_constants
from helixfold.data import msa_pairing
from helixfold.data import msa_pairing_a3m
from helixfold.data import pipeline
import numpy as np
REQUIRED_FEATURES = fro... |
43983bba4e0b3b073142f4cfa6cba3221870c44cef293bf25d725273a7b10390 | Python | 13,836 | 255 | """
Command-line interface for sc_crop.
Three modes, selected automatically from the arguments:
Detect (default — no coordinates):
sc_crop -i t2.nii.gz [-o t2_cropbox.nii.gz]
sc_crop -i t2.nii.gz --detect [-o t2_cropbox.nii.gz]
Crop (coordinates provided, or --crop flag):
sc_crop -i t2.nii.gz -xmin 1... |
d74a8a9b4e0e49a0449b93e73a9e187201329f28399fb3f2e20afed97de2dca6 | Python | 13,838 | 359 | """Semantic pooling contract tests (transforms memo B5; lane F19).
Covers the three-valued mask policy (decision 12: contradicting mask
refuses, present mask is mask-aware, absent mask refuses without the
recorded ``assume_no_padding`` assertion), first/last as VALID-index
gathers (never physical endpoints), the CLS g... |
9c3a35dcdd43aad660bcc00996931038ef3b53594627811b91490a43629515af | Python | 13,842 | 347 | import numpy as np
from os.path import basename, join, exists, isdir, split
from os import listdir, environ, walk
from ovseg.utils.io import read_data_tpl_from_nii, read_dcms, read_nii
import nibabel as nib
import torch
class Dataset(object):
def __init__(self, scans, preprocessed_path, keys, folders, ignore_mis... |
fd148790de4f7e1ea040e32d0725a233ae5e26242e1b0489cf5f85a7a776cca8 | Python | 13,842 | 443 | """Tests for native TorchLens input attribution."""
from __future__ import annotations
import pytest
import torch
from torch import Tensor, nn
import torchlens.attribution as attribution
class TinyLinear(nn.Module):
"""Single linear layer with fixed weights for closed-form gradient checks."""
def __init__... |
0bf560115bca34f5371d1ee97cd9d99ef24bd44efb4b4277dd14876aa7e9cbed | Python | 13,844 | 325 | import os
from distutils.log import warn
from importlib import import_module
from itertools import count
from brian2.only import *
from numpy.lib.format import open_memmap
import deepdish as dd
import numpy_ as np
import inputs
from util import ensure_unit
from spike_utils import iterspikes
def get_raw_spikes(Net, ... |
dab7568399405c6da1936ec0320f2b3491cf76599c10379e9b853c5a9c3d3027 | Python | 13,844 | 457 | import contextlib
from types import SimpleNamespace
from typing import Tuple
from unittest.mock import patch
import click
import pytest
from click.testing import CliRunner
from celery.bin.base import handle_preload_options
from celery.bin.celery import celery
from celery.signals import user_preload_options
@pytest.... |
8e0e1e3a962f848d5a85e15318ecc7b05cfb54da09a62f8799cdebe25d067f1c | Python | 13,856 | 405 | """
Authentication middleware for Ethoscope Node.
Provides secure session management, PIN validation, and authentication decorators.
"""
import logging
import time
from collections.abc import Callable
from functools import wraps
from typing import Any
import bottle
from .session import SessionManager
class AuthMi... |
968e49a4b7344cbfc90ad4ffa13dac1b9a952c8009c3578101ffef21dc88f7ad | Python | 13,859 | 329 | """Artifact self-coherence closures (r83 C3, r82 secA S3 + S4).
S3 -- the callable a loaded artifact EXECUTES comes from ``manifest.json ->
run.callable_registry[].key``. The SAME call is named independently by
``manifest.json -> sites[].function_path`` and by ``metadata.pkl ->
layer_list[].func_name`` / ``.func_id.qu... |
c5254e63fcc3ebf8fcc07f4b49488b3270e9c4632a1896439731054dd8da5efa | Python | 13,860 | 344 | #!/usr/bin/env python3
"""
File: plot_optimization_stats.py
Created: 2022/07/21
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 tree... |
1c055c415c5184b4b12b9752be08c1b5a3ac1a8a8385c0d6b502f51a8f996fbe | Python | 13,861 | 361 | # 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
#
# Unless required by applic... |
195da67c261a9291602f442706570c4d6c336c2b3daa0cd24c106aa880238d19 | Python | 13,862 | 395 | #!/usr/bin/env python3
"""
Spatial Transcriptomics Data Augmentation Module
This module provides functions for spatial data analysis and gene expression augmentation
by combining spatial proximity, gene expression similarity, and morphological information.
Functions:
1. cal_spatial_weight: Calculate spatial n... |
a196876f702ae4cdd6ee5fe31a439b329ae5389fd32c137481a30d91aa84d6a5 | Python | 13,863 | 337 | """Lane F01 injections checkpoint: ``log_injections`` stages 0-1.
Surgery memo 3.5 / foldA D12: computation performed inside intervention
hooks becomes first-class injected-op records with anchored identity.
Covered here, with THE MISFIRE TEST first (the highest-priority test in the
build -- both halves of the no-ordi... |
df7aca57d28f2825bbc06485b6ff4d8d74ef09bb819c623780689e7bd9078e3e | Python | 13,867 | 405 | #!/usr/bin/env python
# coding: utf8
import numpy as np
import copy,sys
import pdb
__doc__ = """
This code was adapted from Fründ, Wichmann, Macke (2014): Quantifying the effect of inter-trial dependence on perceptual decisions. J Vis, 14(7): 9.
See Copyright notice below
This module defines the basic functionality... |
57048a0c3cac55cc15b300f8f0175ae5b9f4a773a039dfb94bcbe3ac0bf30e40 | Python | 13,868 | 424 | import sys
import argparse
import logging
import time
def pase_info(seq):
info = {'SVLEN': 0, 'END': 0, "SVTYPE": '', "RE": 0, "CHR2": ''}
for i in seq.split(';'):
if i.split('=')[0] in ["SVLEN", "END", "RE"]:
try:
info[i.split('=')[0]] = abs(int(float(i.split('=')[1])))
except:
pass
if i.split('='... |
cf31a5e60d728a38f31011770fb6225c7089dd8f4f854ea7e7e0e2e3ce33620a | Python | 13,869 | 405 | #!/usr/bin/env python
# coding: utf8
import numpy as np
import copy,sys
import pdb
__doc__ = """
This code was adapted from Fründ, Wichmann, Macke (2014): Quantifying the effect of inter-trial dependence on perceptual decisions. J Vis, 14(7): 9.
See Copyright notice below
This module defines the basic functionality... |
87ebde6419a35d0d5750206d453e97a9f15d771c0348af63670a73b651526d0a | Python | 13,870 | 370 | import copy
import functools
import os
import sys
import blobfile as bf
import torch as th
import torch.distributed as dist
from torch.nn.parallel.distributed import DistributedDataParallel as DDP
from torch.optim import AdamW
from . import dist_util, logger
from .fp16_util import MixedPrecisionTrainer
from .nn impor... |
219cda64e61836d68945b9b332f34c6cb3974fba24ffc8181f3899a0d052b475 | Python | 13,873 | 331 | import logging
import re
import time
from .cromwell_metadata import CromwellMetadata
from .cromwell_rest_api import CromwellRestAPI
logger = logging.getLogger(__name__)
class WorkflowStatusTransition:
def __init__(self, regex, status_transitions, auto_write_metadata=False):
"""
Args:
... |
76bbad57e101d1866d39d269d5e18c3476d1a5b1bc2dbbcd7dc1fa282da53c5c | Python | 13,873 | 405 | #!/usr/bin/env python
# coding: utf8
import numpy as np
import copy,sys
import pdb
__doc__ = """
This code was adapted from Fründ, Wichmann, Macke (2014): Quantifying the effect of inter-trial dependence on perceptual decisions. J Vis, 14(7): 9.
See Copyright notice below
This module defines the basic functionality... |
62a8db5e0576802f4a2fb30bff2956f7a6c81b61246c428a3ea928141181e491 | Python | 13,877 | 405 | #!/usr/bin/env python
# coding: utf8
import numpy as np
import copy,sys
import pdb
__doc__ = """
This code was adapted from Fründ, Wichmann, Macke (2014): Quantifying the effect of inter-trial dependence on perceptual decisions. J Vis, 14(7): 9.
See Copyright notice below
This module defines the basic functionality... |
0117028bf9672ee9ecb275097cebae414c90b4539e67e9147712c4ce4763ae04 | Python | 13,878 | 453 | # --- 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 ErrorX(_BaseTraceHierarchyType):
_parent_path_str = "bar"
_path_str = "ba... |
47314dd1dc252324a6881506fbd1087383cdfa407ee4e99acd51e8f4f3987d6d | Python | 13,879 | 314 | '''
Load K-folding models from groups and evaluate performance
author : obanmarcos
'''
import os
import os, sys
from config import *
sys.path.append(where_am_i())
import lightning as pl
import argparse
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from utilities import dataloading_utilities... |
063b87141448b026876171d6592dba3a8591470a2d4804f7da81eb3b4d45619c | Python | 13,880 | 405 | #!/usr/bin/env python
# coding: utf8
import numpy as np
import copy,sys
import pdb
__doc__ = """
This code was adapted from Fründ, Wichmann, Macke (2014): Quantifying the effect of inter-trial dependence on perceptual decisions. J Vis, 14(7): 9.
See Copyright notice below
This module defines the basic functionality... |
29116bee476265504dd38eb9806eeeb38e9831b632afedb66ad625d3fcadf6bf | Python | 13,880 | 395 | from collections import OrderedDict
from plotly import exceptions, optional_imports
from plotly.graph_objs import graph_objs
# Optional imports, may be None for users that only use our core functionality.
np = optional_imports.get_module("numpy")
scp = optional_imports.get_module("scipy")
sch = optional_imports.get_m... |
261140fa88bfeb7249e17fe6f555e3476cd179eff191b3639bdba134e137f244 | Python | 13,883 | 392 | #!/usr/bin/env python
import argparse
import os
import sys
from pathlib import Path
import pandas as pd
def read_data(data_input, index=False):
"""Load CSV or TSV data file."""
try:
file_ext = Path(data_input).suffix.lower()
sep = "," if file_ext == ".csv" else "\t"
index_col = 0 if ... |
d28ccd6d88172faa2c61034d6cfef99a17581f0ea31d927581e6199275977710 | Python | 13,884 | 353 | import torch
import torch.nn as nn
import torch.nn.functional as F
from utils import create_var, index_select_ND,mol2graph,atom_if_sca
from scipy.stats import multivariate_normal # 生成多维概率分布的方法
import numpy as np
ELEM_LIST = ['C', 'N', 'O', 'S', 'F', 'Si', 'P', 'Cl', 'Br', 'Mg', 'Na', 'Ca', 'Fe', 'Al', 'I', 'B', 'K', ... |
e032e3935ab9c00406b74ee87f9aacf01539a1aaae52d478e6f8045ced62eb50 | Python | 13,884 | 355 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import itertools
from glob import glob
from math import ceil
from pathlib import Path
from typing import Any
import cv2
import numpy as np
from PIL import Image
from ultralytics.data.utils import exif_size, img2la... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.