sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
d635d9680b70e3781b12942545e4b0b63ddd8ee8a65eb963a8049a7760742f3b | Python | 6,156 | 211 | import os
import imantics as im
from PIL import Image, ImageFile
from mongoengine import *
from .events import Event, SessionEvent
from .datasets import DatasetModel
from .annotations import AnnotationModel
ImageFile.LOAD_TRUNCATED_IMAGES = True
class ImageModel(DynamicDocument):
COCO_PROPERTIES = ["id", "w... |
cddf49a119316785aca7e2653d25ebc37a436fda7655a43b7f634040e6dd92e2 | Python | 6,157 | 155 | import torch
import torch.nn as nn
from protein_mpnn_utils import ProteinMPNN, tied_featurize
from model_utils import featurize
import os
HIDDEN_DIM = 128
EMBED_DIM = 128
VOCAB_DIM = 21
ALPHABET = 'ACDEFGHIKLMNPQRSTVWYX'
MLP = True
SUBTRACT_MUT = True
def get_protein_mpnn(cfg, version='v_48_020.pt'):
"""Loadin... |
0137956db0e9f749e886a07b56df6cad33f7847dddf936acca453cd9f3be8adc | Python | 6,158 | 159 | import os
from fnmatch import fnmatch
import fs
import fs.errors
from galaxy.exceptions import (
AuthenticationRequired,
MessageException,
)
from galaxy.files.models import (
AnyRemoteEntry,
BaseFileSourceConfiguration,
BaseFileSourceTemplateConfiguration,
FilesSourceRuntimeContext,
)
from gal... |
69053a37990c217e2bc175fd95db0fda491b99b998728069d4ce51d0c9b77742 | Python | 6,158 | 155 | from abc import ABC, abstractmethod
from typing import Optional
from torch import Tensor
from torch.nn import Module, Parameter
from lightly.models import utils
class MaskedVisionTransformerDecoder(ABC, Module):
"""Abstract base class for Masked Vision Transformer decoders.
Defines the interface for a Mask... |
db65041c6991d300d5158b7c70d8dc9a4e033342c4f4a1c520e5afe5a073a38c | Python | 6,158 | 216 | #!/usr/bin/env python3
import argparse
import hashlib
import json
import os
import subprocess
import time
import zipfile
from datetime import datetime, timezone
DEFAULT_SOURCE_URL = "https://github.com/BYVoid/OpenCC"
MANIFEST_NAME = "opencc-resource-manifest.json"
def parse_args():
parser = argparse.ArgumentPa... |
e13ae49b6885217d6936d9203567aad1b6cb2f1229979d6d1ae77b836f3d1344 | Python | 6,160 | 181 | from typing import Dict, Callable, List
import torch
import torch.nn as nn
from torch import Tensor
from torchvision.ops.misc import ConvNormActivation
from models.mn.utils import make_divisible, cnn_out_size
class ConcurrentSEBlock(torch.nn.Module):
def __init__(
self,
c_dim: int,
f_dim:... |
6ccb037a29e203cb418bb3f11e744aad855ea728070bb30189f24652bb0b977d | Python | 6,161 | 184 | """
Hugging Face Hub file source plugin using fsspec.
"""
import logging
from typing import (
Annotated,
Literal,
)
from fsspec import AbstractFileSystem
from pydantic import Field
from galaxy.files.models import (
AnyRemoteEntry,
FilesSourceRuntimeContext,
RemoteDirectory,
RemoteFileHash,
... |
8cd0fc123c837866aedd66da421b53eda8186d8a2f0502a1b3dff8386562b6cd | Python | 6,161 | 225 | """
Rotatable surface objects for the 2D robot simulation.
Provides the rotatable surface primitive, its triangular specialization used to
draw the robots, and the light source the light sensors respond to.
"""
from __future__ import annotations
from typing import Any, Tuple
import math
from ... import util
from .. ... |
0ef9859053c5f362383c974011927dcfd30da6d2a47a600e594a108d2e7fe5b6 | Python | 6,162 | 177 | import math
from typing import List, Optional, Tuple
import torch
import torch.nn as nn
from torch import Tensor
from torch.nn import Linear, Module, Parameter
from torchvision.models.vision_transformer import VisionTransformer
from lightly.models import utils
from lightly.models.modules.masked_vision_transformer imp... |
a77b09895f509069cffbe17c44d8c90aece3c538496e5a1db3adfcd8787e20bc | Python | 6,162 | 152 | import sys, collections, itertools, os.path, optparse
optParser = optparse.OptionParser(
usage = "python %prog [options] <in.gtf> <out.gff>",
description=
"Script to prepare annotation for DEXSeq." +
"This script takes an annotation file in Ensembl GTF format" +
"and outputs a 'flatten... |
fdff67b0bcbd9b30ffaa8723a4aeb7da59e6f376dcdf79ad5ad013e982f0a922 | Python | 6,162 | 157 | #!/usr/bin/env python3
import gc
import numpy as np
import tensorflow as tf
from tensorflow import keras # use tf.keras
from tensorflow.keras.layers import (GRU, LSTM, Activation, BatchNormalization,
Bidirectional, Dense, Dropout, Flatten,
Inp... |
4f4375c388304eb003795b85d6d8620306e5b5e346942fa2f730fab7863adbc0 | Python | 6,164 | 210 | '''View data as images'''
import matplotlib.pyplot as plt
import io
import base64
import numpy as np
import multiprocessing as mp
def tobase64(fig):
buf = io.BytesIO()
fig.savefig(buf, format='png', bbox_inches='tight')
buf.seek(0)
return base64.b64encode(buf.read()).decode()
def mp_wrap(f, *args):
... |
a1306a5d29cdd543f6185ee71017b007162afbb80a11ddb20e8a34db4e2734f1 | Python | 6,166 | 176 | """Distributed Task Queue."""
# :copyright: (c) 2017-2026 Asif Saif Uddin, celery core and individual
# contributors, All rights reserved.
# :copyright: (c) 2015-2016 Ask Solem. All rights reserved.
# :copyright: (c) 2012-2014 GoPivotal, Inc., All rights reserved.
# :copyright: (c) 2009 - 2012 Ask Sole... |
59156213a8bd3028d44784f6ffc5ca83480c7fead5f364decae5851898fbf644 | Python | 6,167 | 195 | """Behavior-parity tests for metadata invariant backend dispatch."""
from __future__ import annotations
from types import SimpleNamespace
from typing import Any
import pytest
from torchlens.validation import invariants
# The pre-refactor sequences below are the dispatch-parity baseline. cert10
# ADDED three checks... |
cf78690d7952f3b5e30d1a10ba547be0ed35b7de9f5d0606aef1b92fbbb4c3e0 | Python | 6,168 | 223 | # 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... |
58b30924bb320c9d492ca89449e8f153136fe698c77c21f14c1c250312156b54 | Python | 6,169 | 168 | """Test cases for evaluation scripts."""
import os
import unittest
import numpy as np
from scalabel.common.typing import NDArrayF64
from scalabel.label.coco_typing import PanopticCatType
from bdd100k.common.utils import list_files
from bdd100k.eval.pan_seg import PQStat, evaluate_pan_seg, pq_per_image
class TestPQS... |
32e029ea7a7d9d1318b94286239326953517f4395903e382d28f324d5aac0857 | Python | 6,173 | 172 | from __future__ import annotations
from typing import Any
import holoviews as hv
import numpy as np
import panel as pn
from panel.template import DarkTheme
pn.extension()
from larvaworld.lib import reg, screen, sim, util
__all__: list[str] = [
"ExperimentViewer",
"experiment_viewer_app",
]
w, h = 800, 500... |
e93350fbf5b6026b6cf919fe89e2ed265e17bd98fec6da73f235d935a6b669c8 | Python | 6,173 | 101 | from setuptools import setup
setup(
name='MoleculeACE',
version='3.0.0',
packages=['MoleculeACE','MoleculeACE.benchmark',
'MoleculeACE.benchmark.data_fetching',
'MoleculeACE.models',
'MoleculeACE.Data',
... |
0b16d80cd2f78c29069e6e8959b9d9d68f1e89b46b3108cea2135e602b729254 | Python | 6,174 | 170 | '''
K-Folding script
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 as dlutils
from utilities.folders import *
... |
48b347d68da2d7e95b50838f5172cc5eeeb313b50b1e5b37509508853bf0708c | Python | 6,175 | 161 | from typing import List, Tuple
from pytorch_lightning import LightningModule
from timm.models.vision_transformer import vit_base_patch16_224
from torch import Tensor
from torch.nn import Linear, MSELoss
from torch.optim import AdamW
from lightly.models import utils
from lightly.models.modules import (
MaskedVisio... |
0aafb2c67fa6b51abd3089c84c838abad45bbc193f550e5d9b28f63e4cfbbffa | Python | 6,176 | 165 | # SOURCE: vendored from Huage001/PaintTransformer @ main (inference/network.py, class Painter)
"""Paint Transformer (ICCV 2021) -- feed-forward neural painting via stroke-set prediction.
Paint Transformer casts stroke-based image "painting" as a set-prediction problem: given
the current canvas and target image, a tran... |
b620c942ea46c3b4e63a9fd5bbb7b62a88600d634c38fb1317153b2bf4ae2ff9 | Python | 6,176 | 172 | import argparse
import logging
import time
import warnings
import sys
import contextlib
import os
import joblib
from tqdm import tqdm
from pqdm.processes import pqdm
from sklearn.model_selection import train_test_split
from skopt import BayesSearchCV
from skopt.callbacks import DeltaYStopper
import utils
import pmsurv_... |
32652f65ee2ad091b90012e0cee5ad062b69839a8f4d23256568e4cbf8c6da51 | Python | 6,177 | 124 | import os, sys, argparse
import numpy as np
from scipy import stats
from scipy.signal import butter, filtfilt, welch
import matplotlib; matplotlib.use("Agg")
import matplotlib.pyplot as plt
ROOT = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, ROOT); sys.path.insert(0, os.path.join(ROOT, "src"))
from da... |
57c747755f3ea3e50cb07f9ba73b6950c27be8b676692e781cb6c40d53dc7394 | Python | 6,177 | 170 | import os
import shutil
import tempfile
import unittest
from collections import defaultdict
from unittest.mock import patch
from cellxgene_gateway.filecrawl import (
render_item,
render_item_source,
render_item_tree,
)
from cellxgene_gateway.items.file.fileitem import FileItem
from cellxgene_gateway.items.... |
27e7ac4e4404efbb28145b12e96e9625e32ab9d00fa5048dbaba98fcf0a26b27 | Python | 6,178 | 150 | import copy
from typing import List, Tuple
import torch
from pytorch_lightning import LightningModule
from torch import Tensor
from torch.nn import Identity
from torchvision.models import resnet50
from lightly.loss import NegativeCosineSimilarity
from lightly.models.modules import BYOLPredictionHead, BYOLProjectionHe... |
28947d8359a27afe3360147d93752c83f05dfd6606fbf382c4262258dd853acf | Python | 6,179 | 203 | """Shared check functions for pyriemann.geometry.
This module contains validation, type-check, and decorator utilities used by
``pyriemann.geometry`` submodules. It has no internal pyriemann dependencies,
making it a safe leaf in the import graph.
"""
import array_api_compat.numpy as _xpnp
from array_api_compat import... |
7f7925d244f6ddc8ff184d72c8b9f5df3cc5e554154c62a0d30136bfd7374e3d | Python | 6,180 | 184 | """Unit contract for the M5 Op row store (torchlens/_trace_core/op_store.py)."""
import pytest
from torchlens._trace_core import op_store
from torchlens._trace_core.op_store import (
_MISSING,
DetachedOpStore,
OpRowStore,
OpStoreLayout,
)
LAYOUT = OpStoreLayout(("alpha", "beta", "gamma", "delta"))
... |
834fe44868c842069a0eb1de03a5065a21b56076ae9b031109752b3f50ee9945 | Python | 6,180 | 164 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
def extract_mapping_info(input_mapping_filepath):
mapping_info = {}
categories = set([])
with open(input_mapping_filepath, 'r') as mapping_file:
for line in mapping_file.readlines():
split_line = line[:-1].split('\t')
... |
bcf2e36897e98a87729933d6e50247ee511044bca2b17cc6bd0f692e0068bb31 | Python | 6,180 | 172 | """Red-capable gates for security and runnable wire-format single sources."""
from __future__ import annotations
from collections.abc import Sequence
from typing import Any
import pytest
def authority_drift(values: Sequence[Any], *, require_identity: bool) -> tuple[int, ...]:
"""Return indexes whose value dive... |
8d7e2a97e81e6f0dc35a36b312d45e16ff129cdd0a6c6fca8baddcd34c91cfe5 | Python | 6,181 | 185 | import gzip
import pickle
import random
import warnings
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import KFold
from sklearn.preprocessing import MinMaxScaler
import os
import keras
import tensorflow as tf
from keras.models import Model
from keras.callbacks import EarlyStopping, Mod... |
cbfecddaf4fee687c268fccd5061c5f9d24d87fe630c0bd2656abeb235355dca | Python | 6,181 | 155 | import pickle
def run():
from spitfire import (odesolve,
BackwardEulerS1P1Q1,
KennedyCarpenterS6P4Q3,
KvaernoS4P3Q2,
KennedyCarpenterS4P3Q2,
KennedyCarpenterS8P5Q4, )
from spitfire... |
28c92fcd7972143b018e0d82d479946de24fb583b2403c9c3fe9bfbd66db8a52 | Python | 6,182 | 239 | # Copyright 2022 Mayo Clinic. 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 applicable law or ... |
3eb4eb27c1cecd93b035ad6617d6dd92b1a987d04c40b730769d3aedafb843ef | Python | 6,183 | 199 | import os
import tempfile
import numpy as np
import re
import h5py
import tqdm.auto as tqdm
from modular_splicing.data_pipeline.grab_sequence import grab_sequence
def create_datafile(
*,
data_segment_to_use,
data_chunk_to_use,
sequence_path,
splice_table_path,
CL_max,
outfile,
include... |
b488629a5849ee4db904fc1a53c56eec83e5d56f37fe5439fc579ad18e8dc119 | Python | 6,183 | 191 | ### Small lib to create synthetic data.
### Look at random_spikes() and synth_movie()
import itertools as itt
import numpy as np
from numpy import pi, cos, sin, tan
def spike(x, location, a, tau, rise=20):
"a single spike"
coef = 0.5 * a * (1 + np.tanh(rise * (x-location) / tau))
return coef * np.exp(- ab... |
f5ed63f0b638a7a2fe38f768f7dd9ee5e063d50c20a493889a20dce46c92ef1c | Python | 6,183 | 178 | """The pair-coverage auditor (compo memo stratum 4; F36 waves A-D).
Enforcement authority over the declared witnessed rows: it computes covered
(product, verb) axis pairs from the M1 and edit matrices, and every
uncovered VALID pair fails until a human writes a witnessed cell or
registers an exclusion routed to N/A-or... |
fd5f1966b241c1a772aa003a9c7761c1efb49b73c4cf6b10be8c2f2a988b9d3a | Python | 6,184 | 197 | # 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... |
17c4269d3a0227f9ea31f55a1b8f8987b3a5cb880dd765bc989fe2db12c566df | Python | 6,185 | 157 | # CMNIST-OSCN multi-modal model specification
import os
from numpy import sqrt, prod
import torch
import torch.distributions as dist
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torchnet.dataset import TensorDataset, ResampleDataset
from torchvision.utils import sa... |
59c6bf8a369953a8047123ac1887e69d2d23bb0643c40287fa8770b0ce3a218b | Python | 6,185 | 157 | # -*- coding: utf-8 -*-
import torch
from torch import nn
class MultiLayerPerceptron(nn.Module):
"""Multi-Layer Perceptron with residual links."""
def __init__(self, input_dim, hidden_dim) -> None:
super().__init__()
self.fc1 = nn.Conv2d(in_channels=input_dim, out_channels=hidden... |
ad407ef7312d898a952269820ef4edd22b19fad428e142b3c5e4a22ff79b0163 | Python | 6,185 | 166 | # SPDX-License-Identifier: LGPL-2.1-or-later
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import os
from configparser import ConfigParser, NoSectionError
import glob
import sys
import time
import calendar
import numpy as np
import matplotlib as mpl
if os.environ.get('DISPLAY', '') == '':
print('no display found. Us... |
4a3a3866c0dd3cbaf07cb4ac55f35df4f0e0fe53de95534bc9866be05855744f | Python | 6,186 | 170 | #!/usr/bin/env python3
"""
File: repication.py
Created: 2021/06/04
Last Changed: 2021/07/07
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.
... |
4115fe9e816016e0627d081acca5014c74589ee4ffedbadbaa8da083568bf03e | Python | 6,189 | 234 | """Base functions for SPD/HPD matrices."""
import numpy as np
from numpy.core.numerictypes import typecodes
from .test import is_pos_def
def _matrix_operator(C, operator):
"""Matrix function."""
if not isinstance(C, np.ndarray) or C.ndim < 2:
raise ValueError("Input must be at least a 2D ndarray")
... |
a1b7bca1a8b4e90033e49230cbac364c9279c6329378976391839c19e6149029 | Python | 6,189 | 180 | # Copyright 2025 Google.
#
# 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 writing, soft... |
4b17367513277bb679a35162b5ff83fcd2891232026a1ca612a18b1848dc7663 | Python | 6,191 | 191 | """Regenerate the committed encoding/label-suppression reference renders.
Mirrors ``render_collapse_reference.py``: every image under
``docs/images/encoding`` referenced from ``docs/reference/encoding.md`` is
produced by THIS script, so the gallery is regenerable and reviewable
in-repo.
Usage::
python scripts/re... |
9f467c0aa1e1f44b0ccfb3c0170a873af1043bea7342c733f4ed61b3b5d8eae5 | Python | 6,191 | 191 | # -*- coding: utf-8 -*-
REVERSE_PREFERENCE_PREFIX = '# @reverse-prefer:'
class BaseDict:
def _iter(self, file):
with open(file, 'r', encoding='utf-8') as fh:
yield from fh
def iter(self, file):
for i, line in enumerate(self._iter(file)):
if line.startswith('#') or not ... |
9bc558e47cb10b8137db3150ea41acd764c15f109d5aaf2206bcdcc4fc9b889d | Python | 6,194 | 150 | # -*- coding: utf-8 -*-
import sys
import os
sys.path.append('./src/')
import torch
import random
from src.reinforcement_pean import PolicyGradient
from utils import read_sequence_file
from data import GeneratorData, DiscriminatorData
from src.discriminator import Discriminator
import src.generator_transformer as Gene... |
d83b3c01e39581b9dfaabf1478eba8d679affb4fda786a01a2af48d59d329cdc | Python | 6,194 | 163 | """Plots for periodic fits and parameters."""
from itertools import cycle
import numpy as np
from specparam.sim import gen_freqs
from specparam.modutils.dependencies import safe_import, check_dependency
from specparam.modes.modes import check_mode_definition
from specparam.plts.settings import ITERABLES, PLT_FIGSIZE... |
8dedbf18d7c7f841faebd8d30f69ee0d79a0cb517dd037dd6d312ca68befdf7e | Python | 6,197 | 209 | import numpy as np
import keras
from keras import backend as kb
import tensorflow as tf
def _get_spatial_ndim(x):
return keras.backend.ndim(x) - 2
def _get_num_channels(x):
return keras.backend.int_shape(x)[-1]
def _conv(x, num_filters, kernel_size, padding='same', **kwargs):
n = _get_spatial_ndim(x)
... |
e534984ba391322e1d78929fc9a807162bbc89d13ad958d440707724448a950f | Python | 6,197 | 163 | """Regression tests for r18d report hardening (report/_explain.py, report/_profile.py).
Each test fixes a defect that only surfaces off the plain feed-forward happy path.
Class theme: aggregate multi-pass ``Layer`` handling + ``getattr``-default field drift.
"""
from __future__ import annotations
import torch
import... |
360ab0c1ff0595a5374f48995e3f9682baa25c1f0daafbf113f7dc8bf5f5c955 | Python | 6,198 | 170 | '''
K-Folding script
author: obanmarcos
'''
import os
import os, sys
from config import *
sys.path.append(where_am_i())
import pytorch_lightning as pl
import argparse
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from utilities import dataloading_utilities as dlutils
from utilities.folders i... |
6cf5db26be7d89144d5c30110c49959b6db6e82a02c15970bde4396f25a813c2 | Python | 6,200 | 184 | """The identity-partition invariant suite (A1, accuracy pyramid top).
Lane A07 (2026-08-27). Spec: the summary design memo 3.1: every
parameter identity, executed op event, and tracked tensor identity is owned by
exactly ONE accounting row. Alias (input/output) rows display but own nothing
-- input rows own only the e... |
a741b4a42d526f0f327c8b4f73b33bdeb08fbb2eaba6a9501411d7bf7c00b215 | Python | 6,200 | 172 | from prodict import Prodict
from args import args
import sys
sys.path.extend(["src", "../TDNODE"])
from src.model import model_dict
from data.data_prepare import prepare_TGI
from data.data_split import split_datasets
from analysis.loss_curve import plot_loss_curves
import json
import numpy as np
import torch
import ... |
6619a624c71015b0bcf4eb300c7ab95c58047486e1456974e9c6d374a30c71a4 | Python | 6,201 | 156 | #==========================================================================
#
# Copyright NumFOCUS
#
# 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/l... |
77bf930126607382d3a90fe8164f32c572f79bfdc2b3acb148eb227f79bba4bc | Python | 6,201 | 186 | """F10 lovely item 6: value-record line/card grammar laws.
repr = ONE envelope+core line; str = bounded card whose FIRST line is the
repr (D15); multi-pass never pools (D32); honesty tokens are never
laundered; repr never raises and never copies payloads (voice rule 10).
"""
from __future__ import annotations
import... |
6fd9879ec4fdccf6040f1f931cb753c3c690d98d4ca5885a304ed5ed9569c60f | Python | 6,203 | 151 | #!/usr/bin/env python3
"""Dx W verification: full perm + bootstrap on the HC-covariance-whitened
configuration that just produced LOO 0.922 / LOCO 0.791."""
from __future__ import annotations
import os, sys, json, time
import numpy as np
from collections import Counter
HERE = os.path.dirname(os.path.abspath(__file__))... |
11d17f11e794bd6a233726ab178fd0764f6b7e363ff7841f64b00df335382809 | Python | 6,204 | 170 | """
BASIL GUI for Oxford ASL - Preview widgets
Copyright (C) 2020 University of Oxford
"""
import os
import shutil
import tempfile
import numpy as np
import nibabel as nib
import wx
import matplotlib
matplotlib.use('WXAgg')
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplot... |
645e5b566d4c69fe1156b6be083f4c88c3530eb07a2cd31fcf617f64582789fd | Python | 6,204 | 158 | """grind-r5 R22: fail-open swallows sealed (b7 fable/opus/sol + b1 opus).
Four sites shared one shape -- an exception swallowed into a value that then
participated in an equality key, a provenance fact, a budget charge, or a
lost-forever warning:
* the capture-fingerprint ndarray branch fell through to a STABLE
con... |
453b38e50860b23ffc3d6edd68f0a4f2df9edf965d53b0840651307a88deb3de | Python | 6,206 | 214 | '''Read data from files on server'''
import numpy as np
import pickle
import pandas as pd
import sys
from pathlib import Path
import re
from operator import itemgetter
import math
def d_from_vec(fc):
n = fc.size
return int(round((1+(1+8*n)**0.5)/2))
def vec2mat(fc, fillones=True):
d = d_from_vec(fc)
... |
ebb342474406d945157a65d0b135b6b6a6a1df9b1663cf6f2688c104f3d72ccb | Python | 6,206 | 200 | import numpy as np
import torch
# ============================================================
def get_pair_dist(a, b):
"""calculate pair distances between two sets of points
Parameters
----------
a,b : pytorch tensors of shape [batch,nres,3]
store Cartesian coordinates of two sets of at... |
2a9444dbc60373ed4d0f4536841d00e687e9e915ce2c5a90655a4a00f363efc0 | Python | 6,208 | 162 | from typing import List, Union
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
def add_chain_to_token_offset_legend(ax, chain_idx_map, add_dividing_line=True, verbose=True):
"""Add the chain offset(token offset) legend to the figure.
Args:
ax: ma... |
8c578c376378ff51be13d01ea3b4d8709db98b609681d809a64a29e5a9b4e37e | Python | 6,208 | 192 | """
Preprocess data coming from Adaptive immunoSEQ.
Reference:
https://clients.adaptivebiotech.com/assets/downloads/immunoSEQ_AnalyzerManual.pdf
"""
import click
import collections
import numpy as np
import pandas as pd
import random
from vampire import gene_name_conversion as conversion
# Sometimes Adaptive uses o... |
c8f4c69c55d76fe16449056f687518f867fcabd88107292a913d44576fd97b9d | Python | 6,208 | 178 | #!/usr/bin/env python
# emotiv.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 versio... |
d7c447a3f9509f1d7a4699baa1459329d9b9c2d9c77b5c79718fa61a964913a6 | Python | 6,209 | 148 | """01. Load web datasets with GluonCV Auto Module
=================================================
This tutorial introduces the basic dataset preprocesses that can be used to
download and load arbitrary custom dataset as long as they follow certain
supported data formats.
The current version supports loading dataset... |
e3193d4782dfc6079ca07b37cd3acf67de3664779897f82bffaf684a0008063d | Python | 6,214 | 183 | # --- 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 Camera(_BaseLayoutHierarchyType):
_parent_path_str = "layout.scene"
_pa... |
a7d18a665bd91f4853051c75d0a798261c4ff5c92b89ed15a7589469ca06317b | Python | 6,217 | 239 | '''
Created on Feb 6, 2012
String distances from the AsjpDist-full program
@author: rarakar
Changed the defaultdict implementation to collections
Implemented the
'''
#import nltk
from collections import defaultdict
import itertools as it
UNNORM = True
def ldn(a,b):
m=[];la=len(a)+1;lb=len(b)+1
for i in range(0,la):... |
a84e14f2354bc95f58c9e34b4845ef6ed9b82fd47d508b39f5715fa57f03da3a | Python | 6,217 | 149 | import cv2
import numpy as np
import torch
from .utils import _add_batch_one, IG_baseline, interpolation, isotropic_gaussian_kernel
def attribution_objective(attr_func, h, w, window=16):
def calculate_objective(image):
return attr_func(image, h, w, window=window)
return calculate_objective
def sal... |
c0c094e2b00b8c8500d9c79749adcf7a60667ddbd7e5d9e7fad29469ca915aa1 | Python | 6,217 | 188 | ## for any dataset with image data
from __future__ import print_function, division
import subprocess
import os
import os.path
import sys
import time
import random
import sys
import numpy as np
from matplotlib import pyplot as plt
import cv2
from input_parameters import *
if dataset_name == "FreeCAD_lib" and compres... |
1485150952ec0c142fd6185447ca2857d1ac1fb45981f78c1b453cac7f40aeb3 | Python | 6,219 | 177 | """Keys and certificates for tests (KEY1 is a private key of CERT1, etc.)
Generated with:
.. code-block:: console
$ openssl genrsa -des3 -passout pass:test -out key1.key 1024
$ openssl req -new -key key1.key -out key1.csr -passin pass:test
$ cp key1.key key1.key.org
$ openssl rsa -in key1.key.org -ou... |
175238304c05f31f0834a5fc5ffe074eecd9d57872101d94e200daf418833b6c | Python | 6,219 | 145 | # plot performance of CPU based cross-correlations
# using emalign test data
import dill
import os
import sys
import time
import resource
import perfplot
import logging
import scipy
#import pyfftw
#import mkl_fft
from pyfftw.interfaces import scipy_fft as pyfftw_backend
from mkl_fft import _scipy_fft_backend as mkl_b... |
68cf7700805751f0d0785a2af08fda11ad0bd590a4b62f15cde1e53be32233a8 | Python | 6,220 | 152 | #!/usr/bin/env python
"""Data reading and writing utilities for distributed learning."""
import os
import random
import re
from functools import partial
from typing import Union, Tuple, List
import numpy as np
import tensorflow as tf
from angorapy.common.const import STORAGE_DIR
from angorapy.common.senses import Sen... |
a20e05248d99b248e404ff25809afdb63960b5b6232803770aea5f96e5f78be3 | Python | 6,220 | 187 | """
Unit tests for tracking algorithms.
This module contains tests for the various tracking algorithms
used in the Ethoscope system.
"""
from unittest.mock import MagicMock, Mock, patch
import numpy as np
import pytest
# Note: Actual imports would need to be adjusted based on the real module structure
# from ethosc... |
efb67134e4f5b6e82b2815d84c0201a9429636ebeddeda5c522c3f3006c2efb0 | Python | 6,222 | 170 | import torch
import torch.nn as nn
from collections import OrderedDict
from torchinfo import summary
import numpy as np
def Conv2D(
in_channels: int, out_channels: int,
kernel_size: int, stride: int, padding: int,
is_seperable: bool = False, has_relu: bool = False,
has_sigmo... |
204e3cbb6ab814d3c803963ecafb59022a2155bdd0b7c4c0d28084813468cb17 | Python | 6,223 | 212 | """
Functions for input and output, and some statistics.
"""
import os.path as op
import json
import pickle
import numpy as np
def save_json_from_numpy(filename, folder, var):
"""
Save numpy array as json file
:param str filename: the name of the saved file
:param str folder: the name of the folder t... |
f6022bf116eb2c7e612f6a41a59b2ed89287566d2640c0395fb4f9252a7ed048 | Python | 6,224 | 161 | import os
import pickle
import re
import pandas as pd
def save_icd9_diagnosis_procedures(data_dir: str):
"""
get icd9 diagnosis/procedure codes and descriptions and
dump to pkl file
Args:
data_dir (str): directory that contains xlsx files
Returns
None
"""
if not os.path.e... |
1038ecfdaf2cf01910dfabb98750672dd0e1066e9fa09eed2db881e4c9fa157c | Python | 6,225 | 183 | #!/usr/bin/env python
# coding: utf-8
# position_decoder.ipynb
#
# Script to create a position decoder using multinomial logistic regression
#
# MGC 7/15/2019
# FKM 7/31/2019
# In[171]:
# packages
import sys,os
#import pandas
import math
import glob
import pickle
from scipy import io
import numpy as np
from numpy... |
161912bfb1afbf52c15d9bdf2aab0f32ec58f1805118876ea206d20d9b68d9c6 | Python | 6,226 | 157 | """
Computes and saves molecular features for a dataset.
"""
import os
import shutil
import sys
from argparse import ArgumentParser, Namespace
from multiprocessing import Pool
from typing import List, Tuple
from tqdm import tqdm
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
from Batma... |
338e6e02b728074eae4967274a859462def948735f05df382e0bf171cc5230c7 | Python | 6,227 | 155 | """Round-49 hon1_1 immunizer -- empty ``multiprocessing.Queue`` no longer over-triggers.
r47 added a narrowing so a non-mutatingly PROVABLY-EMPTY opaque queue (`SimpleQueue` / `mp.Queue`)
held by a deterministic model stays VERIFIED. It held for `queue.SimpleQueue` (clock-free `.empty()`)
but was DEFEATED for `multipr... |
8ebc47c9fa2cc91023f43a5132235e9cb80c141023714c38b6e4a811ca9fb880 | Python | 6,228 | 152 | """r7 R84 (opus b10 MED): unit coverage for the load-bearing artifact normalizer.
``scripts/normalize_sdist.py`` decides the published bytes of BOTH release
artifacts, yet its only exercise anywhere was the nightly double-build gate
(two full builds, never on PRs): deleting the ``dist/*.whl`` argument or
regressing ``... |
57e39a298abc3192b11f7aed261472a831d10263b7837debff3ba3818b2cfa03 | Python | 6,230 | 217 | #==========================================================================
#
# Copyright NumFOCUS
#
# 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/l... |
d0f0735ede106f4563157939ce0564d78196f0b38a5b3ef8e55dae5c36e7e1cd | Python | 6,232 | 128 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
151d4d338c4a5f3ee4ba84e723cc8f0d47c2404e8fe2e6089ac3ea1a4735f85b | Python | 6,234 | 208 | """
https://plot.ly/python/
Plotly's Python API allows users to programmatically access Plotly's
server resources.
This package is organized as follows:
Subpackages:
- plotly: all functionality that requires access to Plotly's servers
- graph_objs: objects for designing figures and visualizing data
- matplotlylib... |
c17104849775a2f071e10ca62e23b85d36a3869f3404278ffb02094f828a8df2 | Python | 6,234 | 208 | #!/usr/bin/python3
#-*-coding:utf-8-*-
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance w... |
8bd2c40f05f0bceb81c0ccd35049921d0ecae358e6583fea57b2082d938f0320 | Python | 6,238 | 214 | '''Read data from files on server'''
import numpy as np
import pickle
import pandas as pd
import sys
from pathlib import Path
import re
from operator import itemgetter
import math
def d_from_vec(fc):
n = fc.size
return int(round((1+(1+8*n)**0.5)/2))
def vec2mat(fc, fillones=True):
d = d_from_vec(fc)
... |
99886ccd0676447b7030af2d49a0d757bd9f2be471e7a134c6511ee33a41b42c | Python | 6,238 | 239 | # coding: utf-8
import pytest
from . import utils
import rpy2.rinterface as rinterface
rinterface.initr()
def _just_pass(x):
pass
@pytest.fixture(scope='module')
def silent_console_print():
with utils.obj_in_module(rinterface.callbacks,
'consolewrite_print', _just_pass):
... |
b5b87e062dfb4f919bc2b44bcdd4d4d81008bcaf0014f051063430d449c0e295 | Python | 6,238 | 180 | #################################################################################################################################################################
####################### Testing MRB ########################################################################################################################
#... |
390832027f5da09356b3998f9c02ee50f705828370cdf9340ce3e025ff53f845 | Python | 6,240 | 142 | import os
import shutil
import pandas as pd
from collections import Counter
def generate_input_files(data_type, df, sample_size=30, min_sample_size=1, root ='categorized_data/'):
"""
Generate input files for DEG analysis based on the given data.
Paremeters
data_type
Type of data ('Ima... |
793b168c0e887d641ce5c2e439ff17947eabd920c930e2e8340421579bcb8fda | Python | 6,240 | 155 | #!/usr/bin/env python
import sys, collections, itertools, os.path, optparse
optParser = optparse.OptionParser(
usage = "python %prog [options] <in.gtf> <out.gff>",
description=
"Script to prepare annotation for DEXSeq." +
"This script takes an annotation file in Ensembl GTF format" +
... |
574de0978846b4c59d47826997a44a9ec1c7c66c4c8f3b5452825aec706f82d9 | Python | 6,242 | 238 | import os
from tqdm.auto import tqdm
import RNAutils
import numpy as np
def human_format(num):
num = float("{:.3g}".format(num))
magnitude = 0
while abs(num) >= 1000:
magnitude += 1
num /= 1000.0
return "{}{}".format(
"{:f}".format(num).rstrip("0").rstrip("."), ["", "K", "M", "... |
92741f424bd699f6959b2f6ddced3bc0f56313ce6fe2bc2b10cacfbad6424b1b | Python | 6,243 | 184 | #!/usr/bin/env python3
import re
import datetime
import numpy as np
from itertools import groupby
from skimage import measure
from PIL import Image
from pycocotools import mask
import json
import os
from skimage.color import rgb2gray, gray2rgb
from skimage.io import imread, imshow, imsave
import cv2
INFO = {
'des... |
3bea5ecd2a9b957066c805a374f65cefe9c2149abb92ff761343b9d3acfda5b4 | Python | 6,244 | 171 | """Regression tests for the unattributed-tensor-argument witness false positive.
Context
-------
The postprocess "no graph/source provenance" witness
(``torchlens.postprocess._warn_unattributed_tensor_args``, fed by
``torchlens.backends.torch.ops._unattributed_tensor_arg_positions``) exists to
catch capture gaps: tens... |
bd32614956336e3038d28e26034f45a0b3cb7584cc6b96c6118cffe9af4f1040 | Python | 6,244 | 225 | """Generate publishable performance snippets from P6 gate JSON."""
from __future__ import annotations
import argparse
from pathlib import Path
from typing import Any
from benchmarks.perf_gate import load_gate_json
#: Rung names this generator dereferences by literal (D26.4): the render
#: entry asserts each exists ... |
e2ce4539bddf88d441de67c455948e0b6dcd93da3a9e0758a23842d05810ca78 | Python | 6,244 | 158 | #!/usr/bin/env python3
"""Чтение логов. Графики нужны не ради красоты, а как диагностика.
Главный вопрос, на который отвечает эта программа: вышла ли метрика на плато.
Если I(энергия; действие) на конце прогона всё ещё растёт, мы измеряем не
свойство популяции, а длину прогона — и сравнивать условия нельзя.
python ... |
fca3b7051f877e57c60db6c4828d4523a098e2d8ecb407096e68cfc2ccfadd28 | Python | 6,244 | 164 | import numpy as np
from keras.src import backend
from keras.src import constraints
from keras.src import testing
def get_example_array():
np.random.seed(3537)
example_array = np.random.random((100, 100)) * 100.0 - 50.0
example_array[0, 0] = 0.0
return example_array
class ConstraintsTest(testing.Tes... |
09e6f85d4434f0e6db6655e89bf5ff83087273057e9008a3f172546e26ac435a | Python | 6,245 | 205 | import argparse
import torch
from pathlib import Path
import logging
from tqdm import tqdm
from Bio import SeqIO
import numpy as np
import sys
from interpretability.utils import (
set_hook_to_get_attention_map,
get_attentions_map_simple
)
sys.path.append("models_architectures/")
from wrapper_prot_bert_BFD impo... |
e03ccb9de72587bb60acc18e305aa96f77554c5d2e02b5ed910258869c191fcf | Python | 6,246 | 159 | """Regression tests for ``draw(show_orphans=...)`` island rendering."""
from __future__ import annotations
import example_models
import graphviz
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.validation import check_metadata_invariants
from torchlens.validation.invariants impor... |
f65760de15b245c11dc59557963214682b4cdd6c610aa64ed4d25216d5ec896c | Python | 6,246 | 187 | """Multi-Human-Parsing V1 Dataset."""
import os
import numpy as np
from PIL import Image
from PIL import ImageFile
import mxnet as mx
from .segbase import SegmentationDataset
ImageFile.LOAD_TRUNCATED_IMAGES = True
class MHPV1Segmentation(SegmentationDataset):
"""Multi-Human-Parsing V1 Dataset.
Parameters
... |
de4dd4a83df18920e0d608e9950cff223cfbe774254ef4b0b713504aec84ccb0 | Python | 6,247 | 203 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Math utility functions to manipulate coordinates.
"""
# ======================================================... |
481e697d0a84e3402b09fddd23ec767d3ef0eb899f764b4f7bcfc16d19162a28 | Python | 6,250 | 185 | '''
TNS section grower class.
'''
from collections import deque
import numpy as np
from numpy.linalg import norm as vectorial_norm # vectorial_norm used for array of vectors
from tns.morphmath.utils import get_random_point, norm # norm used for single vectors
MEMORY = 5
DISTANCE_MIN = 1e-8
# Memory decreases with ... |
3fd94211cc05041ab87693ea2670a35b9bf95864967419bc59b4d79b129fd849 | Python | 6,251 | 205 | import json
import os
import sys
import time
import pytest
from caper.cromwell import Cromwell, WomtoolValidationFailed
from caper.cromwell_rest_api import CromwellRestAPI
from caper.wdl_parser import WDLParser
from .example_wdl import WRONG_WDL, make_directory_with_wdls
BACKEND_CONF_CONTENTS = """
backend {{
pro... |
660d43cdfb3a67b270426d59b0d6c6a493a3748ff67e312b3046949621a92863 | Python | 6,251 | 155 | #!/usr/bin/env python
import pandas as pd
import sqlite3
from sqlite3 import Error
import os
import sys
import argparse
import time
def read_digested_genome(genome):
cols = ['fchr','fstart','fend','fid']
if genome.endswith('.rmap'):
genome_df = pd.read_csv(genome, sep = "\t", header = None, names=col... |
06748f22c33d692630265fcce3f432138a837065cf820d4075795d93037cbc94 | Python | 6,253 | 188 | from wand.image import Image
import io
import os
import tempfile
import math
from PyPDF2 import PdfFileWriter, PdfFileReader
from mmdet.apis import init_detector, inference_detector, show_result_pyplot
class ExtractTable(object):
"""
Utilizes CascadeTabNet (https://github.com/DevashishPrasad/CascadeTabNet) t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.