sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c90f02aa33b69b33253ea5e19c4608b348fa6c2bccdfbab2fce7a2142b435670 | Python | 6,433 | 172 | import importlib.resources
import nanite
from PyQt6 import uic, QtCore, QtWidgets
from .mpl_qmap import MPLQMap
from ..head.custom_widgets import show_wait_cursor
class QMapCache:
"""Caches QMap data based on AFMGroup paths"""
_cache = {}
@staticmethod
def get_qmap(fdist_group):
path = fdi... |
41b3c8402683eb25c23b7c8ec1df2356507fb8be616e71cbd1c31c9563592fb8 | Python | 6,434 | 211 | """Utility functions for gym spaces: batch space and iterator."""
from collections import OrderedDict
from copy import deepcopy
from functools import singledispatch
from typing import Iterator
import numpy as np
from gym.error import CustomSpaceError
from gym.spaces import Box, Dict, Discrete, MultiBinary, MultiDiscr... |
c63792f33944472e89039080da0b9ef2302d83e1fc4edc74aef8b5aceba7066f | Python | 6,434 | 208 | #
# impose documentation build configuration file, created by
# sphinx-quickstart on Tue Sep 26 17:55:31 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.
#
# All configuration values h... |
6dec6782ee06379fd09f3466a876d14e073bc5fcd7836ce51638b6be826ba278 | Python | 6,435 | 196 | import torch
import torch.nn as nn
import matplotlib.pyplot as plt
import numpy as np
class Evalulate:
def __init__(self, x, y, istart, istop, case_num):
# x:预测结果 y:label len:样本长度
self.len = case_num
self.case_num = case_num
self.x = x[:self.len]
self.y = y[:self.len]
... |
60f319ed5b87d35ae6b66bfc14cd5193f53ad60fce16658355e9b24e24f418b8 | Python | 6,436 | 185 |
import unittest
from command_utils import load_arguments
import os
import bleualign
import io
from bleualign.align import Aligner
from test.utils import Utils
class TestByEval(unittest.TestCase, Utils):
def setUp(self):
pass
def test_originalFileName(self):
self.main_test('fileNameOptions', remove_file = 'remo... |
0d755fa2ba9f41d2953e10fb1ecb481ede235b6f65ba7bb360e73f38f4b44408 | Python | 6,437 | 153 | """A normalization whose affine weight is all zero cannot see its input.
timm's ``zero_init_last`` zero-initializes the last GroupNorm of each residual
block, so untrained ``resnet50_gn``, ``regnety_040_sgn`` and
``vit_small_r26_s32_224`` failed perturbation at a ``group_norm`` whose input
edge provably cannot change ... |
aa70150e39b2078782bf7c26f99f5d65eceac64ab43556267a36f9f76d29bd02 | Python | 6,437 | 224 | from mpl_toolkits.mplot3d import Axes3D
from matplotlib.patches import FancyArrowPatch
from mpl_toolkits.mplot3d import proj3d
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
import pandas as pd
import matplotlib
import numpy as np
import networkx as nx
from stlearn._compat import Literal
from ... |
4afd36da242ede0775d7a926e2af2bc7f5758c3bad29138fe09f66aa882b5740 | Python | 6,438 | 187 | # -*- coding: utf-8 -*-
"""**Lightly SSL Train:** Train a self-supervised model from the command-line.
This module contains the entrypoint for the **lightly-ssl-train**
command-line interface.
"""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
import copy
import os
import warnings
import ... |
d8791b4a0e07aca3117f9f3b49063a1ee9f2f0a78e734e0d37d472fda96ea761 | Python | 6,438 | 151 | import sys
import tensorflow as tf
import tensorflow.compat.v1 as tfv1
from .flags import FLAGS
from .logging import log_info, log_error, log_warn
def _load_checkpoint(session, checkpoint_path, allow_drop_layers, allow_lr_init=True):
# Load the checkpoint and put all variables into loading list
# we will exc... |
f074ec2dad150e419cee0b497a5f992c7189f9b9b84ea8fe2eb6efad58735046 | Python | 6,440 | 185 | from tqdm import tqdm
import numpy as np
import pandas as pd
import rdkit
from rdkit import rdBase, Chem, DataStructs
from rdkit.Chem import MolStandardize, AllChem, Descriptors
from collections import defaultdict
import pickle
from utils.kinase_dataset import get_smiles
from utils.result_rename import set_ran... |
52a7f7a94fb238edd796077e79aa8e9188064bcdee603be99a09e3307a9ab309 | Python | 6,441 | 191 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: University of Zurich
# Author: Rico Sennrich
# For licensing information, see LICENSE
# Evaluation functions for Bleualign
from __future__ import division
from operator import itemgetter
def evaluate(options, testalign, goldalign, log_function):
goldalign ... |
96d88c567cec6fe1b3386c2d96080a9ced8c7bd8f2b6cf6f5d2b073330841081 | Python | 6,441 | 182 | import numpy as np
from gates import minisog_inf, aox_inf, rotenone_inf
import matplotlib.pyplot as plt
from matplotlib import colors
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
from matplotlib.ticker import LogLocator, NullFormatter
from palettable.cartocolors.sequential import Burg_5
from ... |
45adbd71cface308fb835e16e021584d1693c6764905fc3019f1d7d26b75a646 | Python | 6,442 | 189 | """Safe one-call execution (A4) and lazy-module entry (A9).
Lane A07 (2026-08-27). Spec: the summary design memo build items 5-6.
"""
from __future__ import annotations
import hashlib
import pytest
import torch
from torch import nn
import torchlens as tl
def _state_dict_digest(model: nn.Module) -> str:
"""By... |
9e4b2ae89253f4648914976db489210d910d4570d1c90ecda11693e595af9d80 | Python | 6,442 | 153 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from copy import copy
from typing import Any
import numpy as np
import torch
from ultralytics.data.utils import add_polygon_background
from ultralytics.models import yolo
from ultralytics.models.yolo.detect import... |
182286f8ab99ac56f4a1a95b7a9f2a775c1e8e5febefe515f874ecae5e470580 | Python | 6,443 | 182 | import numpy as np
from gates import minisog_inf, aox_inf, rotenone_inf
import matplotlib.pyplot as plt
from matplotlib import colors
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
from matplotlib.ticker import LogLocator, NullFormatter
from palettable.cartocolors.sequential import Burg_5
from ... |
8359def94629f9f319d07361b9898a7befc8eea0528b65622b7c4270f19e2249 | Python | 6,444 | 158 | """Honesty regression: Python/NumPy-RNG control flow must never be a false VERIFIED.
A sparse runnable trace records exactly one taken branch. When the traced forward
chose that branch from Python ``random`` or NumPy RNG (an unwitnessed, tensor-free
predicate), a run under a *different* seed than capture cannot be ble... |
e407feff8f5b41342b5b443537c014edaffe3ebbcce806004951fdf9b9c829f6 | Python | 6,444 | 239 | """
Classes for preprocessing
This file is a part of BdPy.
"""
import copy
import sys
from abc import ABCMeta, abstractmethod
import numpy as np
from numpy.matlib import repmat
# NOTE: PendingDeprecationWarning: Importing from numpy.matlib is deprecated since 1.19.0.
# repmat(a, m, n) is equivalent to tile(a, (m, n... |
c0e99b7f315d0c8443f2a28bf0f2025f66a12de3bc777d62155f3e6c6a029859 | Python | 6,445 | 148 | import pandas as pd
import numpy as np
import glob, os, functools
from skimage.transform import resize,rescale
import sys
import datetime
import json
import shutil
import SimpleITK as sitk
import nibabel as nib
import matplotlib.pyplot as plt
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.callback... |
cd3b851340519f9eca8977c8acad68c32dc094a2b29e82b1cb1645b4001527e8 | Python | 6,445 | 172 | '''
Testing functionalities of train_utilities
author: obanmarcos
'''
import os
import os, sys
sys.path.append('/home/obanmarcos/Balseiro/DeepOPT/')
from lightning.profiler import SimpleProfiler, PyTorchProfiler
from scripts import config
import lightning as pl
import argparse
import numpy as np
import matplotlib.pyp... |
5f2b0acde2324ed105fd39feb557dc978521fac138db334778edbdac2c336af0 | Python | 6,447 | 205 | from typing import Any
import numba as nb
import numpy as np
from numpy.typing import NDArray
class TMM:
"""Trimmed Mean of M-values.
Parameters
----------
expression_cutoff
Cutoff for expression values.
log_ratio_trim
Trim fraction for log ratios.
expression_trim
Tri... |
0a1aa37b9388032f44bea34d4a68de7f22a10219cff01b182f45bb34857c2321 | Python | 6,448 | 161 | # 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... |
b1b3175ce7adc695920372d1c022db582ba68c52fcd0735c307071256ca81a34 | Python | 6,448 | 172 | """
Commonly useful calculations
SimplyFire - Customizable analysis of electrophysiology data
Copyright (C) 2022 Megumi Mori
This program comes with ABSOLUTELY NO WARRANTY
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... |
355593183d8b031dd2599c579f75328f7c7084ad03b124e6e148f70fec188408 | Python | 6,449 | 179 | import pandas as pd
from prodict import Prodict
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.append("src")
import utils
from args import args
from src.constants import title_dict
from predict import evaluate_model
import statsmodels.api as sm
from typing import Tuple
def generate_log_pred_p... |
04f37a3ea3d236a140a3944e6c1a4f0ab2bf4ad6e354c9fb0a22911bd30ff3c8 | Python | 6,451 | 196 | from typing import Tuple
import numpy as np
from pl_bolts.utils import _OPENCV_AVAILABLE, _TORCHVISION_AVAILABLE
from pl_bolts.utils.warnings import warn_missing_pkg
if _TORCHVISION_AVAILABLE:
from torchvision import transforms
else: # pragma: no cover
warn_missing_pkg("torchvision")
if _OPENCV_AVAILABLE:
... |
c9d8a9b87b243e915b2ea9c3d64c37aa4db0e1780a0f6cba49133981de5e5d3e | Python | 6,451 | 156 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
import contextlib
import subprocess
import time
from pathlib import Path
import pytest
from tests import SOURCE
from ultralytics import YOLO, download
from ultralytics.utils import ASSETS_URL, DATASETS_DIR, SETTINGS
from ultralytics.utils.checks imp... |
bb89948535b25b7455f6a252d776a0c5ff93db7299a200f59125c59c0a05f1c6 | Python | 6,452 | 236 | import math
import random
import networkx as nx
from anndata import AnnData
from matplotlib import pyplot as plt
from stlearn.utils import _read_graph
def tree_plot(
adata: AnnData,
library_id: str | None = None,
figsize: tuple[float, float] = (10, 4),
data_alpha: float = 1.0,
use_label: str = "... |
c2aeb1d9b7796cf4b9790ee1b1edca182d5d747365aefe6513bda62f403bc3d5 | Python | 6,452 | 210 | import argparse
import gzip
import io
import os
import subprocess
from collections import Counter
import progressbar
def convert_and_filter_topk(args):
""" Convert to lowercase, count word occurrences and save top-k words to a file """
counter = Counter()
data_lower = os.path.join(args.output_dir, "lowe... |
e07ec3fc20c4147719ada98ce3e9ca0b3125bea9c05b5b2158275a021c2dad2f | Python | 6,453 | 177 | """
load and store configuration files at startup
SimplyFire - Customizable analysis of electrophysiology data
Copyright (C) 2022 Megumi Mori
This program comes with ABSOLUTELY NO WARRANTY
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License... |
2b4ebb8fc5a6507d79943f588a4988a82186ba42b2740ae77425b6239a730281 | Python | 6,454 | 167 | """W051-STOCH / AUD-CODE 2.1: trace-backed population identity is a pure function of the captures.
The derived-seed law folds ``population_identity`` into every draw, so an
``id()``-salted address identity silently broke rerun reproducibility for
every trace-backed population. The address is now built from persisted
c... |
a148b3f37f80829b77aa3eccdebbb08fa6ac86bb936a875575c19064c4cbcba5 | Python | 6,455 | 241 | import logging
import os
import platform
import sys
import threading
import typing
import rpy2.situation
from rpy2.rinterface_lib import ffi_proxy
logger = logging.getLogger(__name__)
cffi_mode_request = rpy2.situation.get_cffi_mode()
# TODO: Separate the functions in the module from the side-effect of
# finding R_H... |
bb87556dcf86822b733e2305fbccc6504a8a24bbaed71824b58dfd69b3e261ea | Python | 6,455 | 189 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 21 15:09:10 2022
@author: fcheng
"""
#coding:utf-8
import os
import numpy as np
import PIL
from PIL import ImageFont
import cv2
from plot.image_process import img_process, gammaCorrection
# save dirs
save_dir = "./results/plots"
if not os.pa... |
9d88f22424740edd4dfb877214fcaa62b514e5c0b3bf7b7ba71fc841ce7469bd | Python | 6,457 | 170 | import pytest
import numpy as np
from numpy.testing import assert_array_almost_equal
from pyriemann.datasets.sampling import generate_random_spd_matrix
from pyriemann.datasets.simulated import (
make_covariances,
make_matrices,
make_masks,
make_gaussian_blobs,
make_outliers,
)
from pyriemann.utils.... |
ddfb2c628dfc68e6dea70a50b538ba38521d40502a9de3f16d3904056f678cee | Python | 6,457 | 160 | from __future__ import print_function, unicode_literals, absolute_import, division
import numpy as np
from scipy.ndimage import zoom
from csbdeep.internals.probability import ProbabilisticPrediction
from .care_standard import CARE
from ..internals.predict import predict_direct
from ..data import PercentileNormalizer,... |
1fd2c73a4ca20e2ab60187ca5d3de9505b868ce46e6f3f58a049b5160698302e | Python | 6,459 | 203 | from threading import Thread
import urllib.request, urllib.error, urllib.parse
import os
import datetime
import json
import time
import logging
import traceback
from functools import wraps
class ScanException(Exception):
pass
def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None):
"""Retry cal... |
21f47feab0a5b706658660db353c1c54252a941b49982aad40d7cfd1e83a9aae | Python | 6,460 | 203 | #!/usr/bin/env python
# VCTK used in wavenet paper https://arxiv.org/pdf/1609.03499.pdf
# Licenced under Open Data Commons Attribution License (ODC-By) v1.0.
# as per https://homepages.inf.ed.ac.uk/jyamagis/page3/page58/page58.html
import os
import random
import re
from multiprocessing import Pool
from zipfile import Z... |
8d2c6889d760f49508888e9413b5efb1cc24445f95f88f8e9ab40d8ffe022e86 | Python | 6,460 | 196 | import sys, os
import torch
from icecream import ic
import random
import numpy as np
from kinematics import get_init_xyz
sys.path.append('../')
from utils.calc_dssp import annotate_sse
ic.configureOutput(includeContext=True)
def mask_inputs(seq,
msa_masked,
msa_full,
xyz_t,
t1d,
... |
039e151db7561782f4c81866891c18a211cab29f5c50ed59190638852a8d9a87 | Python | 6,461 | 187 | # Contains the metrics and loss functions used in the models.
import keras
import tensorflow as tf
from tf_focal_frequency_loss import FocalFrequencyLoss as FFL
binary_cross_entropy = tf.keras.losses.BinaryCrossentropy(reduction=tf.keras.losses.Reduction.SUM)
def ssim(y_true, y_pred,filter_size=11,filter_sigma=1.5):... |
737014de039851f5eb4430ff46d881544831dfb591503bcb38dbb7cff3906e92 | Python | 6,462 | 158 | import os
import random
import logging
import ray
from pathlib import Path
from tqdm import tqdm
from .io.video_io import VideoFrameReader, write_img_files_to_vid_ffmpeg, \
resize_and_write_video_ffmpeg, convert_vid_ffmpeg
from .utils.serialization_utils import save_json
from .dataset import GluonCVMotionDataset, ... |
c4de193c88bc1bf505aac842bb3ec7dbb17e647403e6c1b256f581c5a35290b7 | Python | 6,462 | 187 | #!/usr/bin/env python3
# spec: simplest python web server with range support and multithreading that takes root path,
# port and bind address as command line arguments; by default uses the current dir as webroot,
# port 8000 and bind address of 0.0.0.0
# borrowed from https://github.com/danvk/RangeHTTPServer
# and rebo... |
fd9435dfb0a2efe05058abbfdeffda8ba6c4c5cf2c42312c22ff19a9b2ddd763 | Python | 6,463 | 158 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
import o... |
08c6ee719b9295af64b87cd7d237946ac223384ad86fda9a776ea98b375b7b90 | Python | 6,465 | 182 | #!/usr/bin/env python
import unittest
import numpy as np
from wyrm.types import RingBuffer, Data
def data_factory(data, axes=None, names=None, units=None, markers=None):
"""Helper method to create Data objects."""
if len(data) == 0:
axes = names = units = []
else:
if axes is None:
... |
18543c0932a74dbfe1e3d4f728dadfc21c01890f6b492034a583eaca049ea2ba | Python | 6,465 | 230 | # coding=utf-8
# Copyright 2025 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... |
33da89c43a8d7438fc89a78b5a8df8ba21ca793dc4de04ddf310ae3be3054244 | Python | 6,465 | 185 | import re
from typing import List
from tqdm import tqdm
import imodelsx.data
import imodelsx.util
import imodelsx.augtree.utils
import os.path
import numpy as np
from imodelsx.augtree.utils import clean_str
from os.path import join
import pickle as pkl
import sklearn.metrics
from scipy.spatial import distance
CHECKP... |
8a487d37d75b22b57c8ba35185b1769d8349f0caec5213951aee92e02e792c83 | Python | 6,465 | 195 | import array
import pytest
import rpy2.rinterface_lib.sexp
from rpy2 import rinterface
from rpy2 import robjects
from rpy2.robjects import conversion
@pytest.mark.parametrize(
'cls, values, expected_cls',
[(rinterface.IntSexpVector, (1, 2), robjects.vectors.IntVector),
(rinterface.FloatSexpVector, (1.1, ... |
bf27da9a875e38e73e97ca57b365370ec0ad6960655f98aedfed225138563ae3 | Python | 6,465 | 173 | """Checks kit item 10: the trackers subscription seam (memo 4.7).
Checks publish already-reduced ObserverEvents onto the C06 chassis stream:
``unavailable`` is mandatory vocabulary, every gradient scalar carries
``stage`` + ``scale_provenance``, and the new series this panel delivers --
applied clip factor, skip/scale... |
99642f265888ad0e0ba7d1cc574b4d4d2b389d72acaf6d175f40642c8fb25738 | Python | 6,466 | 144 | """W051-AGENT: budget/paging contract (AUD-CODE 2.7a/b) and the explain
default budget (AUD-CODE 4.8), exercised on the realistic fixture (4.9)."""
from __future__ import annotations
from pathlib import Path
import pytest
import torchlens as tl
from tests.test_agent_surface_helpers import save_clean_artifact
from t... |
6cf75276c865bd65e714ddbb6d8a08f5a6a6c438f553da6a6e30b70cc602c876 | Python | 6,469 | 155 | """Regression tests for angular-kinematics computation in LarvaDataset."""
from __future__ import annotations
import copy
from pathlib import Path
import numpy as np
from larvaworld.lib.util import nam
def test_comp_orientations_matches_correct_arctan2_wrap(real_dataset) -> None:
"""
`s[par] = np.arctan2(... |
b6545dfdfe944581353f4fd426785dc5bf51ecb7765c9df832b420c26f9e5e00 | Python | 6,469 | 195 | import math
import re
import numpy as np
import scipy.sparse
"""
One-hot encoding of the inputs: 0 is for padding, and 1, 2, 3, 4 correspond
to A, C, G, T respectively.
"""
IN_MAP = np.asarray(
[[0, 0, 0, 0], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]
)
"""
One-hot encoding of the outputs: 0 is for ... |
6dcee2d2ead4becf39622bc5b32eddfb5d738dcc51e08e2eda1ec97fe4d85f18 | Python | 6,470 | 294 | from plotly.utils import _list_repr_elided
class InputDeviceState:
def __init__(
self, ctrl=None, alt=None, shift=None, meta=None, button=None, buttons=None, **_
):
self._ctrl = ctrl
self._alt = alt
self._meta = meta
self._shift = shift
self._button = button
... |
e80dde8cb9f1d6d50e5e4f93223eeecb7ac5bce0a90592435dcfe6ee6693be34 | Python | 6,470 | 114 | # !/usr/bin/env python
## created by Yun Hao @MooreLab 2021
## This script contains implements layer-wise relevance propagation to evaluate relevance of DTox paths
## Module
import os
import sys
import numpy as np
import pandas as pd
import torch
sys.path.insert(0, 'code/')
import dtox_hierarchy
import dtox_nn
import... |
943197b3370dd1693dde638927e6d01db169dd597c113d8d3ba030d11989ad60 | Python | 6,473 | 174 | """Default setting in training/testing for coot"""
from yacs.config import CfgNode as CN
_C = CN()
# ---------------------------------------------------------------------------- #
# Distributed DataParallel setting: DDP_CONFIG
# ---------------------------------------------------------------------------- #
_C.DDP_C... |
7239595b2755141b1e7556638dc1906560e9222b4849fe60ad85559a6452db1f | Python | 6,474 | 230 | #!/usr/bin/env python3
import argparse
import json
import re
import subprocess
import sys
from pathlib import Path
from typing import Optional
CONFIGS = [
"s2t",
"s2tw",
"s2twp",
"s2hk",
"t2s",
"t2tw",
"t2hk",
"tw2s",
"tw2sp",
"tw2t",
"hk2s",
"hk2t",
]
def repo_root()... |
8f8a422b7280fb8e0d297ad9e828fdbb0240b167cb1c4c4833f0822452baf9a5 | Python | 6,475 | 158 | # FAITHFUL PORT of vagarwal87/Xpresso @ master (original framework: Keras 2.x / TensorFlow)
# https://raw.githubusercontent.com/vagarwal87/Xpresso/master/Fig1_S2/Xpresso.py
#
# Agarwal, Shendure 2020 (Cell Reports) "Predicting mRNA Abundance Directly
# from Genomic Sequence Using Deep Convolutional Neural Networks" -- ... |
40b172837081092680472db0839da92efee3e45a149bf44ce8f5c3f5242a816b | Python | 6,476 | 170 | import numpy as np
from utils import Recorder, Q_nak
from mitochondria import Mito
from steady_state import get_steady_state
from gates import ros_inf, get_ros
import figure_properties as fp
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
def spike_quanta(baseline_atp, q):
'''Perturbation... |
390136022a57e14a7584f5f65043e471930b742a3d77315c3b1cd7bad55d9fec | Python | 6,477 | 296 | """
Color scales from the cmocean project
Learn more at https://matplotlib.org/cmocean/
cmocean is made available under an MIT license: https://github.com/matplotlib/cmocean/blob/master/LICENSE.txt
"""
from ._swatches import _swatches, _swatches_continuous
def swatches(template=None):
return _swatches(__name__... |
f941f8d244ec38202d47afded50a5a523752f94579d5c3b87c5b12f7d0eb256f | Python | 6,477 | 172 | '''
Testing functionalities of train_utilities
author: obanmarcos
'''
import os
import os, sys
sys.path.append('/home/obanmarcos/Balseiro/DeepOPT/')
from pytorch_lightning.profiler import SimpleProfiler, PyTorchProfiler
from scripts import config
import pytorch_lightning as pl
import argparse
import numpy as np
impor... |
13216e2c18fcc1ad419f586e01f7e3d935ddf7d185f8b32b8bcd0b86e9d460c5 | Python | 6,480 | 211 | """
Timing and oscillation primitives underlying the rhythmic modules.
Provides the timer that tracks simulated time for a module, and the phase
oscillator that the crawler, feeder and turner build their rhythms on.
"""
from __future__ import annotations
from typing import Any
import numpy as np
import param
from .... |
c5e9dac12a16c8103583a86db0a27e8764de37870f4b702db1495042210332b2 | Python | 6,480 | 141 | # cub multi-modal model specification
import matplotlib.pyplot as plt
import torch.distributions as dist
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
from numpy import sqrt, prod
from torch.utils.data import DataLoader
from torchnet.dataset import TensorDataset, ResampleDataset
from tor... |
0b17e4ed77c02a351553559ec5b213372fb267a6e16c6d362b42c4095d49110b | Python | 6,481 | 191 | import re
from unittest.mock import Mock
import numpy as np
import pytest
from neurogym.core import TrialEnv
from neurogym.wrappers.side_bias import SideBias
class MockTrialEnv(TrialEnv):
"""Mock environment for testing SideBias wrapper."""
def __init__(self):
super().__init__()
self.choice... |
c1984aa05a2ece0133d4a62bc1b5e0a20ca563017381411a0eef90ea8c01635c | Python | 6,482 | 230 | """Check structural references inside the canonical documentation plan."""
from __future__ import annotations
import argparse
import re
import sys
from dataclasses import dataclass
from os import getenv
from pathlib import Path
SECTION_2_6_PATTERN = re.compile(r"§2\.6|Section 2\.6")
PLAN_LINE_RANGE_PATTERN = re.comp... |
94b1a5a4916e70881b83a75a07e0485a9a695d0f0e9fd0518cf370c9a81c4646 | Python | 6,483 | 151 | import numpy as np
import tensorflow as tf
import keras
from keras.activations import sigmoid
from keras.layers import Dropout, LeakyReLU, UpSampling2D
from keras.layers.convolutional import Conv2D
from keras.layers import concatenate, add, multiply
from keras.layers.pooling import MaxPooling2D, GlobalAveragePooling2D
... |
91a4a60f851fb92cd111246ac37b566204cc3ee6d420802391e63687e44725c7 | Python | 6,484 | 204 | """
stim_figs.py
This script contains functions defining stimulus comparison figure panel
analyses.
Authors: Colleen Gillon
Date: January, 2021
Note: this code uses python 3.7.
"""
from util import logger_util
from sess_util import sess_ntuple_util
from analysis import stim_analys, misc_analys
from paper_fig_util... |
6d3d1d73a629d329989d1bd6fb0f09ee870986bf8e52c1455d899b89e26acac5 | Python | 6,485 | 200 | from argparse import ArgumentParser
import torch
from pytorch_lightning import LightningModule, Trainer, seed_everything
from torch.nn import functional as F
from pl_bolts.models.gans.basic.components import Discriminator, Generator
class GAN(LightningModule):
"""Vanilla GAN implementation.
Example::
... |
27593e46e3dd52e5d4305b3866d78527a061fb8b463d9584f7bfc9580314e0a3 | Python | 6,487 | 179 | """Lane F22 bridge repairs (neuro MEMO items 6 and 9).
Pins:
- The legacy ``bridge.rsatoolbox.dataset`` is a DELEGATION to the neuro
per-site code path (D2): disclosed ``pool="flatten"``, the ``"neuroid"``
channel label retired, presentation-order recoverability preserved
(``tl_presentation_index`` plus the leg... |
4ba340880a36294261b4761b6fec51444241bfac27a54e54854f8f54d79b791e | Python | 6,487 | 173 | """
Utility functions for model
"""
import os
import hashlib
import requests
from tqdm import tqdm
import torch
def deploy_model(model, cfg):
"""
Deploy model to multiple GPUs for DDP training.
"""
if cfg.DDP_CONFIG.DISTRIBUTED:
if cfg.DDP_CONFIG.GPU is not None:
torch.cuda.set_de... |
e301cbc5282aa2259268f36d8bfd3c39ac7a0f2c7fd8a8b3ce4af872d4a24790 | Python | 6,487 | 160 | # SOURCE: vendored from atomisticnet/aenet-PyTorch @ main (src/network.py)
# https://github.com/atomisticnet/aenet-PyTorch
"""aenet-PyTorch: GPU-supported PyTorch implementation of the aenet
Behler-Parrinello-style atomic neural network (ANN) potential, using
Chebyshev / Behler-Parrinello symmetry-function descriptors ... |
96e6fde6a18a29dced8631b27a88790cd5745031fa937db3054f2636b781cc34 | Python | 6,488 | 155 | import torch
import torch.nn as nn
# analytical memory profiling as in:
# https://proceedings.neurips.cc/paper/2021/file/1371bccec2447b5aa6d96d2a540fb401-Paper.pdf
# "memory required for a layer is the sum of input and output activation
# (since weights can be partially fetched from Flash"
# calculated ... |
c953aaa580a8d109787da903bcb75a61e82183f553ab396b8f4a38d6f929aa9e | Python | 6,488 | 166 | import torch
import torch.nn as nn
from prodict import Prodict
from utils import init_network_weights
class Encoder(nn.Module):
def __init__(self, dims: Prodict, device: str = torch.device("cpu")) -> None:
"""Parameter encoder module for TDNODE. Given a paritioned time series of post-treatment
meas... |
c74a78814631b355254d67799de29d3e1e4c6ef31cf6e7496192e0022dc67599 | Python | 6,489 | 156 | # validate cross correlations for the 3d align case.
import contextlib
import resource
import time
import dill
import os
import cupy
import numpy as np
import multiprocessing as mp
# Attempting to load nvtx (used for profiler annotations)
try:
import nvtx
except ImportError as ie:
print(f"[BATCH_XCORR] Unable ... |
1736be26c4fbb8e912bd7eb76a55dc59a7fa6980e0714c2315f067f5d387c2b8 | Python | 6,490 | 167 | from spitfire.chemistry.flamelet2d import _Flamelet2D
from spitfire.chemistry.flamelet import Flamelet
from spitfire.chemistry.mechanism import ChemicalMechanismSpec
from spitfire.time.integrator import Governor, NumberOfTimeSteps, FinalTime, Steady, SaveAllDataToList
from spitfire.time.methods import AdaptiveERK54Cash... |
e751948333ac32055a8be5d2ede27dcdd44b47cf400e0788be6b4e3eeda426d8 | Python | 6,490 | 148 | import numpy as np
from cv2 import dnn_superres
from scipy.sparse import lil_matrix as sparse
class GanglionSampling:
'''
Class that implements the retinal sampling model described in Watson (2014). The model is used to convert
images from a given resolution to a new resolution. The model is based on the ... |
20550bd0f849a0326ae98e3e921972277155735107471e25cddb4f74dbb6e40e | Python | 6,491 | 158 | import os
import time
import math
import argparse
import random
import numpy as np
import paddle
import paddle.nn.functional as F
from dataloader import DualDataLoader as Dataloader
from dataset import Molecule2DView, Molecule3DView
from model import GeomGCL
from utils import split_dataset_gcl
from tqdm import tqdm
d... |
35486e88f1f6ef0ce19d0f8a384069febef6b85be25c5fe7322b59aa67d53455 | Python | 6,491 | 196 | """Regression tests for ``torchlens.hash.content`` on 0-dim (scalar) tensors.
Finding r19d / F1-hash. ``hash._update_content_digest`` crashed on a 0-dim
tensor because ``torch.Tensor.view(torch.uint8)`` refuses a scalar
(``self.dim() cannot be 0 to view Float as Byte``). Two impacts:
1. Public ``tl.hash.content(scala... |
7ded188f278188e9a77c37045feb3cbb5a380c2ec84be7ca4dbb8caa02188a7e | Python | 6,491 | 228 | # pyrefly: ignore-errors
# Opt-in submodule: requires xarray, an optional dependency not installed in the
# default env, so this module cannot be meaningfully type-checked.
import numpy as np
from numpy.typing import NDArray
from seqpro._numba import gufunc_ohe, gufunc_translate
from seqpro.alphabets import AminoAlpha... |
dbb3926e22d8ab3b75a0671b6e38f11e579c23754b85c83badc1f220da4e5309 | Python | 6,492 | 170 | # 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... |
875297319fb18f95c1f6ec8c7b7ac4872885efcdb7e63ac1ef5ba0d211ed4a13 | Python | 6,493 | 192 | import numpy as np
from sklearn.metrics import classification_report
class ECPredF1:
def __init__(self):
self.reset_metric()
def reset_metric(self):
self.TP = np.zeros(4)
self.FN = np.zeros(4)
self.TN = np.zeros(4)
self.FP = np.zeros(4)
self.correct = np.zeros(... |
2221c02328439bb2630443f61624abce0777e3410bf81381091e9d460a5045b6 | Python | 6,494 | 188 | from multiprocessing import Pool
import numpy as np
from numba import jit
def nlm_CEST(
images: np.ndarray,
big_window_size: int,
small_window_size: int,
multi_processing: bool = False,
pools: int = 5,
) -> np.ndarray:
"""
Perform Non-Local Means (NLM) denoising on CEST images.
Args:... |
3832fc9dd5c4842384ebc2cfaedbe731951a0b27bd0ea468d43f270397f6901e | Python | 6,496 | 207 | import numpy as np
from numpy.random import default_rng
import pathlib
from mpi4py import MPI
from causal_optoconnectics.tools import conditional_probability, joint_probability, roll_pad
from causal_optoconnectics.generator import (
construct_connectivity_filters,
simulate,
construct_input_filters,
gen... |
e336001500efb052cd521e4bbcc804f5e87e57d30653e1fcb900b26f084c8550 | Python | 6,496 | 183 | from __future__ import annotations
from typing import Any
import pandas as pd
import holoviews as hv
import panel as pn
from panel.template import DarkTheme
pn.extension()
from larvaworld.lib import reg, util
from larvaworld.lib.process import LarvaDataset, LarvaDatasetCollection
__all__: list[str] = ["TrackViewer"... |
e4ac85b8d409f3a0849d5da8cb60ed469f19c133f263596cad50c89d827a9fc3 | Python | 6,497 | 120 | import matplotlib
import logging
import random
import math
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def plot_sv_lengths(deletion_candidates, inversion_candidates, int_duplication_candidates, tan_dup_candidates, novel_insertion_candidates, options):
len_dict_5 = dict()
len_dict_10 = dict()
len_... |
f3552454d90138f17e7bbd07209a651d9a69ba381e169746122f78bfa5d383f4 | Python | 6,497 | 183 | import gzip
import pickle
import random
import warnings
import numpy as np
import matplotlib.pyplot as plt
from utils.signal_processing import *
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 ker... |
00af1a93a9f3b809001df9e6868cb81a8ecfd33a44c970c9e1b2eac883cbd308 | Python | 6,498 | 169 | '''
Keras implementation of BL network
'''
import tensorflow as tf
class BLConvLayer(object):
'''BL recurrent convolutional layer
Note that this is NOT A KERAS LAYER but is an object containing Keras layers
Args:
filters: Int, number of output filters in convolutions
kernel_size: Int or... |
ab823d44f00e34e9a8022686909fe036600ea1c1a7f76c82804cc41eda92d20d | Python | 6,499 | 134 | import os
import XML_Parse as parse
import Branch_Number_per_Skeleton as bnpn
import Euclidean_Distance as eud
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#######################################################################################################################
# Data Manipula... |
22c4f7280ed915cda81f05d6d48c089b1218d3da9413dfc7cc2724b6e90e180c | Python | 6,500 | 161 | """
This script shows the training pipeline for k-fold training, without logging it via wandb.
"""
import tensorflow as tf
import tensorflow.keras as keras
import tensorflow_addons as tfa
from sklearn.model_selection import StratifiedKFold
from tf_spiking.helper import TrainingHistory
from tf_spiking import DenseLIF, ... |
eb64701065187b4aebb35d645a15099a8124c29924fa5b422291c5866690a603 | Python | 6,502 | 207 | """
The replayed larva, driven by recorded data.
Reproduces an experimentally tracked animal by replaying its stored midline and
contour coordinates, so that recorded behaviour can be rendered and inspected
with the same viewer as a simulation.
"""
from __future__ import annotations
from typing import Any
import num... |
78a8fa591a49e8a9e4c2c79028f5c4702e0613e63651f300a8b81a145f6305a6 | Python | 6,503 | 162 | import torch
import torch.nn as nn
# adapted from PANNs (https://github.com/qiuqiangkong/audioset_tagging_cnn)
def count_macs(model, spec_size):
list_conv2d = []
def conv2d_hook(self, input, output):
batch_size, input_channels, input_height, input_width = input[0].size()
assert batch_size ==... |
8df03250a93950883f610650d0366e6357fcbb1f8396a02fda710c502585158a | Python | 6,503 | 144 | # FAITHFUL PORT of steffenvan/IMPALA-PopArt @ master (original framework: TensorFlow 1.x / DeepMind Sonnet)
#
# Source model file ported: popart/agent.py (class PopArtFeedForward), which builds directly on
# the shallow_convolution() torso helper also defined in that file. The original repo depends on
# `sonnet` (DeepM... |
672c14c5a04adfb8f3d9ef685572be5223c5201e75919477d1f165498eb17d9a | Python | 6,504 | 144 | import torch.optim as optim
from run_utils.callbacks.base import (
AccumulateRawOutput,
PeriodicSaver,
ProcessAccumulatedRawOutput,
ScalarMovingAverage,
ScheduleLr,
TrackLr,
VisualizeOutput,
TriggerEngine,
)
from run_utils.callbacks.logging import LoggingEpochOutput, LoggingGradient
fro... |
f8ee4f78396ec75aaa36eb82fb19a94d84e99014345dbcd9866e0dde117f6a8c | Python | 6,504 | 138 | #!/usr/bin/env python
#### Modified from TAURUS Lee et al., Nat Methods 2019 (https://github.com/dixonlab/Taurus-MH)
import os
import sys
com=sys.argv
if '-1' not in com or "-2" not in com:
print ("USAGE: python map_3DRAM.py -r <genome_folder> -1 <G to A converted mate> -2 <C to T converted mate> -Trim1 <Trim off fi... |
a30c6bd33027644e5ac8b0c045fa53f425f4b6f17b31b3d6abed5eddf0f53a22 | Python | 6,505 | 162 | # Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
from typing import Any, List, Optional, Tuple
import torch
import torch.distributed as dist
import torch.nn as nn
import torch.nn.functional as F
from pytorch_lightning import LightningModule
from torch import Tensor
from torch.utils.data impo... |
54284a9f485667ce1d8f4b7c25b42404ef91d98e5dc9b2b7ba18a40e71ce597d | Python | 6,506 | 175 |
import os
import numpy as np
from allensdk.api.queries.ontologies_api import OntologiesApi
from allensdk.core.structure_tree import StructureTree
from allensdk.api.queries.mouse_connectivity_api import MouseConnectivityApi
from allensdk.config.manifest import Manifest
from allensdk.core.reference_space import Referenc... |
fc638d09548fee030a5b60a7e68c5d830ba535802ded1c139c4ae187cc124c61 | Python | 6,506 | 199 | from __future__ import annotations
from typing import Iterable, Callable, Dict
from pathlib import Path
from PIL import Image
import numpy as np
from torch.utils.data import Dataset
from bdpy.dataform import DecodedFeatures, Features
_FeatureTypeNP = Dict[str, np.ndarray]
def _removesuffix(s: str, suffix: str) ... |
9c915339a29cbca57ae615c5597400c4dc5703c833aa09d3d6475c7e6830cc00 | Python | 6,507 | 150 | import sys
import argparse
import logging
import time
def population_statistic(pop_merged_vcf, output_file):
output = open(output_file, 'w')
idx = 0
with open(pop_merged_vcf, 'r') as f:
for line in f:
if line[0] == '#':
continue
seq = line.strip().split('\t')... |
e13af33fe844528ca6f711604f12b0af5ee6d7064fc1e80ffdd1fc30b851de3c | Python | 6,507 | 175 | """Persistence honesty: the outcome gate, recover(), and loaded-backward fixes.
WT1 A-IV item 21 (lane A08), three defects in one bundle:
* The N1-N5 capability chokepoint read only ``__dict__["_capture_outcome"]``,
so every slots-backed ``Recording`` -- whose settled outcome lives in the
``_outcome`` slot behind... |
ec3d3e930816e78fa97bc381df2791c15b7674c103a58f92800cffbc3c962794 | Python | 6,508 | 184 | import unittest
import os
import shutil
import tempfile
from unittest.mock import MagicMock, Mock, patch
from cellxgene_gateway.items.item import ItemType
from cellxgene_gateway.items.s3.s3item import S3Item
from cellxgene_gateway.items.s3.s3item_source import S3ItemSource
from cellxgene_gateway.gateway import app
... |
1e3010fb9f573c5c78699cb557902cf36dbf72881d382423a945417b2e293935 | Python | 6,509 | 171 | """1. Getting Started with Pre-trained TSN Models on UCF101
===========================================================
`UCF101 <https://www.crcv.ucf.edu/data/UCF101.php>`_ is an action recognition dataset
of realistic action videos, collected from YouTube. With 13,320 short trimmed videos
from 101 action categories,... |
47605458917ffe7365126324fa039225a7a5a357a99625206f84e6e08689a694 | Python | 6,511 | 129 | import pylustrator
pylustrator.start()
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
experiment = "no_bias_gaussian_weights_128"
# Figure 3a, b
datasets1 = ['mnist', 'fashion_mnist', 'letter_mnist', 'cifar10']
datasets1_color = ['#1f77b4', '#9467bd', 'darkgoldenrod', '#2ca02c']
# ... |
db2dcee477effeb94820554d7b26f55ae24fd3b2d9e85e8e0476b9035a53848a | Python | 6,511 | 211 | import copy
from functools import lru_cache
import numpy as np
from permacache import permacache, stable_hash
from sklearn.decomposition import PCA
import sklearn.linear_model
import tqdm.auto as tqdm
import torch
import torch.nn as nn
from modular_splicing.data_for_experiments.standardized_sample import (
standar... |
030550291c3b5b4a156c7881c8ee9b7ba39b89f3c5891e0657f3f9c3635182bf | Python | 6,513 | 178 | from __future__ import annotations
import json
from pathlib import Path
import pytest
from larvaworld.gui_v2.apps.models_environments.env_builder_controller import (
EnvBuilderController,
)
from larvaworld.lib import reg
from larvaworld.portal.workspace import initialize_workspace, set_active_workspace_path
de... |
0ff886329df15f6883eca6586408d79584f7adfdf18f0c7261ed39284f835731 | Python | 6,514 | 174 | from __future__ import absolute_import
import logging
import os
from pip._internal.cli import cmdoptions
from pip._internal.cli.base_command import RequirementCommand
from pip._internal.operations.prepare import RequirementPreparer
from pip._internal.req import RequirementSet
from pip._internal.req.req_tracker import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.