sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
bf4dcd1625e10f142f43b6ea57654819d450d29c8f4fd13d10ef071f4231ca21 | Python | 8,064 | 188 |
import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
import torch
import torch.nn as nn
from torch.nn import init
import torch.nn.functional as F
from functions.lsp import Project_inf, Wxs, Wtxs
from time import time
dtype = torch.complex64
# define LSFP-Net Block
class BasicBlock(nn.Module):
def __in... |
0ddce81b38ad01d507ade18e4951537b13201aff61d6256e2363e8a9b68f21f4 | Python | 8,065 | 231 | """This module implements an abstract base class (ABC) 'BaseDataset' for datasets.
It also includes common transformation functions (e.g., get_transform, __scale_width), which can be later used in subclasses.
"""
import random
import numpy as np
import torch.utils.data as data
from PIL import Image
import torchvision.... |
4d004857bfd0ce691623eba6cb35b395161d0157a330b8fe6509717844fbcf33 | Python | 8,065 | 194 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Masked autoregressive flow layer for PyTorch.
"""
# ==========================================================... |
863bb793f60342cd711bfa9035dad1b73bef04453870f16425ec40323b876c4f | Python | 8,066 | 223 | """Task execution strategy (optimization)."""
import logging
from kombu.asynchronous.timer import to_timestamp
from celery import signals
from celery.app import trace as _app_trace
from celery.exceptions import InvalidTaskError
from celery.utils.imports import symbol_by_name
from celery.utils.log import get_logger
fr... |
95ed209061a4d90fda4e2ca29d5c02ab808131eb7f5741ebface89b42112a12d | Python | 8,066 | 273 | from __future__ import print_function, unicode_literals, absolute_import, division
from six.moves import range, zip, map, reduce, filter
from ..utils import _raise, consume, normalize_mi_ma, axes_dict, axes_check_and_normalize, move_image_axes
import warnings
import numpy as np
from six import add_metaclass
from ab... |
29ffcc488b43d098bf6fe84d06aef2c60c2c5ae6c0ec1a24f2c49dcc6e85d61f | Python | 8,067 | 207 | """r35 hon2_1 (I2): exception-driven control flow can never be a false VERIFIED.
A taken path decided by whether an op RAISED (Cholesky-with-jitter, robust
inversion, safe-log guards) is invisible to every tensor witness. The
event-lifecycle ledger records the caught raise at capture, the producer
downgrades witness c... |
58ad79b1dab00441dbca5139a66c209fbdfdfcad7843e59437a800209e0b7a17 | Python | 8,067 | 165 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
ae00f68b3b32e87848629604f247edbe0e17d600d2efcd1450640195ba24b174 | Python | 8,067 | 234 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on March 2019
@author: Thomas Bonald <bonald@enst.fr>
"""
import numpy as np
from scipy import sparse
from sknetwork.hierarchy.paris import AggregateGraph
from sknetwork.utils.check import check_format, get_probs, check_square
from sknetwork.utils.check import... |
18cbe698084111e8026c32eff25447e622d2e549eb196ca9bd40d3b59aa0881c | Python | 8,068 | 147 | from typing import List
import numpy as np
import tensorflow as tf
import tqdm
from sklearn.linear_model import Ridge
from angorapy.analysis.investigators import base_investigator
from angorapy.common.policies import BasePolicyDistribution
from angorapy.common.senses import stack_sensations
from angorapy.tasks.wrappe... |
1f8d7eaa9ae9ebbd7f0025d1cd8cf52cc6c2a55798b8b85104ded8e306b5e2b8 | Python | 8,070 | 237 | # This example requires the following dependencies to be installed:
# pip install lightly
# Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
from functools im... |
2012a8310328243b3a17fccf1fa423ff9486319b093758f2276b1a699d517b20 | Python | 8,070 | 196 | # pylint: disable=missing-function-docstring, unused-argument
"""
PyTorch implementation of the non-local module from Non-local Neural Networks
CVPR 2018, https://arxiv.org/abs/1711.07971
Code adapted from https://github.com/open-mmlab/mmaction
and https://github.com/AlexHex7/Non-local_pytorch
"""
import torch
import t... |
145f1113452fd5b2067f4f40d3eb7b82014b4afd6c538ba223991422e869d514 | Python | 8,071 | 256 | """Phase 8 bundle comparison primitive tests."""
from __future__ import annotations
import inspect
from collections.abc import Iterator
import torch
from torch import nn
import torchlens as tl
class _TinyRelu(nn.Module):
"""Small model used for bundle primitive tests."""
def __init__(self, offset: float ... |
456786908d061af2a70598e66891104887c77f6d6086cccab3741de35a3aa33f | Python | 8,071 | 236 | """Useful functions."""
import random
import ast
import numpy as np
from math import ceil, floor
from rdkit.Chem import AllChem
from rdkit.Chem.rdchem import ChiralType
def get_monomer_sequences(n_structures, distribution, DP):
"""Only supports homopolymer/copolymer of 2 monomers. Anything larger will be given
... |
874a608cb74c63ad4db1908c6a1fc14962ccce59b3d59d959a7a4a995e337a1d | Python | 8,072 | 239 | """Provocation rows for the mech-interp kit's refusal vocabulary (S-17).
Every cheaply-provokable ``mi_*`` / ``norm_*`` code gets a direct provoking
test here (pure logic, smoke tier); the model-bearing provocations live in
``test_mikit_core.py``; the handful needing a broken substrate are
consciously baselined in ``t... |
d8c8b42cab4e3c97f0e40c7fb4022910f35aab36a4f3f743f93827adc2b2914a | Python | 8,072 | 250 | # -*- coding: utf-8 -*-
#
# Mushu documentation build configuration file, created by
# sphinx-quickstart on Tue Jun 25 10:06:49 2013.
#
# 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.
#
# All c... |
218cab343f6c143129afdfda38273284e29269779a715ee4691b0c3d85f4f137 | Python | 8,074 | 224 | # 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... |
6e99833f74a97097a6228c8ae9f79b4962a4b3fce288e7bd1102fb63ff4d6435 | Python | 8,074 | 271 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# ------------------------------------------------------------------------------
from __future__ import absolute_import
from __future__ import d... |
4deb8d2d94da414b097c4046a55d6e97b260c16e0401ca9056203a294bed1b6d | Python | 8,075 | 139 | import argparse
import os
from util import util
import torch
import models
import data
class BaseOptions():
"""This class defines options used during both training and test time.
It also implements several helper functions such as parsing, printing, and saving the options.
It also gathers additional opti... |
ce02d24af8ddbac45103a4b0c90f4867a80d80b3d9fb7aa69b0507dc770e12e7 | Python | 8,075 | 234 | """
This is the Learning Through Target Bursts (LTTB) repository for code associated to the arXiv 2201.11717 preprint paper:
Cristiano Capone*, Cosimo Lupo*, Paolo Muratore, Pier Stanislao Paolucci (2022)
"Burst-dependent plasticity and dendritic amplification support target-based learning and hierarchical imitation... |
08b761290648610c0427c634ad0404c3fb026da049b5ca28d92c927d309f89a8 | Python | 8,076 | 221 | from typing import Dict, List, Optional, Tuple, Union
from PIL.Image import Image
from torch import Tensor
from lightly.transforms.gaussian_blur import GaussianBlur
from lightly.transforms.multi_crop_transform import MultiCropTranform
from lightly.transforms.rotation import random_rotation_transform
from lightly.tran... |
0e3685d0b4ce3e6e663359bc04a6b1220bc2501459b865c20a17dcc753ff536d | Python | 8,077 | 256 | """Command-Line Interface Helpers"""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
from __future__ import annotations
import os
from typing import Any, Callable, Mapping
import hydra
import torch
from hydra import utils
from torch import nn as nn
from lightly.cli._cli_simclr import _Sim... |
3f28dbe2591e200d87b6e9722dc7556879862ad5e4037b5ac4d979cd52f05aff | Python | 8,078 | 230 | # coding=utf-8
# Copyright 2023 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
2c6373ee9b5119e914ae3b0f61557ddf9acee37250712cc0719857342ecd107b | Python | 8,080 | 218 | from unittest.mock import Mock, call, patch
import pytest
from celery import states, uuid
from celery.backends import cosmosdbsql
from celery.backends.cosmosdbsql import CosmosDBSQLBackend
from celery.exceptions import ImproperlyConfigured
MODULE_TO_MOCK = "celery.backends.cosmosdbsql"
pytest.importorskip('pydocume... |
2945432d809f63bcc725eec538a5008b01ef586aca2abee8abfe018e596c7cf7 | Python | 8,083 | 206 | """
04: Periodic Component Fitting
===============================
Choosing and using different modes for fitting the periodic component.
"""
###################################################################################################
# Import the model object
from specparam import SpectralModel
# Import fun... |
68fdd73afefa9eb7825349a7339c176e189b4f749cfb385b4d028b013b1dc16e | Python | 8,083 | 246 | """Unit tests for the firmware management module."""
import os
import tempfile
from unittest.mock import MagicMock, patch
import pytest
from ethoscope.hardware.interfaces.firmware import (
FQBN_MAP,
_get_fqbn,
get_source_firmware_version,
is_arduino_cli_available,
parse_running_firmware,
)
clas... |
183a12e568c2b3600711d44b3d8657292544625205296853ef98dfa99106f21f | Python | 8,085 | 254 | """Example of using pyguppy_client_lib with read until"""
import argparse
import logging
from pathlib import Path
import sys
import time
import grpc
import numpy as np
from read_until import AccumulatingCache, ReadUntilClient
try:
from pyguppy_client_lib.pyclient import PyGuppyClient
from pyguppy_client_lib.... |
6bd8446a5633914c4f3ec7a9cc700ad93812ea4159e71f970dac2d1aea0e0bed | Python | 8,086 | 197 | """Blob framing: index a PBF file's blobs and read/decompress one ``PrimitiveBlock``."""
import os
import struct
import zlib
from operator import itemgetter
import numpy as np
from pyrosm.exceptions import InvalidOSMFileError
from pyrosm.proto.fileformat_pb2 import BlobHeader, Blob
from pyrosm.zlib_blob import MAX_B... |
414dd95bd3cb89c173323a03f943d67d5e87196531a5eed8cb1ec64b04d2af3b | Python | 8,087 | 271 | import rpy2.robjects as ro
import rpy2.robjects.conversion as conversion
import rpy2.rinterface as rinterface
import rpy2.rlike.container as rlc
from rpy2.rinterface import (Sexp,
StrSexpVector, ByteSexpVector,
RTYPES)
import numpy # type: ignore
# TODO: move ... |
39561258b705db1262b1c4e0f9476838c24c60fa22016ff3e216b61270fb1f5f | Python | 8,089 | 254 | import argparse
import pickle
import random
import time
import numpy as np
from Bio import SeqIO
from sklearn.model_selection import StratifiedKFold
def load_args():
parser = argparse.ArgumentParser(
description="Script to create synthetic DNA for prediction"
)
parser.add_argument(
"--see... |
8eb6961e7e32b58bcc9e35f225e3d950f6144ebd8ad9946f8a4d5355c284d6d8 | Python | 8,090 | 259 | from __future__ import annotations
import pytest
import env # noqa: F401
from pybind11_tests import local_bindings as m
def test_load_external():
"""Load a `py::module_local` type that's only registered in an external module"""
import pybind11_cross_module_tests as cm
assert m.load_external1(cm.Extern... |
3b45813086afa3a068a5a7d912f7e05707e1812795068abd0750e93599d827ff | Python | 8,091 | 240 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Test objects and function in the module ``tfep.potentials.ase``.
"""
# =======================================... |
632ffe615d86c218751b1b5db9c5692c422cea81e5bf00044ef9bb2bbed70976 | Python | 8,093 | 194 | """FCM cross-check cells (torchnative 6.4 / W2.6-W2.7).
Three CPU cells because FCM's CPU attention coverage is an ``attn_pdrop``
ARTIFACT, not a phase property (dropout 0 -> fused CPU flash path -> zero
attention FLOPs, in train mode too):
1. Default backend: native counts ZERO for fused CPU SDPA (the missing
``f... |
f78baa5ec39a2adf7577d856e73e99a69666352b3f9ceeba478ba2c2172be15d | Python | 8,094 | 211 | """Wheels support."""
from distutils.util import get_platform
import email
import itertools
import os
import posixpath
import re
import zipfile
import pkg_resources
import setuptools
from pkg_resources import parse_version
from setuptools.extern.packaging.utils import canonicalize_name
from setuptools.extern.six impo... |
5f628cf0dbf569cc0cd2e0fb9fdb3da61b33a6931e14a44bf35f0f6c4856b456 | Python | 8,097 | 230 | import os
import sys
from dataclasses import dataclass
from typing import List, Tuple, Dict
import numpy as np
import pandas as pd
import anndata as ad
from scipy.sparse import csr_matrix
from anndata import AnnData
# * configs
tscc_path: str = "/projects/ps-renlab2/szu/projects"
allen_dir: str = os.path.join(tscc_pa... |
64e213816bc9db3766152aa1498bd96b6bdbc5d6b68dd278f2337eeeb555a786 | Python | 8,097 | 223 | """F08 charset contract: canonical ASCII, degrade map, detection ladder.
Summary memo 3.9: ``str(result)`` is byte-stable ASCII with no ANSI/OSC-8
bytes; unicode appears only at explicit display boundaries; the two
renders differ ONLY through the declared 1:1 glyph table (CI-checked
byte-for-byte here); detection fail... |
76db91677670ca6a5dab2f96a1ce325022ab6be2402a5afeada3311c4f007778 | Python | 8,097 | 240 | """
OIDC Authentication helpers for the CodeCarbon CLI.
Handles the full token lifecycle: browser-based login (Authorization Code +
PKCE), credential storage, JWKS validation, and transparent refresh.
"""
import json
import logging
import os
import webbrowser
from http.server import BaseHTTPRequestHandler, HTTPServer... |
de7b51fe28f6f8bab504acd40f6bbbe2c1ed7ebab48d40425b406ac5c426e3ff | Python | 8,097 | 212 | #!/usr/bin/python
#-*-coding:utf-8-*-
# 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... |
2afb43cb5e6eeffe7279eddc710563a1837ddca5fe7c53af257e94008015cda1 | Python | 8,098 | 231 | """Transforms relate to hamming distance sampling."""
import random
import numpy as np
from bioseq2seq.constants import DefaultTokens
from bioseq2seq.transforms import register_transform
from .transform import Transform, ObservableStats
class HammingDistanceSampling(object):
"""Functions related to (negative) Ham... |
8008c5ebb1fd8f98867bd3de361c65e983c23f6215bb6b1350a6b7f9443e0113 | Python | 8,098 | 235 | #!/usr/bin/env python
# coding: utf-8
import sys
import numpy as np
import pandas as pd
import matplotlib
from matplotlib import gridspec
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from scipy.stats import gaussian_kde, linregress
from mpl_toolkits.axes_grid1 import make_axes_locatable
class DensityPlot():
... |
505d21d5073e8448cddd3dbb590a399203c71dd804a9955cb13dd914782e82e6 | Python | 8,099 | 249 | # --- 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 = "scattersmith"
_path_st... |
5d034f8723c992865b8fbbd173938392fdeadc9912c9cf3e0a0a3fa25a799d99 | Python | 8,099 | 249 | # --- 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 = "scatterpolar"
_path_st... |
06d5874f3904496494f7de0c364cc4b5d9e6b3ed27ea5d0fbc17f3873ef8deac | Python | 8,102 | 205 | #!/usr/bin/env python3
"""
Dx AS — deduplicated 5-cohort sensitivity analysis (drop ds006036)
====================================================================
ds004504 and ds006036 contain the same 88 Miltiadous AHEPA participants
under different EEG paradigms (resting EC vs photic stimulation). For
the LOCO desig... |
48cd56e05cdaf2b6326ef40cdad11cd25b4b7abca7c4c3e57f4b1f69393453a6 | Python | 8,103 | 277 | import matplotlib
import networkx as nx
import numpy as np
from anndata import AnnData
from matplotlib import pyplot as plt
from numpy._typing import NDArray
from stlearn.pl.utils import get_cluster, get_node
from stlearn.utils import _read_graph
def pseudotime_plot(
adata: AnnData,
library_id: str | None = ... |
9f0a5a452855f01b250a22af1fa315171834ecd541701106ac756f9e232d3c91 | Python | 8,103 | 242 | import json
import os
import random
import h5py
import numpy as np
import pandas as pd
import tensorflow as tf
binary_ce = tf.keras.losses.BinaryCrossentropy()
binary_acc = tf.keras.metrics.BinaryAccuracy()
categorical_ce = tf.keras.metrics.CategoricalCrossentropy(from_logits=True)
def read_file(file_path):
"""... |
ac326a2d5cd96a574ade6f00f558b8004406379d049a2cfd5d8feac585eb830d | Python | 8,103 | 202 | """Learning rate policy
Gradually warm-up(increasing) learning rate for pytorch's optimizer.
Proposed in 'Accurate, Large Minibatch SGD: Training ImageNet in 1 Hour'.
Code adapted from https://github.com/ildoonet/pytorch-gradual-warmup-lr
"""
# pylint: disable=missing-function-docstring, line-too-long, inconsistent-ret... |
01a7add81df5f4d7dfdfa742d1c1020812250f174bacecb358999a7a85dc000d | Python | 8,104 | 249 | # --- 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 = "scattercarpet"
_path_s... |
37d4212890bae8e3e4c9dc81e8e8a9bf0dd0852b049b74a5a22463622ab31a08 | Python | 8,104 | 229 | """
App configuration and static reference data loading.
Static CSV/JSON reference data is loaded lazily on first DataSource access
to keep `import codecarbon` fast for measurement startup.
"""
from __future__ import annotations
import atexit
import json
from contextlib import ExitStack
from importlib.resources impo... |
defe9b36fbcc24b9445cc3390c2e62f9d094a2c73e47a5cd0fff19c2cc79e90c | Python | 8,105 | 196 | """F06 B5: the direct input occlusion map (attrib memo D8-D9).
Window geometry (clipped-edge full coverage), overlap combination modes,
replacement-policy seam, per-example vs aggregate deltas, the full-window
self-oracle against a direct two-forward difference, and the deterministic
pass-budget refusal carrying the a... |
5b625593fdf74821a68545a3915192635c3c31a3d60c0c2e6be844d3f8419480 | Python | 8,106 | 252 | import warnings
import numpy as np
from scipy.signal import find_peaks
from . import utils
from . import tools
def get_onset_idx(s, min_ds=1.9, s_thresh=10, peak_divisor=2, method="peaks", debug=False):
"""
Get the index at the beginning of the uprise of the signal
Parameters
----------
s : 1D ... |
165340c25836d7718881d4aa26d1c5d1ce7da8f86314b2ae3c9221e1d1655e7f | Python | 8,107 | 144 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'video_control_ui.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_VideoControlWidget(object):
def setupUi(self, VideoControlWid... |
1e23696d29d18fb258ac2d9a18291dc4a73ddb0e30a864fa976f74fd87ad2336 | Python | 8,107 | 222 | """MGNO: Multipole Graph Neural Operator.
Li et al., 2020.
Paper: https://arxiv.org/abs/2006.09535
Source: https://github.com/zongyi-li/multipole-graph-neural-operator
MGNO uses a MULTI-LEVEL GRAPH KERNEL (multipole method) for neural operator learning.
Inspired by the fast multipole method (FMM), it builds a hierarc... |
3df4f0684be7dbc47887218f344838a8510b6be0c4275df22cc6fe4170b1f5b7 | Python | 8,109 | 272 | from __future__ import print_function, unicode_literals, absolute_import, division
import os
import numpy as np
import json
import collections
import platform
import random
from six.moves import range, zip, map, reduce, filter
from .six import Path
###
def is_tf_backend():
from .tf import BACKEND as K
retur... |
47b37755b5efbbf5cafd0bd9f25a203cede7d4e2da551c25d49e6342c9e34083 | Python | 8,109 | 249 | # --- 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 = "scatterternary"
_path_... |
800b757e366ce3de9906fd6295383d16db2758c99025a20c84813bf4b3cba10b | Python | 8,110 | 187 | #!/usr/bin/env python3
"""
File: prepare_sceqtlgen_eqtl_files.py
Created: 2024/01/17
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... |
c8ccef165c4c730f43204e07ab5ea64708ceaffbb64f8171cf1023b84c374222 | Python | 8,111 | 198 | from __future__ import absolute_import, division
from tqdm.auto import tqdm
import torch
import torch.nn.functional as F
from trainingUtils import MultipleOptimizer, MultipleScheduler, compute_kernel, compute_mmd
from models import Decoder, SimpleEncoder,LocalDiscriminator,PriorDiscriminator,Classifier,SpeciesCovariate... |
24195ffdde7af720eb4eb6d8d0acd346782aae854c4d0f91f42b9d03737d07d7 | Python | 8,114 | 228 | import numpy as np
import pandas as pd
import utils.NMR_Pretrain_Setup as nmr
from neural_nets.NMR_4ll_Net import NMR_MPNN
from torch.utils.data import DataLoader
import os
import argparse
import torch
from torch.utils.tensorboard import SummaryWriter
import logging
# C : 273,322 0 : 52,511 N : 24,629 S : 4,886 ... |
556d41f483ffaaee73ea5fac3658bca96c2ada2fc22aea4d3ae0ce2aac3d6e03 | Python | 8,115 | 202 | # 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... |
97a4d04feaeb7215480efedb93a9dab1566fef22b39df63a886097a6215662eb | Python | 8,115 | 202 | # SOURCE: vendored from drumichiro/selfie-segmentation-pytorch @ master (d7450bbc)
# https://raw.githubusercontent.com/drumichiro/selfie-segmentation-pytorch/master/selfie_segmentation.py
"""MediaPipe Selfie Segmentation model (PyTorch re-implementation faithfully matching
Google's MediaPipe TFLite graph topology, laye... |
9a8f9668fca8be0fcf3849233d243ece5929d3b5ac435c0dbf45e260a4c9f847 | Python | 8,115 | 267 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Interfaces for working with resting-state fMRI data.
.. testsetup::
"""
import os
import shutil
import pandas as pd
from nipype import logging
from nipype.interfaces.afni.preprocess import Despike, D... |
044ee04d16a05434aaf8c715654d491615605d9ad1d25d669bf3b8d7b8f9b697 | Python | 8,116 | 268 | import cffi
import ctypes
import numpy as np
import platform
import os
from copy import deepcopy
from glob import iglob
def _init_libwkw():
this_dir = os.path.dirname(__file__)
path_wkw_header = os.path.join(this_dir, "lib", "wkw.h")
lib_name_platform = {
"Linux": "libwkw.so",
"Windows": ... |
1de7a31b616db76d02340cdf6a28aa4b08fb87f2fdbfc0f0115929e68373048a | Python | 8,116 | 234 | """Predefined network filters.
Each filter is an "exclude" dict of ``{osm_key: [values]}``: a way is dropped when it
carries one of the listed values for that key. The filters follow the way filters of
OSMnx (``osmnx._overpass._get_network_filter``) closely and in most cases select the same
ways, with the OSMnx regula... |
51e9cd7e301124f989f770f8cb7898dd68af2e5ca4cd48089b2e08e972ed70df | Python | 8,116 | 181 | import numpy as np
import logging
from cuteSV.cuteSV_genotype import overlap_cover, assign_gt
import pickle
'''
*******************************************
TO DO LIST
*******************************************
1. Identify DP with samfile pointer;
2. Add CIPOS, CILEN and/or CIEND;
3. Determ... |
76c147d8c5907209b0f285a7230b187385de9f6ee02b25dd042e559c93088c3f | Python | 8,116 | 170 | import copy
from typing import Unpack
from mirp.settings.feature_parameters import FeatureExtractionSettingsClass
from mirp.settings.general_parameters import GeneralSettingsClass
from mirp.settings.image_processing_parameters import ImagePostProcessingClass
from mirp.settings.transformation_parameters import ImageTr... |
87e34cc1f0253de88c9403500f53c79b7992fa5ee95a750272f11c0985946c3c | Python | 8,116 | 143 | import argparse
import os
from util import util
import torch
import models
import data
class BaseOptions():
def __init__(self):
self.initialized = False
def initialize(self, parser):
"""This class defines options used during both training and test time.
It also implements several hel... |
26acc9ee1c5dedb6fc247753745e43959d5eb387c88ae39e2e68746708909d9e | Python | 8,117 | 218 | """A Sphinx extension for linking to your project's issue tracker.
Copyright 2014 Steven Loria
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation th... |
f632a6b49fb571b088d82dcb0cc4e7515d4326f1ad89f5037cf416cbd4a81bb2 | Python | 8,117 | 219 | '''
The plug-and-play running new molecules on LSF. Input should be a dataframe with the correct columns.
'''
import pandas as pd
import numpy as np
import torch
import argparse
import utils.MPNN_setup as ms
import utils.NMR_Pretrain_Setup as nmr
import utils.df_setup as ds
from neural_nets.Final_LSF_Net import LSF_M... |
1e463f0875b843ac3ad0f33178ffa894190f3829f3a8542fde811af86ebb7298 | Python | 8,118 | 195 | # Install the newest triton version with
# pip install "git+https://github.com/openai/triton.git#egg=triton&subdirectory=python"
import pickle
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange, repeat
from flash_attn.utils.benchmark import benchmark_all, bench... |
3fb3b7ce573f288e9f56bcdf7df31bb72d9152eb5b30628ec78f719c545e1ec0 | Python | 8,118 | 249 | import tempfile
from pathlib import Path
import numpy as np
import pytest
from neurogym.config.config import Config
from neurogym.core import TrialEnv
from neurogym.utils import spaces
from neurogym.utils.functions import iso_timestamp
from neurogym.wrappers.monitor import Monitor
class DummyEnv(TrialEnv):
"""S... |
f47c36ea6f15d37717795c90230bd43d3adc98dacee6b181551c8cc10098edca | Python | 8,119 | 210 | """
====================================================================
Comparison of pipelines for transfer learning
====================================================================
We compare the classification performance of MDM on five different strategies
for transfer learning. These include re-centering the... |
4ee3b3c6b6c2b5de8401a99752eec28d5d3688ae09c0a87b9eeaa3e0be386eb9 | Python | 8,120 | 437 | #!/usr/bin/env python
'''Generate models for affinity predictions'''
# variables (for first layer only):
# grid resolution: 0.25, 0.5, 1.0 # no 0.125 for now - blobs require small batch size
# convolution: none, 2x2 (stride 2), 4x4 (stride 4), 8x8 (stride 8)
# convolution can have activation function after it or n... |
e087daf2b950e316f59a6d5f5ac82ad2c64a6c48e7e8b2333d584e0ef41844f7 | Python | 8,120 | 262 | import numpy as np
class Diagnosis(object):
"""
A class to represent the diagnosis given for one patient
Attributes
----------
class_attribute : string
Value in classification attribute
methylation_class : string
Methylation class as obtained by EPIC
methylation_class_score... |
e7adbb3c9c5907e8fd2927d5be0ea03a28b91a8015a754fc589fb8ce61235d32 | Python | 8,120 | 155 | # Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com)
# PLUS
import os
import sys
import argparse
import torch
import plus.config as config
from plus.data.alphabets import Protein
import plus.data.secstr as secstr
import plus.data.dataset as dataset
import plus.model.plus_rnn as plus_rnn
import plu... |
57ee9db1fb4dad8da56fb65eb0e1d720ea0f42de530dbdc7f80f74f490bb8015 | Python | 8,122 | 222 | import glob
import os
import sys
import numpy as np
import tifffile as tf
from qtpy import QtCore, QtGui
from qtpy import QtWidgets as QtW
from llspy import camcalib
from llspy.gui.camcordialog import Ui_Dialog as camcorDialog
from llspy.gui.helpers import newWorkerThread
from llspy.util import getAbsoluteResourcePat... |
d22b90bf1bdd892936590c3fb989d23162ec6c22a41ea608e7cb1aa2c879d3c9 | Python | 8,122 | 252 | # SOURCE: vendored from facebookresearch/drqv2 @ main
# https://github.com/facebookresearch/drqv2
# File vendored near-verbatim: drqv2.py (RandomShiftsAug, Encoder, Actor, Critic) plus the
# `weight_init` / `TruncatedNormal` / `schedule` helpers from utils.py that the model classes
# depend on directly. `hydra`/`omegac... |
2a58a208a849d5070ad476eca5cb6034ec79ce0d97eb031fc95f2f8f135dfe84 | Python | 8,124 | 202 | '''
Sweep of hyperparams
* Bajar el número de iteraciones y layers
author: obanmarcos
'''
import os
import os, sys
from config import *
sys.path.append(where_am_i())
import lightning as pl
import argparse
import pickle
import numpy as np
import matplotlib.pyplot as plt
from utilities import dataloading_utilities as... |
4c0793fbef8e3a906e6c7bfff3353b0d50fce54464d2b6a92d08796948f29836 | Python | 8,124 | 306 | __author__ = 'quentin'
import cv2
import numpy as np
import itertools
from ethoscope.tracking.cameras import MovieVirtualCamera
from ethoscope.tracking.trackers import BaseTracker, NoPositionError
from ethoscope.tracking.roi_builders import DefaultROIBuilder
cam = MovieVirtualCamera("/stk/pysolo_video_samples/represen... |
50db08de2f2efb4dc7a073eebb5356e8b844ba37b35561f9fac1a6d7a698e87f | Python | 8,124 | 192 | #!/home/ubuntu/miniconda2/bin/python
from __future__ import division
import sys
import glob, os, gc
import uuid
import os.path
import csv
import numpy as np
from time import time
from subprocess import (call, Popen, PIPE)
from itertools import product
from PIL import Image
import shutil
import re
import xml.etree.Eleme... |
9bd0555770f2e3e2a5efc5809f4005417d88315bb340034b49043ea05f0da685 | Python | 8,124 | 242 | #!/usr/bin/env python3
"""
File: visualise_cell_fractions.py
Created: 2020/11/24
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 tre... |
ded870959fdd9ff0d166bc8e33dd1d73589ebf8bf24d31bba3090d981368d139 | Python | 8,125 | 242 | """Code for W-MSE Loss, largely taken from https://github.com/htdt/self-supervised"""
from typing import Callable
import torch
import torch.nn as nn
import torch.nn.functional as F
# torch.linalg.solve_triangular is only available in PyTorch >=1.11.
_SOLVE_TRIANGULAR_AVAILABLE = hasattr(torch.linalg, "solve_triangul... |
390eedfb8b819f284b1e67d7347aa38469f9cf2d72f8a6b060b4c658b809449b | Python | 8,127 | 205 | import matplotlib.pyplot as plt
from typing import Literal, List
plt.rcParams['patch.force_edgecolor'] = True
import tensorflow as tf
print("tf.version: ", tf.version.VERSION)
print("tf.keras.version: ", tf.keras.__version__)
print("tf.config.devices: ", tf.config.list_physical_devices())
# tf.compat.v1.enable_eager... |
996afba58a883923ee21b1388b4196455920151c594c08e43aaabd5bf129bad4 | Python | 8,127 | 172 | from typing import List, Tuple, Dict
import numpy as np
from numpy.core._multiarray_umath import ndarray as arr
from angorapy.common.senses import Sensation, stack_sensations
class ExperienceBuffer:
"""Buffer for experience gathered by a single worker."""
def __init__(self, capacity: int, state_dim: Dict[s... |
258f01ef687cf9c5a9537228cca87ad92c7e48ce6f23cf51a538ec6f81b4c205 | Python | 8,129 | 205 | import os
import pickle
import wave
import contextlib
import subprocess
import sys
import torch
from torch.utils.data import DataLoader
import numpy as np
import time
from deep_audio_features.bin import basic_training as bt
from deep_audio_features.bin import basic_test as btest
CLASS_MAPPING = {
0: 'alternate... |
d27b97ffb8b1e354bc48fb60257f496f8e4d6c4b838d3f6ca205ccaa9b097e6d | Python | 8,129 | 203 | #!usr/bin/env python
import os
import pandas as pd
from tqdm import tqdm
import argparse
from sqlalchemy import create_engine
from sqlalchemy_utils import create_database, database_exists
import sys
def build_hic_tables(cell_line, enzyme, fp, db_auth, mapq_cutoff, tblspace):
db_url = ''
cell_line = cell_line.... |
fd21aafb4124d769722960a7c28721896669dc8fa880bda610bea0c3009314dd | Python | 8,129 | 223 | """
ROI Template API Module
Handles ROI template management including listing, uploading, and deployment
to devices. Supports both built-in and custom templates.
"""
import hashlib
import json
import os
import bottle
from .base import BaseAPI, error_decorator
class ROITemplateAPI(BaseAPI):
"""API endpoints fo... |
a158a5d42cb41c4f027e3bc4e625d98818c7e6d830a75c61de4a07fabf909746 | Python | 8,130 | 190 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... |
d3245150504b06536cf6c74e5e86bb915ea63b1677729b4494167dda399a0e0f | Python | 8,131 | 234 | """
This is the Learning Through Target Bursts (LTTB) repository for code associated to the arXiv 2201.11717 preprint paper:
Cristiano Capone*, Cosimo Lupo*, Paolo Muratore, Pier Stanislao Paolucci (2022)
"Burst-dependent plasticity and dendritic amplification support target-based learning and hierarchical imitation... |
b08cf78e35aaab8c376a92c40e2b7a6497d069c6518821a894506902fbe4b3c4 | Python | 8,133 | 209 | import os
import numpy as np
import nibabel as nib
from os.path import join as pjoin
from scipy.stats import pearsonr, permutation_test
from cxy_visual_dev.lib.predefine import proj_dir, Atlas, get_rois,\
s1200_avg_angle, s1200_avg_eccentricity, LR_count_32k,\
mmp_map_file, s1200_avg_R2
from magicbox.io.io impo... |
67a7219cefc3015d1eb00fa79b25b49afe2c266bdcf0c712a64c2706ce84f4cb | Python | 8,140 | 192 | import numpy as np
import tensorflow as tf
from tensorflow import keras # use tf.keras
from tensorflow.keras.layers import ( # UpSampling2D, Conv2DTranspose
Activation, BatchNormalization, Conv2D, Dense, Dropout, Flatten, Input,
Layer, MaxPool2D, Reshape)
from tensorflow.keras.losses import binary_cross... |
65951f634cb7c6f4c30c86c8af956e33b81549abcdd2d774a5fa60d429cace97 | Python | 8,141 | 202 | '''
Sweep of hyperparams
* Bajar el número de iteraciones y layers
author: obanmarcos
'''
import os
import os, sys
from config import *
sys.path.append(where_am_i())
import pytorch_lightning as pl
import argparse
import pickle
import numpy as np
import matplotlib.pyplot as plt
from utilities import dataloading_util... |
fe01edde68b6e566bc978f4923978b6d3e2394ec9def80e55214f3ce9e7b9eb4 | Python | 8,141 | 220 | """
File: ieqtl.py
Created: 2021/04/08
Last Changed: 2021/12/09
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.
"""
# Standard imports.
# T... |
09667dd0a3d3b25f413181c149193c5e5e267f4581150176adf3b66eca2e0580 | Python | 8,144 | 185 | #!/usr/bin/env python3
"""
File: prepare_bios_phenotype_matrix.py
Created: 2021/11/10
Last Changed: 2022/03/18
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... |
9d71b128959fbff1c4e387c4c0631ebf7751cffbdb911be322a2011f96f3fae5 | Python | 8,144 | 261 | """
===============================================================================
Classifier comparison
===============================================================================
A comparison of several classifiers on low-dimensional synthetic datasets,
adapted to SPD matrices from [1]_.
The point of this examp... |
3e9d2b955b14b02aa8ca46f389e5c3c5fd87ac7e12346688d531881769461938 | Python | 8,146 | 262 | # 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 of conditions and the f... |
2103c4c8877e5c76f56f07fab6ca26ec0a54a8a93c842a726f9efb12c2d8ae38 | Python | 8,147 | 249 | from collections.abc import Sequence
from plotly import exceptions
def is_sequence(obj):
return isinstance(obj, Sequence) and not isinstance(obj, str)
def validate_index(index_vals):
"""
Validates if a list contains all numbers or all strings
:raises: (PlotlyError) If there are any two items in th... |
1fc14c782d4f46d8bef3f63a444af52c885e479ac1cf11c779f6dbe4790ba0ad | Python | 8,149 | 211 | """Observe items 7-8: saved-band decomposition + trace-global first-save identity.
The parameter phantom: most of the bytes autograd retains on real models are
PARAMETER storages already counted in the parameter band, so a naive
parameter+autograd_saved stack double-plots them. The storage-class
decomposition (saved_p... |
e5f397e88815586af0876978018e607c57666945a79464bd9638a5c3ccf77015 | Python | 8,150 | 160 | """
五队列基线特征表 —— 派生,不誊抄。
动机(Reviewer 2 / M5):Table 1 只报 n,没有年龄、性别、批次、采血时点、合并症。
而"负对照"要成立,必须让读者看到四个队列**在与结论相关的轴上可比**——
尤其 PAD000016 是与其余队列性别构成完全不同的人群。
原则与 cohort_counts.py 一致:能算的不抄。三个队列的部分字段在公共沉积里
**确实不存在**(GSE169148 的 GEO 记录只给 subject status / treatment / tissue;
PAD000016 的 SDRF 无年龄与性别字段;Filbin 元数据无性别列),本表如实写
"not re... |
8961e5d2aa31b6390cb240c938f8e87da14e81275d628441211e710cec825148 | Python | 8,153 | 209 | """Ecosystem runtime: the compat ledger, pair-consistency, and remedies.
Lane F32 row gate: the REMEDY-ACTUALLY-LOADS test (ecosystem MEMO 3.1/G6)
lives here -- every ledger row whose ``bridge_reader`` is the CURRENT
runtime has its goldens actually loaded by this suite on every run, so no
refusal remedy can ever agai... |
32d3922483be4a19bb023b29aff12687ee68ab50de5e3df053915a91c2669be9 | Python | 8,156 | 301 | """Round-20 state TOCTOU sampling and buffer-slot attestation regressions."""
from __future__ import annotations
from pathlib import Path
import numpy as np
import torch
from torch import nn
import torchlens as tl
from torchlens.options import CaptureOptions
from torchlens.runnable import NumericAttestationStatus, ... |
71379f5fd08a747115f67c0b54b1c1f412d86d9ef77afbef78992a08a0dc8f74 | Python | 8,160 | 149 |
"""
Model definitions for the four networks evaluated in Baumgartner et al.,
"Real-Time Detection and Localisation of Fetal Standard Scan Planes in 2D
Freehand Ultrasound", arXiv preprint:1612.05601 (2016).
Author: Christian Baumgartner (c.f.baumgartner@gmail.com)
Last Update: 14. March 2017
"""
from lasagne.layers ... |
62b4dc2477a0b93ec470bcc9059f3821ca664f690f1735d7d6adcd9efb87e577 | Python | 8,162 | 259 | """
Configuration of the dataset enrichment pipeline.
Groups the preprocessing, processing and annotation settings that
:meth:`LarvaDataset.enrich` applies, so that a whole pipeline can be stored
and replayed as one configuration.
"""
from __future__ import annotations
from typing import Any, Optional, Sequence
impo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.