sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
a814e87643492aec704e66da87479beab312415cc8b5877baaba8f864f77bde0 | Python | 6,515 | 154 | # Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com)
# Some parts of the code were referenced from or inspired by below
# - Tristan Bepler's code (https://github.com/tbepler/protein-sequence-embedding-iclr2019)
# PLUS
""" P-ELMo model classes and functions """
import torch
import torch.nn as nn
imp... |
1c60eb80df5515cffcbeeab58e7675820d2fcbe06328cc804926c913df8bc165 | Python | 6,517 | 173 | """F03 ledger memo item 4: the provenance join (why / provenance).
Pins the four honesty axes and the wording law: additive phrasing licensed
only when the reference-side suffix is empty; unrelated histories are never
joined by guess; emptiness is disclosure; ordered multiplicity (A vs
A-then-B) stays distinct; the va... |
e784e3cdbaba4b15ceaec5b66d44f1910751a1d4e051fb63258cbd56f4a5d1f3 | Python | 6,517 | 162 | """Regression tests for the linear region build in ``finalize_forward_regions``.
Root cause (SPEEDENING wave 14): the forward region build re-scanned three whole
collections **once per module region** -- a breadth-first sweep of the module
tree (``_region_call_depth``), a full ``render_ir.nodes`` scan for the region's... |
cca349601b212eb543c1805cf2b04c10dd7642cc9558c4860c49405cd7051ca8 | Python | 6,518 | 213 | # Author: aqeelanwar
# Created: 27 April,2020, 10:22 PM
# Email: aqeel.anwar@gatech.edu
import argparse
import dlib
from utils.aux_functions import *
# Command-line input setup
parser = argparse.ArgumentParser(
description="MaskTheFace - Python code to mask faces dataset"
)
parser.add_argument(
"--path",
... |
0304fbe8307c15cb41b3b52a984574a15035a565f1611cf38b587e22494a15db | Python | 6,519 | 127 | import torch
from .base_model import BaseModel
from . import networks
class Pix2PixModel(BaseModel):
""" This class implements the pix2pix model, for learning a mapping from input images to output images given paired data.
The model training requires '--dataset_mode aligned' dataset.
By default, it uses ... |
ffd8f9897be871b99144961d8f29d1144115d7b538fa30ac69278fd2037c5a2a | Python | 6,521 | 198 | #!/usr/bin/env python
#
# ethoclient.py
#
# Copyright 2022 Giorgio F. Gilestro <gg@jenner>
#
# 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 ... |
7af860cbfb6acad020920daf929825159f5aa34486cbd1cfd7af161208085f00 | Python | 6,522 | 182 | """Utility functions for vector environments to share memory between processes."""
import multiprocessing as mp
from collections import OrderedDict
from ctypes import c_bool
from functools import singledispatch
from typing import Union
import numpy as np
from gym.error import CustomSpaceError
from gym.spaces import B... |
d15a92d3d645b59c767bc72493d1d7115cb2f9fa9fa8e4c91d8539bf4b06010b | Python | 6,522 | 161 | """Contains methods for step compatibility, from old-to-new and new-to-old API."""
from typing import Tuple, Union
import numpy as np
from gym.core import ObsType
DoneStepType = Tuple[
Union[ObsType, np.ndarray],
Union[float, np.ndarray],
Union[bool, np.ndarray],
Union[dict, list],
]
TerminatedTrunc... |
0eb38da0a349fb9a1572a26ccbdb6f09ac1d66443dcf83e2b8454f56c1b23e65 | Python | 6,523 | 142 | """Model store which provides pretrained models."""
from __future__ import print_function
import os
import logging
import portalocker
from ..utils.model_utils import download, check_sha1
__all__ = ['get_model_file', 'purge']
_model_sha1 = {name: checksum for checksum, name in [
('854b23e460ab1fbc5a5cd458b439a... |
e0928d2107f2942935328a621fdc226772b52934cec068ffd95942539567c921 | Python | 6,523 | 172 | from __future__ import annotations
from typing import Any, Generic, TypeVar
import numpy as np
from attrs import define, field
from numpy.typing import NDArray
from ._utils import OFFSET_TYPE # noqa: F401 (re-exported convenience)
DTYPE_co = TypeVar("DTYPE_co", covariant=True)
@define
class RaggedLayout(Generic... |
fa8258c9aa075e22412e00f516e7e323957677dad344d801fd030bc6dda961cf | Python | 6,524 | 170 | """A01 semantic-attention slice: GPT-2 EAGER per-head facets (real ops).
Lane A01 acceptance (megaplan row A01 / walkthrough A-I item 3): per-head
facets (scores/pattern/z/result) EXIST for GPT-2, transformers 4.x AND 5.x,
eager implementation -- anchored at REAL captured ops (graph-derived, never
class-name-keyed), w... |
24a3878896e3d98e219b1c6478f39595e6bbaebf6721e7bc8812c415f80a12d2 | Python | 6,525 | 158 | from __future__ import division
from psychrnn.backend.rnn import RNN
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
class Basic(RNN):
""" The basic continuous time recurrent neural network model.
Basic implementation of :class:`psychrnn.backend.rnn.RNN` with a simple RNN, enabling biological... |
cbb081e27efa9877cddf4e3b5bfd0ee48ddce7584d139ac4d91e40936b38497b | Python | 6,526 | 160 | """Capture-time parameter/state identity for gc-independent honest saves (r75 F2).
Round-74 (free-roam) root-caused a PRE-EXISTING, gc-timing-nondeterministic honest-save
over-refusal: the runnable producer resolved parameter-argument identity at SAVE time
through live references (``Param._param_ref``, released by pos... |
8e61954745a24f830d14378ed5247f8ef87463a5bfb98e58739cf33fdc8d3827 | Python | 6,528 | 209 | import pandas as pd
from rectipy import Network
import numpy as np
import matplotlib.pyplot as plt
import torch
import pickle
# select device on which to run the optimization
device = "cpu"
# preparations
##############
# model parameters
node = "model_definitions/tanh"
N = 5
J = np.random.uniform(low=-1.0, high=1.0... |
fe17a3cc0e1786a0b44d05a5d65f969f6854781ade7914d72fdec2978ceb8eeb | Python | 6,528 | 193 | # --- 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 Line(_BaseTraceHierarchyType):
_parent_path_str = "box.marker"
_path_str ... |
435302d6c6b989d1800b7c30a53d3b3ceecd3f0327b9a32c16d6b55172f6385d | Python | 6,531 | 191 | # LICENSE
#
# _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._
#
# BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License");
#
# - you may not use this software except in compl... |
c9d0306a4c2bd28c41e774e6524531688d9ab25973b436d3185ac2b0c3fb26a3 | Python | 6,531 | 173 | '''
Generating the atom mappings for input into Jensen et al.'s model.
'''
import numpy as np
from rxnmapper import RXNMapper
from rdkit import Chem
from reaction_elaboration import make_elaborations, reagent_smarts_dict, reagent_smiles_dict
import re
rxn_mapper = RXNMapper()
def canonicalize_smiles(smiles):
s ... |
9909029e293ebefbffa056bd9f5bed333c60be2efca96f9040e35d7260bd0970 | Python | 6,533 | 170 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Apr 2020
@author: Nathan de Lara <nathan.delara@polytechnique.org>
"""
from typing import Union
import numpy as np
from scipy import sparse
from scipy.sparse.linalg import eigs, LinearOperator, bicgstab
from sknetwork.linalg.diteration import diffusion
fro... |
5b0a5c785c61020de33805bebf8e5156f251362b9b1819d818156e37a2dfafce | Python | 6,535 | 190 | """Plots for spikes."""
import numpy as np
import matplotlib.pyplot as plt
from spiketools.utils.options import get_avg_func, get_var_func
from spiketools.plts.data import plot_bar, plot_hist, plot_lines
from spiketools.plts.utils import check_ax, get_kwargs, savefig
from spiketools.plts.style import set_plt_kwargs
... |
9e9de898bb178659e618c9cf8966daf1c437cbcdaef6b5e73990e3d40f3bb1a6 | Python | 6,535 | 145 | # 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... |
42963fabd65c425fd58a0b24f290d688c4e80166daf3ef18e579fe0165a06f7e | Python | 6,538 | 230 | import sys
from unittest.mock import Mock, patch
import pytest
pytest.importorskip('eventlet')
from greenlet import GreenletExit # noqa
import t.skip # noqa
from celery.concurrency.eventlet import TaskPool, Timer, apply_target # noqa
eventlet_modules = (
'eventlet',
'eventlet.debug',
'eventlet.green... |
2e525e9c0945a08c85a8c0ab24b38f1b05a3a438338c4849e32c2b696b8e3dca | Python | 6,539 | 139 | import pandas as pd
# Clean data
cols = ['PHASE', 'RID', 'SITEID', 'VISCODE', 'VISCODE2']
df = pd.read_csv('MRI_DATA/MRI3META.csv', usecols=cols)
# Seperate by Phase
df_adni2 = df[df['PHASE'] == 'ADNI2']
df_adni3 = df[df['PHASE'] == 'ADNI3']
# Obtain screening for new and rolling over pts
df_adni2_sc = df_adni2[df_a... |
636f351d6283f7d6d3763055eed5e459695825e06b92b6eeb71b3fbb609e3f40 | Python | 6,539 | 190 | """Test suite for the rnn layer functionalities.
"""
# imports
from rectipy.nodes import RateNet, SpikeResetNet
import torch
import pytest
import numpy as np
from pyrates import clear_frontend_caches
# meta infos
__author__ = "Richard Gast"
__status__ = "Development"
# Utility
#########
def setup_module():
pr... |
167749d77dbc49829f82c4e21d231ac6c7a6a40d6d8eaee14968990eabf20931 | Python | 6,540 | 158 | """
Failed Model Fits
=================
Example of model fit failures and how to debug them.
"""
###################################################################################################
# Import the SpectralGroupModel object
from specparam import SpectralGroupModel
# Import simulation code to create test... |
02ff75b1c337d475d08e90dc94fe789c73a306bc771127ecc9f21a2aefff00ad | Python | 6,541 | 159 | #!/usr/bin/env python3
'''Take a prefix, model name and output and generate predictions for
a cross-docked formatted dataset. Will use the last model
'''
import numpy as np
import os, sys, argparse
#os.environ["GLOG_minloglevel"] = "10"
sys.path.append("/home/dkoes/git/gninascripts/")
sys.path.append("/net/pulsar/... |
1a704652ebb2a515eaacde92f1b02cdd9e91e6c01b18564dd48bf8a15c9c02a8 | Python | 6,541 | 193 | from typing import List, Union
import torch
import torch.distributed as dist
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
@torch.no_grad()
def sinkhorn(
out: Tensor,
iterations: int = 3,
epsilon: float = 0.05,
gather_distributed: bool = False,
) -> Tensor:
"""Dis... |
b22a91242fae4f9186200b0366e42db0cacae6cc4b9405a4fc2714daa1a5a5e3 | Python | 6,541 | 191 | """
Visualize RSA results.
"""
import mne
import numpy as np
import matplotlib.pyplot as plt
import scipy.io
import sys
from config import fname
from mpl_toolkits.axes_grid1 import make_axes_locatable
import matplotlib.font_manager
import matplotlib as mpl
mpl.rcParams['pdf.fonttype'] = 42
#%%
levels = ['V1','V2','... |
b2cddd514ae2190e3a2658e2723dcff97ef0fff420b301929220c5569fc497d2 | Python | 6,541 | 174 | """Spatial DEGs
"""
from typing import List, Optional
import numpy as np
import pandas as pd
from anndata import AnnData
from joblib import Parallel, delayed
from scipy.sparse import issparse
from statsmodels.sandbox.stats.multicomp import multipletests
from ..logging import logger_manager as lm
try:
from typing... |
610046dc51b256b7f0621abcd18b996df7b814cc6990f93ba3cbf5af0eb5c346 | Python | 6,542 | 172 | import os
import pickle
import torch.nn.functional as F
import torch
from tqdm import tqdm
from rdkit.Chem.rdchem import Mol
from typing import List, Any, Dict, Sequence, Tuple
from torchmetrics import R2Score
from scipy.stats import pearsonr
from .evaluator import Evaluator
from bioconfpred.conf_ensemble import ConfE... |
501eaaaf18006ec71e3f495d37354c58657c2481c74e8f4a2cdcb4db73effa52 | Python | 6,543 | 150 | #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Written by Yuichiro Yada
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
################################################
# A code for Fig. 5e-f. This code uses output .pkl files from "prediction_simdata.py".
################################################
import... |
66b8b353ed514087c6b23005e2baf59dc0256d75fbc738b4c7f718e79eb50251 | Python | 6,543 | 155 | """Tests for plain-capture tensor-to-Python scalar escape warnings."""
from __future__ import annotations
import warnings
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.errors import ScalarEscapeWarning
from torchlens.options import CaptureOptions
class _ItemScale(nn.Module)... |
a161660178e09b8a9fedf75f5373d9901433cf49559c9a22efcb6fbd2781f058 | Python | 6,543 | 193 | # --- 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 Line(_BaseTraceHierarchyType):
_parent_path_str = "violin.marker"
_path_s... |
0f9283123d19b03c6434ca0edeb3d8ce7d3d9fa43d65faaae0dde24ad969790c | Python | 6,545 | 138 | import os
import pandas as pd
import numpy as np
import pdb
import scipy
import regression_funcs as rf
from sklearn import linear_model
usage = "regr_baseline_ampl_db_clean.py"
long_help = """
Computes regression model for baseline beta lateralization dependent on bias
"""
from os.path import join
meta_path = '/hom... |
348b8666b0d9e8f33a4f3593400ca46c9495b48f8af5a25801812ff4d7fd47a1 | Python | 6,546 | 209 | from typing import List, Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from pointnet2_ops import pointnet2_utils
def build_shared_mlp(mlp_spec: List[int], bn: bool = True):
layers = []
for i in range(1, len(mlp_spec)):
layers.append(
nn.Conv2d(mlp_spec... |
cbf6f7dc165ddcdb635ed96e5941ded2db2db12d3fe8daff0f35963418027022 | Python | 6,546 | 174 | #!/usr/bin/env python3
"""Diagnostic P — verify age-matched LEMON (60+) config with full
perm-null + bootstrap CI, and compare to 4-cohort baseline.
Expected:
Full LEMON (n=212) drops LOCO 0.786 → 0.737 due to age confound.
Age-matched LEMON 60+ (n=66) should hold LOCO ≈ 0.786 and improve
the 95% CI lower bound ... |
042f2b12669dcad0e017abdfdfe9cb885cf69bbe4508fa02bbece3993b930a81 | Python | 6,547 | 187 | # The implementation in this file was adapted from the following:
# https://github.com/tdeboissiere/DeepLearningImplementations/blob/master/DenseNet/densenet.py
# Copyright Thibault de Boissiere, distributed under the MIT License
# https://github.com/tdeboissiere/DeepLearningImplementations/blob/master/LICENSE.md
# Per... |
74caf78bcaa9564958f52ab038040f3f5fe07231aca98f39c301907504da966f | Python | 6,547 | 176 | import contextlib
import os
import random
import numpy as np
from sklearn.model_selection import KFold, StratifiedKFold
import torch
from torch.utils.data.dataloader import DataLoader
from torchsummary import summary
from hn_cnn.cnn import MODELS
from hn_cnn.constants import *
from hn_cnn.data_augmentation import ge... |
4c85d2a835e50e313d023951c4dad9147541546de43c9884e669c976fd241007 | Python | 6,548 | 171 | import os
import argparse
import torch
import numpy as np
from math import log, floor
from argparse import Namespace
from bioseq2seq.inputters import str2reader
from bioseq2seq.translate import Translator, GNMTGlobalScorer
from bioseq2seq.bin.models import restore_seq2seq_model
from bioseq2seq.utils.logging import ini... |
a412dfcaf0218156eb856f479e13bac09468d2d2d9620ab912b6dbf488fc0aaf | Python | 6,549 | 157 | from dataclasses import dataclass, field
from typing import Optional
from codecarbon.core.units import Energy, Power, Time
from codecarbon.external.logger import logger
# Maximum relative difference between two cumulative energy counters for them
# to be considered two views of the same hardware counter. Multi-die CP... |
00b65d3db86db4981a58d8192010474ae68b9d00ec43287d189675f84dc72ee2 | Python | 6,550 | 194 | from typing import Literal, Optional, Union
import numpy as np
import vtk
from pyvista import MultiBlock, PolyData, UnstructuredGrid
from ..models import collect_models, multiblock2model
from .pick import _interactive_pick
from .utils import _interactive_plotter
def _interactive_rectangle_clip(
plotter,
mod... |
7a7fd8c3db27e9b645b12ff6660319dfca4b349f46eb397ef0d220c64a27e89f | Python | 6,550 | 234 | """Plot utilities."""
import math
from functools import wraps
from os.path import join as pjoin
import matplotlib.pyplot as plt
from matplotlib import gridspec
###################################################################################################
#########################################################... |
4589e6cdd533e25b5b4f450afa81e544f22f759f29e2a09e52692a1dea39749a | Python | 6,551 | 131 | #!/usr/bin/env python
# coding: utf-8
"""
Source-level RSA using a searchlight on volumetric data
-------------------------------------------------------
This example demonstrates how to perform representational similarity analysis (RSA) on
volumetric source localized MEG data, using a searchlight approach.
In the s... |
74f7e6e9331edf296d3de09441cf80b47a91707d44190e84c66b9f55a9756a4a | Python | 6,551 | 184 | """Meta-test for the split-rebind facade trap: patch the HUB, never the child.
b9 R43-1 (fable+opus+sol converged): ``_split_rebind.rebind_function`` gives
every split-child function the HUB module's globals, and the hub then pushes
its whole namespace back into the children. Two consequences every test and
fault-inje... |
ad0a19207a11e0013ab26cd3cf3b1bbcdf7720ed00ccf9716786408011fe7a61 | Python | 6,551 | 154 | """The differential oracle's exception authority is the harness, not the subject.
b9-sol R75-1: ``align_streams`` excused mode events against the wrapper's own
live ``funcs_not_to_log`` export, so a capture regression that ADDS an op to
that table was excused by the oracle it should have tripped. These tests pin
the f... |
2cd919b6d8491ac628c50a88ed3d6ffd5fa1815f7921f7662fcf0f4c8844a933 | Python | 6,552 | 178 | # Copyright (c) 2024 PaddleHelix Authors. All Rights Reserved.
#
# Licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0
# International License (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://creativecommo... |
656eb7e5e70dad3f4de320c20c866b0050f3160b9a13486c9363039cfa1bc43b | Python | 6,555 | 225 | #!/usr/bin/env python
#
# Copyright 2006, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
79962fc45bad6b51e78cb379953a810e90f08441650069506410085f268207e7 | Python | 6,555 | 229 | #!/usr/bin/python3
import gzip
import os
import sys
from optparse import OptionParser
from rdkit.Chem import AllChem as Chem
"""
This script was originally written by David Koes, University of Pittsburgh:
https://github.com/dkoes/rdkit-scripts/blob/master/rdconf.py
It is licensed under the MIT licence.
Given a smil... |
1b5a30aa7e50d2bfcec3b9e659beb97600a9ea0845ba95ed3ab55fe9837c66a0 | Python | 6,557 | 150 | # Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com)
# Some parts of the code were referenced from or inspired by below
# - Dong-Hyun Lee's code (https://github.com/dhlee347/pytorchic-bert)
# - Tristan Bepler's code (https://github.com/tbepler/protein-sequence-embedding-iclr2019)
# PLUS
""" pre-proc... |
f2a9ab3f5eb2db1a2daa9c10101e2de4f69d2b3d9cb3a2cab5269ff70b87908f | Python | 6,558 | 207 | #!/usr/bin/env python3
"""
Test script for device_scanner.py backup filename fix.
This script tests the updated device_scanner methods to ensure they properly
handle the new nested databases structure and eliminate the warning messages.
"""
import os
import shutil
import sys
import tempfile
from unittest.mock import ... |
62a316841d3b2feb0ba31ceb6da45b4473d1175263324ba475b01dd56875546b | Python | 6,559 | 190 | """Tigramite causal discovery for time series."""
# Author: Sagar Nagaraj Simha, Jakob Runge <jakob@jakob-runge.com>
#
# License: GNU General Public License v3.0
from __future__ import print_function
from scipy import special, spatial
import numpy as np
from scipy.stats import chi2
from scipy.special import xlogy
fr... |
9091be79f6f4017444f1da31ddaa37fa152914f704ded16be326f87c97cd879d | Python | 6,559 | 167 | import numpy as np
# Use case for the library ...
# with open("out_va.json") as f:
# vafile=json.load(f)
# slice=vafile["slices"][0]
# print(slice.keys(),np.shape(slice["markers"]),np.shape(slice["anchoring"]))
# width=slice["width"]
# height=slice["height"]
#
# triangulation = VAL.triangulate(width,height,slice["... |
6bddeac8c15a235bf8fdbcd4464b0e1b71ce1699c899e17b2286c41bf8710ee7 | Python | 6,560 | 171 | """Vizmech wave-2 item 14: the one typography record (M(vizmech) D29).
Pins:
- every theme preset carries a pinned font family on ALL THREE Graphviz
scopes (graph covers cluster captions and the graph caption) -- before the
fix the default preset pinned nothing and was the only serif theme, and a
theme swap alon... |
8a3877794a512a4cd3b76156f6325078e6a2973828ce926a8e6a4c87fdc01876 | Python | 6,560 | 143 | import pandas as pd
import os
import numpy as np
import os
import shutil
import subprocess
import re
AGE_FROM = 3 * 12
AGE_TO = 35 * 12
path_to_save = "data/t1_mris/raw/"
def find_file_in_path(name, path):
result = []
result = list(filter(lambda x:name in x, path))
if len(result) != 0:
return res... |
0096201158cba7d64f73f6594898d8bdda329242fbdfe6d3aa0463f5e9c93927 | Python | 6,561 | 174 | """Module providing a encapsulation of pySTAGATE."""
import torch
import torch.nn.functional as F
from anndata import AnnData
from scipy.sparse import issparse
from tqdm import tqdm
class pySTAGATE:
"""Class representing the object of pySTAGATE."""
def __init__(
self,
adata: AnnData,
... |
cfe2e63c040d7b82f6e98400223e3c91e606671258aeee5ab93cdba6eb1ac220 | Python | 6,561 | 200 | """The Azure Storage Block Blob backend for Celery."""
from kombu.transport.azurestoragequeues import Transport as AzureStorageQueuesTransport
from kombu.utils import cached_property
from kombu.utils.encoding import bytes_to_str
from celery.app.utils import _redact_azure_connection_string
from celery.exceptions import... |
cf1c985b0e0245438b82b9151e8723e6a632aa1203cc4b9a8c562194cf4505d7 | Python | 6,562 | 216 | import warnings
from contextlib import nullcontext as does_not_raise
import numpy as np
import pytest
import pynapple as nap
class MockArray:
"""
A mock array class designed for testing purposes. It mimics the behavior of array-like objects
by providing necessary attributes and supporting indexing and i... |
2583a4be33973b00dbda4ff74b3e22732e2be612e0e88bebea318477dad47da3 | Python | 6,563 | 167 | #!/usr/bin/env python
import argparse
import os
from Bio import SeqIO
from Bio.Restriction import Restriction_Dictionary, RestrictionBatch
import csv
import sqlite3
import sys
import pandas as pd
def digest_genome(
genome_fp,
restriction_enzyme,
output_dir,
linear=False):
base_fp ... |
086aab8a874635d83de12a0146ca0f67d257836552c0fe1c6a579a8bfe0c1722 | Python | 6,565 | 208 | """
Contains an abstract base class that supports different ML models.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
__author__ = "Bharath Ramsundar and Joseph Gomes, modified by Qingyuan Feng"
__copyright__ = "Copyright 2018, Simon Fraser Uni... |
75608854717935fbc22da5f3d844060b516a2909fadf1b0b03252b01b51eaa9d | Python | 6,566 | 204 | import os
import numpy as np
import pandas as pd
from collections import Counter
import cv2
from tensorflow.keras.applications.vgg19 import VGG19
from tensorflow.keras.applications.vgg19 import preprocess_input, decode_predictions
from tensorflow.keras.preprocessing.image import smart_resize
from tensorflow.keras.model... |
3b935d8e40e49a313f9d1ddfb4a2f86627180aaee4b9f92c137e9b4b4864bb2a | Python | 6,568 | 172 | """
Unit tests for video helper utilities
Tests the video file listing and indexing functionality used in backup operations.
"""
import os
import tempfile
import pytest
from ethoscope_node.utils.video_helpers import list_local_video_files
class TestListLocalVideoFiles:
"""Test suite for list_local_video_files... |
1fb1d3bc3cf6a273bc9353ea8b0b155b13530160acec8b35f5ef1ca2d51abe90 | Python | 6,569 | 176 | """The four-clause episode declaration invariant + the priced settlement cost
(lane F40a, foldA D4/s3).
``episode=`` is a pure declaration in the sense the one-door rule needs:
declaring it changes NOTHING about the executed model call or the recorded
graph. The permanent regression is the FOUR-CLAUSE invariant -- ide... |
18cc36801398e43739b2b8cf0852c6dd823934a82f905904925b777a8bd8e56d | Python | 6,570 | 184 | # 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... |
4539c7d567c30c0a990772a1def3a9fb79add257696661d9fabb237121340a33 | Python | 6,570 | 200 | # SOURCE: vendored from https://github.com/yz-cnsdqz/GAMMA-release @ main
#
# GAMMA (CVPR 2022): "The Wanderings of Odysseus in 3D Scenes" -- generative
# motion-primitive VAE for human motion generation. Vendored verbatim (only
# import paths trimmed to drop unused smplx/torchgeometry/tensorboardX
# module-level impor... |
2d0a0f6f527cc709f1526d4f2595fdc4525afa9c8e435256993cd3557a8becec | Python | 6,572 | 193 | import math
from itertools import product
import PIL
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec, GridSpecFromSubplotSpec
def tile_images(images, ncols=None, columned=False, labels=None, fig=None,
wspace=0, hspace=0.1, horizontal_margin=0.05, vertical_margin=0.05,
... |
52dd763d066d5fb7c7c819b8a0f5d786d454242cb13d5d48c969e3521c9653a1 | Python | 6,573 | 167 | ##########################################################################
## ##
## Copyright (c) 2019 Philipp Lösel. All rights reserved. ##
## ##
## This file is par... |
81496f5824eb75896cd4307200d4cb40e9cfc19c46ba826410ceb4dd3df2dc06 | Python | 6,574 | 156 | import h5py
import glob
import math
import xarray as xr
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
plt.rcParams['font.sans-serif'] = 'Helvetica'
# f = open('CN-border-La... |
adbac6294088b9f6d5b1638ee05041ff4bd6b52c81040cb009715bcf2ae87af6 | Python | 6,574 | 157 | import csv
import os
from typing import List, Optional
import pandas as pd
from codecarbon.core.util import backup
from codecarbon.external.logger import logger
from codecarbon.output_methods.base_output import BaseOutput
from codecarbon.output_methods.emissions_data import EmissionsData, TaskEmissionsData
class Fi... |
cbd7dd99bd16498c347147379e7768934dd32b70bb21cb8e58575a45fcc25745 | Python | 6,575 | 192 | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 25 10:29:02 2020
@author: Kepetousakis
"""
import numpy as np
import pickle
from copy import deepcopy as dcp
from pathlib import Path as fpath
from scipy.stats import norm as norm
def Find(condition):
try:
return [int(x) for x in np.where(condition)[0]... |
e1bedd37bfa3d8c867d5aa4053a1b526421cfee6dcc9db99a9029d6d1545d488 | Python | 6,575 | 231 | """
====================================================================
Ensemble learning on functional connectivity
====================================================================
This example shows how to compute SPD matrices from functional
connectivity estimators and how to combine classification with
ensemb... |
dfece00e577c5aae1e08b648fcb1ad14aabd2f7c26e6cecfed92f6c85fa0dd2f | Python | 6,576 | 177 | """Save-side canonical-label preflight for empty-name state (r79, r78 free LOW).
Round-78 (free) found a save/load door asymmetry: ``self._parameters[""] =
nn.Parameter(...)`` bypasses ``register_parameter``'s empty-name validation,
captures fine, and SAVED a runnable artifact whose weight tensor entry carried
label `... |
0c302030a5a89caab2e08d7edbbf8007bc2d9869a6b42979977ca795fed5517d | Python | 6,577 | 149 | import copy
import numpy as np
from numpy.random import default_rng
import pymc as pm
from pmsurv.models.weibull_base import WeibullModelBase
# https://github.com/pyro-ppl/numpyro/issues/534
# http://num.pyro.ai/en/stable/mcmc.html#numpyro.infer.mcmc.MCMC.post_warmup_state
class WeibullModelNN(WeibullModelBase):
... |
6cdf2fec13eefb7ddbec87295ba2ff051a17d2c8142dcfb6589edc10ea4d0f15 | Python | 6,577 | 167 | """W051-AGENT: live --fail-on gates on every record shape (AUD-CODE 3.11a),
tier-0 purity on non-directory paths (3.11e), and the corrupted-metadata
cache miss (3.11c)."""
from __future__ import annotations
import shutil
import subprocess
import sys
from pathlib import Path
import pytest
import torchlens as tl
from... |
1de2a0554aac10a41ef1b6436ab4acbd351856c7d54541dbb6baa64ebfb4607d | Python | 6,579 | 219 | import SimpleITK as sitk
import numpy as np
import math
class Image():
"""Docstring for Image.
Class for image object using SimpleITK
"""
image = sitk.Image()
original_image = sitk.Image()
def __init__(self,image = None):
if image:
if type(image).__name__=='image':
... |
d1bb6a4fb90695ca5065fa62e3f88d2967a6367077283d1d0fe858d936f5c2b3 | Python | 6,579 | 209 | # -*- coding: utf-8 -*-
#
# DeepSpeech documentation build configuration file, created by
# sphinx-quickstart on Thu Feb 2 21:20:39 2017.
#
# 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.
#
... |
f9445956865a36c9b0ec9e6aceeeed222f76dea5ede2f7cc484fa653cd497579 | Python | 6,579 | 172 |
import os
import unittest
from unittest.mock import MagicMock, call, patch
from carbontracker import exceptions
from carbontracker.emissions.intensity.fetchers.electricitymaps import (
API_URL,
ElectricityMap,
)
"""
Test constants for doing the end 2 end test. Note, that if you have a free subscription on el... |
6cd7d4eb5aefb9e07dc6f55392376c9f2bc204c1c60b1bc64e60525d4e180b48 | Python | 6,580 | 224 | # %%
# # Calculates basic inter-rater reliability (irr) metrics for
# the fix classifications
import seaborn as sns
import matplotlib.pyplot as plt
import os
import numpy as np
import pandas as pd
from sklearn.metrics import cohen_kappa_score
import sys
sys.path.insert(0, '..')
from functions.data_helpers import get_c... |
7a2f48d1e811d72aa9f865017a6efab4953b743b532d68dbbace1681528b0be5 | Python | 6,580 | 181 | """A closed host-RNG monitor window never pins the captured model (r15 CI triage).
An intervention-ready capture arms ``host_nondeterminism_monitor``, whose wait
patches are class-level and process-wide. A benign background thread left by an
earlier test (a progress-bar monitor, an idle executor worker) that enters a
... |
baaba73e504131c854d815a4ad8bc0f1352c8cb2589c4eccff1e04755cde4daf | Python | 6,580 | 180 | """grind-p3 T11.7: _fields presence is not proof of an *args constructor.
The capture-entry normalizers (``_coerce_input_args`` and
``copy_arg_tree``) inferred a namedtuple ``*args`` constructor from the mere
presence of ``_fields``, so a tuple subclass exposing ``_fields`` as a list
or property -- with an ordinary si... |
5c092d209ac19d59e1fb6f383442942293f30026166a2e5766473e9e19293789 | Python | 6,582 | 173 | # --- 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 Cumulative(_BaseTraceHierarchyType):
_parent_path_str = "histogram"
_path... |
ed5e8c24f65046ef37558929ba322a1630dc00cff9e8daafcf21d4922ba26c53 | Python | 6,583 | 172 | # 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... |
41c86ba96149d43456432b38a2664f312ac0b71417cfaabf402b8585a5842b2c | Python | 6,584 | 171 | """Browser-bound, single-use authentication state stored alongside PSA partials."""
import hashlib
import json
import math
import re
import secrets
import time
from collections.abc import Mapping
from typing import (
Any,
cast,
Literal,
)
from sqlalchemy import (
delete,
select,
)
from sqlalchemy.... |
84337d8012052c8d3f5f8c1d07f5937c341eb94323026e29b00e4abc92a75cd3 | Python | 6,584 | 165 | # pylint: disable=line-too-long,too-many-lines,missing-docstring
import random
import numpy as np
from mxnet import gluon
__all__ = ['SplitSampler', 'ShuffleSplitSampler', 'SplitSortedBucketSampler']
class SplitSampler(gluon.data.sampler.Sampler):
""" Split the dataset into `num_parts` parts and sample from the... |
b629b03e2aa8e3218508363143813c4a8ce90d959a1d2dd83ead5f33795b285a | Python | 6,584 | 170 | """Honesty guards for structure-only capture (L7a memo sec 3.4/9.5-9.7).
G2 digest domain separation (meta can never collide with real), G3 render
honesty (banners on every human surface), the default-path teaching
enrichment of unsupported_tensor_variant (ships regardless of D8), and the
baseline entry-gate pins that... |
0842a2eb1db03f4e99e73b265537ace8d03392279ec9c350d113adcfd0b0de98 | Python | 6,585 | 179 | # --------------------------------------------------------
# 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
# --... |
f655871979377de4af87e40b0e545bf926f7c3ad59b071783034b4f6a805e101 | Python | 6,585 | 249 | from __future__ import annotations
import pytest
import env # noqa: F401
from pybind11_tests import ConstructorStats
from pybind11_tests import call_policies as m
@pytest.mark.xfail("env.PYPY", reason="sometimes comes out 1 off on PyPy", strict=False)
def test_keep_alive_argument(capture):
n_inst = Constructor... |
45fe8176e11a57ebed92ab2f5b6f7e08545b3ecb60fbe33fa5b4a6b6a4acb253 | Python | 6,588 | 132 | import os
import numpy as np
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
from tensorflow.keras.layers import Dense, Dropout, GlobalAveragePooling1D, Input, Masking
from tensorflow.keras.models import Model
import utils
import transformer_network
base_path = "log/"
model_path = base_path + "saved... |
46563fa5e5a7951ede93b99d95ec95fc8852398698baa951455a9a46b2e8fcc2 | Python | 6,588 | 180 | import pathlib
from pathlib import Path
from datasets import load_dataset
from omop_learn.utils.config import Config
from omop_learn.data.cohort import Cohort
from omop_learn.data.common import ConceptTokenizer
from omop_learn.data.feature import FeatureSet
from omop_learn.sparse.data import OMOPDatasetSparse, OMOPDat... |
267515fcf50170baab28710851d05dc98f0d9b6964998fe71705f44cfef7ff29 | Python | 6,590 | 201 | import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import statsmodels.api as sm
from statsmodels.tsa.stattools import grangercausalitytests
import seaborn as sns
import matplotlib.scale as mscale
import matplotlib.pyplot as plt
import matplotlib.transforms as mtransforms
import matplotlib.ticker as... |
4e634331b240cfafe2a20eb1418c45fe2060df201c5b28d083f2ceb63db8754d | Python | 6,592 | 210 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: gviejo
# @Date: 2022-09-09 14:53:21
# @Last Modified by: gviejo
# @Last Modified time: 2023-11-16 13:22:10
"""
> :warning: **DEPRECATED**: This will be removed in version 1.0.0. Check [nwbmatic](https://github.com/pynapple-org/nwbmatic) or [neuroconv](https:... |
5b7cff203b0ad625f85beb60f18ad7797e878c2e2b4bc91cef45ca5cc8bba08c | Python | 6,592 | 184 | """
#--------------------
Created on 2021.10.28
Version 1.0
__author__ = 'Xx'
#--------------------
"""
import math
from conf_test import conf_test
from conf_test_2val import conf_test_2val
from tview import tview
'''
Description:
Routine for performing clear sky tests over desert and arid surfaces during dayli... |
930f086ff94a8c27273ca35b4bb87c1f3b5154ad1de5169c537aff2917559e63 | Python | 6,592 | 173 | """Utilities for extracting common archive formats"""
import zipfile
import tarfile
import os
import shutil
import posixpath
import contextlib
from distutils.errors import DistutilsError
from pkg_resources import ensure_directory
__all__ = [
"unpack_archive", "unpack_zipfile", "unpack_tarfile", "default_filter",... |
777278ba1909b89075f51c22d94d260a98625847a486a044f8ecaf252dac05b1 | Python | 6,593 | 201 | """F1 microbenchmark: facet indirection cost on the capture hot path.
The converged backend plan (fable_r2 D1 / opus_r2 D1) gates the Phase-4
OpCore+FacetSet decomposition on a measurement: if facet indirection costs
more than 1% of per-op capture time, the schema falls back to a flatter core
(~25 fields) plus one det... |
d42412d4ec123cbc4ad208049fbeef2ab20db6bf196b2088f234a6aa9c16d3cb | Python | 6,593 | 178 | import argparse
import csv
import numpy as np
import torch
from transformers import AutoConfig, AutoModel, AutoTokenizer
from visualize_attn import create_visualizations_for_selected_sequences
def parse_fasta(fasta_file):
sequences = []
header = None
current_seq = []
with open(fasta_file, "r") as fas... |
97202ce767553c7463b81ccf3049a7c40eca786e2b77bd214cf4e75b6ccc76b2 | Python | 6,594 | 194 | import os
import shutil
import tempfile
import numpy as np
from eelbrain import fmtxt
from eelbrain.testing import TempDir, requires_framework_build
from eelbrain.fmtxt import html, tex, read_meta
from eelbrain import datasets, plot
def test_code():
"test fmtxt.Code"
s = ' '
br = '<br style="clear:... |
b7e4720155c70949227f65ba9a1edc4732b28084837b008fc223426f4f34cdad | Python | 6,595 | 144 | import os
import sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
# For replicating the experiments
SEED = 42
import numpy as np
import torch
np.random.seed(SEED)
torch.manual_seed(SEED)
from torch import optim
import torch.nn.functional as F
from gae.model import GCNModelVAE,... |
6048363fd08a92cea15c99f7d3f92c2b3dcff1cffb58710de308da5ecf8a5e38 | Python | 6,596 | 176 | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
9de5ee476643c867a7e286691c31aa99b403a49269c2269b9563a67911498cdd | Python | 6,596 | 172 | import torch
import torch.nn as nn
import torch.nn.functional as F
from ..base import _layers as layers
from ..base import _blocks as blocks
from ..base import _towers as towers
class BPNet(nn.Module):
"""
This nn.Module was taken without permission from a Mr. Schreiber.
Just kidding, he made it open sour... |
e587428e7039547f2840dbb2a50939aa0e49da99da448a47b7597e33df14e183 | Python | 6,598 | 174 | from __future__ import annotations
import hashlib
import numpy as np
import pandas as pd
from bream4.toolkit.pings.ping_generation import translate_keys
try:
from production.sawtooth_utils import add_sawtooth_session_info
except ImportError:
pass
from typing import Any, Optional
from bream4.device_interfa... |
91c840d158971cdfd3153be14c58d9ee92d8f1500f4aa7dd041c39038d460f32 | Python | 6,599 | 182 | """Realism gate for the skeleton-change recipe page (workstream SKELETON-RECIPE).
``docs/skeleton_change_recipe.md`` is the documented, tested capability that
survived the dropped ``tl.edited`` verb (foldA D13/item 13): the user edits a
model's skeleton in their OWN code, traces the edited model, and re-aligns
saved a... |
de3357bfec0243fb02b94ffcfbc3e8b08362e22a627a968e03e5036705e39832 | Python | 6,599 | 157 | import unittest
from unittest.mock import patch, mock_open
from carbontracker.components.cpu.intel import IntelCPU
from carbontracker.components.component import Component
from carbontracker import exceptions
import re
class TestIntelCPU(unittest.TestCase):
@patch("os.path.exists")
@patch("os.listdir")
def... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.