sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e4c2045e3d914ac0d0f4793dc9ec9a672c492d8aae577e99ab05d6fd17532ead | Python | 4,311 | 129 | #!/usr/bin/env python
'''
Contains functions related to the mapping between the red and the green
channels of the frames. Its functions are made available in the
wormdatamodel.data namespace.
Imports
-------
numpy, scipy.io, pygmmreg, matplotlib.pyplot
'''
import numpy as np
import scipy.io as sio
import matplotlib.... |
30ad4737361b3f95e4e71bf871ce8e30a6432da189597c3cdf8288ba1a1618c8 | Python | 4,312 | 76 | """General-purpose test script for image-to-image translation.
Once you have trained your model with train.py, you can use this script to test the model.
It will load a saved model from --checkpoints_dir and save the results to --results_dir.
It first creates model and dataset given the option. It will hard-code some... |
4a6edb0d661edec47e8c8142728644bf70aa33940e294653e8214746bc54b1e7 | Python | 4,312 | 109 | import os
import random
import pickle as pkl
import torch
import numpy as np
from typing import Tuple
from imodelsx.d3.step1_get_extreme import return_extreme_values
from imodelsx.d3.step2_proposer import init_proposer
from imodelsx.d3.step3_verifier import init_verifier
import json
from typing import List, Dict
impor... |
9415769042f56c072f714302730edbc41d98dc0296fdf23232bddbe64c910510 | Python | 4,312 | 104 | import getpass
import os
import sys
import time
import subprocess
import argparse
import platform
def ping(host):
"""
Returns True if host (str) responds to a ping request.
Remember that a host may not respond to a ping (ICMP) request even if the host name is valid.
"""
# Option for the number of... |
3c3e10f8c560c71133d0a048bfa73a4a9447c3a14f2ee6f6fa5a735e83560391 | Python | 4,313 | 132 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""Utilities implementing batch parallelization strategies.
The module currently implements a serial (:class:``.Seri... |
b583ac5bebdaf3a82b88a69f2ef56a94287f1bb640b133ad85d16c18fcc620b4 | Python | 4,313 | 123 | """``replayed_node_count`` must count REPLAY-phase validations only (R08/R75).
``ValidationDecisionRecorder.node_count("validated")`` was phase-blind: the
ground-truth output decisions and the trace-level dispatch-census decision
(the ``op_label=None`` bucket) counted as "replayed nodes", so the
``no_nodes_replay_vali... |
b595727e0f1b2f18ffd80a8fe794891956dbf25ece3064328fb9b3a57065406a | Python | 4,313 | 126 | r"""
Port of DEBtool_M/animal/get_tj_habp.m — scaled ages at emergence for holometabolous insects.
Chains the larval acceleration (get_tj) with pupal ODE integration to find emergence.
See get_tj_habp.m source at:
G:\Το Drive μου\DEB projects\Drosophila DEB model\code\Drosophilla_DEB_Evridiki\get_tj_habp.m
Citatio... |
9c2b24e02319cc30adf53927bdfb68748d23df84aabb60e92793ba4e1eed952e | Python | 4,314 | 98 | """Tests for specparam.plts.spectra."""
from pytest import raises
import numpy as np
from specparam.tests.tutils import plot_test
from specparam.tests.tsettings import TEST_PLOTS_PATH
from specparam.plts.spectra import *
##############################################################################################... |
c96275e3f5be6451297f9986488e349f0ee3f209bf9d2e02141f6afd8cc6f933 | Python | 4,314 | 137 | import importlib
from keras.src.backend.config import PLUGGABLE_BACKENDS
from keras.src.backend.config import backend as current_backend
def get_pluggable_backend_module(
module_name=None, allow_missing=False, backend=None
):
if not backend:
backend = current_backend()
if backend not in PLUGGABLE... |
fb4c0bf96bfc4d4821a80eade28557e7ff01867c2ea29dc9efdd3a04b4d31402 | Python | 4,314 | 123 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import math
from torch.fft import fftshift, fft2, ifft2, ifftshift
from torchvision import transforms
from utils import *
class Lens(nn.Module):
def __init__(self, whole_dim, pixel_size, focal_length, wave_lambda):
super... |
a87a792a0a0066824e58c2383ab1dbe5c6cb8748a4a5410709483471b1165de9 | Python | 4,315 | 118 | """F12 roster pins: nine rows, tiers, subjects, compositions, memo settings.
The roster's exact settings are the memo's (trilabs themes memo section 3);
these pins hold the registry rows to the panel's ruling so a later edit
cannot silently move a settled cell (the dims collapse="none" 2-1 cell, the
three view pins, t... |
d4dcd6a61aa2e7ea86e7c99f7c30ed19f5325f53546a9a000b9e798e1520a61e | Python | 4,317 | 157 | # Copyright 2023 DeepMind Technologies Limited
#
# 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 agree... |
bd1ed3c460832bbfb2290938178e1b252285377d5be510d941723a04a1acae28 | Python | 4,319 | 135 | #!/usr/bin/env python
import unittest
import numpy as np
from wyrm.types import Data
class TestData(unittest.TestCase):
def setUp(self):
self.data = np.arange(20).reshape(4, 5)
self.axes = [np.arange(4), np.arange(5)]
self.names = ['foo', 'bar']
self.units = ['u1', 'u2']
... |
dc680ee497bae2ede6dad92f37a61b628c33e326c223a42d172ccccb4e651e32 | Python | 4,319 | 83 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
5ffa9ece8e9a135abca03ff7950470fe4b3c141f6271a8143932c4a39d6b8790 | Python | 4,320 | 105 | # -*- coding: utf-8 -*-
import os
import sys
import mne
import numpy as np
BASE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_PATH)
from visualize.visualize import visualize_stc
def calc_zmap(stc_fpath, avg_stc_fpath, var_stc_fpath, outfile, median=False):
sub_stc = mn... |
b1bff5b26a7a47b744aaad97681b1c707c383933ea4894ad55ebf21587d05eab | Python | 4,321 | 101 | import os
import pandas as pd
from pathlib import Path
from mirp._data_import.generic_file import ImageFile
def extract_image_parameters(
image,
sample_name: None | str | list[str] = None,
image_name: None | str | list[str] = None,
image_file_type: None | str = None,
image_mod... |
f55af29ebe3ec289e999b608e161698a57b8c036418d43858124426c81f791a1 | Python | 4,321 | 142 |
import numpy as np
from scipy import ndimage
from . import atrous
from .constants import *
def threshold_w(coefs, th, neg=False, modulus=True, soft=False, sigmaej=atrous.sigmaej):
"""Return support for wavelet coefficients that are larger than threshold.
Parameters:
- coefs : wavelet coefficients
... |
65382dc2f9b105c46cd617492b17878a9ca99e2332565db3b2b77b10ed25ca82 | Python | 4,322 | 156 | #!/usr/bin/env python
"""
Test script for the enhanced notification system.
This script demonstrates the new notification functionality.
"""
import datetime
import json
import os
import sys
# Add the src directory to the path so we can import our modules
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..... |
12f20d251778ba29417c140e044001338b8dbcae342b807b6dc1fd2360e2b12c | Python | 4,323 | 147 | """Object related utilities, including introspection, etc."""
import types
from functools import reduce
__all__ = ('Bunch', 'FallbackContext', 'getitem_property', 'mro_lookup')
class Bunch:
"""Object that enables you to modify attributes."""
def __init__(self, **kwargs):
self.__dict__.update(kwargs)... |
3a26b1a56d133bf8ca13e6405ac5252dc05ac16973e0fade8f08c2c8741220cf | Python | 4,324 | 114 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# ------------------------------------------------------------------------------
from __future__ import absolute_import
from __future__ import d... |
4b3a686b332f672d4b5b34f3e01cdd1ed7f4a678a1914e16a448939307d159fe | Python | 4,325 | 137 | from abc import ABC, abstractmethod
import torch
import torch.nn as nn
from modular_splicing.models.modules.sparsity_enforcer.sparsity_enforcer import (
sparsity_enforcer_types,
)
from modular_splicing.models.motif_models.types import motif_model_types
from modular_splicing.utils.construct import construct
clas... |
73085994f646954708c2e02d92e00e57cc202db0d101362a8e878bab2590e566 | Python | 4,325 | 121 | # import the pyabf module from this development folder
import os
import sys
PATH_HERE = os.path.abspath(os.path.dirname(__file__))
PATH_SRC = os.path.abspath(PATH_HERE+"/../../src/")
PATH_DATA = os.path.abspath(PATH_HERE+"/../../data/abfs/")
sys.path.insert(0, PATH_SRC) # for importing
sys.path.append("../../src/") #... |
9e02874b0b3aff926993aaaae2e86e88a231fc20a1ebe3cfc0d7c9d6e545ae55 | Python | 4,325 | 154 | # -*- coding: utf-8 -*-
"""
tensorflow version 2.1.0
"""
import os
import numpy as np
import time
import json
import glob
import pickle
import pandas as pd
import tensorflow as tf
from modeling import EC_Predictor, transfer_iv_model
from efficient_layers import create_padding_mask
from utils import get_config, get_we... |
ee7147e38e5c7f312cbca5ab586706823daa6a7af6349137afae69d0f7f8c1db | Python | 4,325 | 113 | __author__ = "quentin"
from ethoscope.core.data_point import DataPoint
from ethoscope.core.variables import BaseRelativeVariable
from ethoscope.stimulators.stimulators import DefaultStimulator
class TrackingUnit:
def __init__(self, tracking_class, roi, stimulator=None, *args, **kwargs):
r"""
Class... |
02b970e0e0e910b2208505ff7e488c405cbc5c16dc467481526d45f208ba733e | Python | 4,326 | 124 | # -----------------------------------------------------------------------------
# Copyright (c) 2013, The Deblur Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# -------------------------------------------------... |
abc1030f2b3044928679254090187efffd511b5f5758894ec98ebfab43c191d1 | Python | 4,327 | 105 | import os
from .molecule_split import MoleculeSplit
from sklearn.model_selection import train_test_split
from bioconfpred.params import (DATA_DIRPATH,
BIO_CONF_DIRNAME,
GEN_CONF_DIRNAME,
RMSD_DIRNAME,
SPLITS_DIRNAME)
class RandomSplit(Mol... |
58becab22feaf58b9f3705a586fdf6adbe14ea5fe36bea59c42b4c87d9515411 | Python | 4,329 | 142 | # encoding: utf8
"""mne-rsa documentation build configuration file.
Created by sphinx-quickstart on Fri Nov 24 14:06:52 2016.
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 value... |
a87f11887a809de7ad9af9fb643ea4564fe0b5ebdc1645a96f050c69f28d0626 | Python | 4,329 | 98 | # 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... |
bb65b5ecef57fc8d9690784b83251e0a0912f000bd26fb83665c34e8be720f7a | Python | 4,329 | 125 | # -*- coding: utf-8 -*-
# Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl>
# All rights reserved.
"""
Module implements specific info file manifest for Svarog.
What is different from info_file_proxy:
* root name (here we haver rs:rawSignal and xmlns)
* tags namespace (here every tag has ... |
de4feb1c603b325c49e09090206dc5ddbdb8a1c647d5e2b0cea57eef86053ae5 | Python | 4,329 | 141 | from typing import Type
from timm.layers import Mlp
from torch import Tensor
from torch.nn import GELU, LayerNorm, Linear, Module, Sequential
class AIMPredictionHeadBlock(Module):
"""Prediction head block for AIM [0].
- [0]: AIM, 2024, https://arxiv.org/abs/2401.08541
Args:
input_dim:
... |
0e0dfe956b9a8fa234819add08b95ea39088d472c0e8348f2aa01ed5de24cac2 | Python | 4,330 | 104 | # SOURCE: vendored from jamesmullenbach/caml-mimic @ 44a47455070d3d5c6ee69fb5305e32caec104960
# https://raw.githubusercontent.com/jamesmullenbach/caml-mimic/master/learn/models.py
#
# Mullenbach, Wiegreffe, Duke, Sun, Eisenstein 2018 (NAACL) "Explainable Prediction of
# Medical Codes from Clinical Text" -- CAML (Convol... |
957e80d257ad2a7311d96e44d67ba09c6144d82bf906e02bf5ee5b932733b002 | Python | 4,330 | 112 | import torch
import matplotlib.pyplot as plt
import utils
import sys
sys.path.extend(["../TDNODE", "src"])
from src.data.data_prepare import prepare_TGI
from src.constants import title_dict
from model import model_dict
import numpy as np
from prodict import Prodict
import pandas as pd
import utils
from typing import T... |
8fa40305a75d60086e3d0685afc27029997b73c5435fe705b19e295e7370707e | Python | 4,331 | 156 | # -*- coding: utf-8 -*-
"""
tensorflow version 2.1.0
"""
import os
import numpy as np
import time
import json
import glob
import pickle
import pandas as pd
import tensorflow as tf
from modeling import EC_Predictor, transfer_model
from efficient_layers import create_padding_mask
from utils import get_config, get_weigh... |
bd3a66d9138c51dac477366ed2ec9cabb2f5ff41966725dd8e3f82247179ad3a | Python | 4,331 | 129 | """
====================================================================
Manova for ERP data
====================================================================
"""
# Authors: Alexandre Barachant <alexandre.barachant@gmail.com>
#
# License: BSD (3-clause)
import seaborn as sns
from time import time
from matplotlib ... |
2028853445b55f29de5bc0dea2317cba11688be22ff3521fabe20d2e53e82898 | Python | 4,332 | 135 | import numpy as np
import tensorflow as tf
import random as python_random
import os
import tensorflow_datasets as tfds
from tensorflow.keras.models import Model, load_model
from gradient_accumulator import GradientAccumulateModel
from tensorflow.keras.layers import Input, Dense, Flatten, Conv2D, UpSampling2D,\
MaxP... |
cff9cd1f7e5bc3138ce0dd530e04348ce3790b042f0a032f8a66692e6992d1d2 | Python | 4,332 | 98 | #!/usr/bin/env python
import argparse
import csv
import os
import tables
def write_tab(table, file_names, output_directory, log=False):
chromosome_to_file_writer_pair = {}
columns = [col for col in table.colnames if col != "chromosome"]
columns = [col if col != "file_key" else "file_name" for col in colu... |
057f683072a80e921d5eebea42aeb2dc7f24abfd5f27211d88f9c8c1171d7bdb | Python | 4,333 | 114 | """F08 real-model pins, derived by the ONE committed script at zero network.
Summary memo section 5 (the canonical pin table): the constants below are
the memo's build-time pins; tests re-derive them through
``tools/derive_summary_pins.py`` so the tests and the script share one
identity-partition basis. HF architectur... |
9e9cb86fd1798e270273a7ec2e037dc52dd77f8b13b0ae89cea62368b12473a3 | Python | 4,333 | 135 | # 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... |
0bec9828b05fd10832b85ff592f90d7f674d9ba6a1d391fe2cb998265cd4cb21 | Python | 4,334 | 127 | """
Loads and handles interactions with the log widget
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 a... |
6e86bb7b2f5fa31b5ee5517c7bc5e17e111795b523638c87aea4bd079956bb94 | Python | 4,334 | 142 | import os.path
import numpy as np
import pytest
from mirp import extract_images
from mirp._images.pet_image import PETImage
from mirp._masks.base_mask import BaseMask
from mirp.data_import.import_image_and_mask import import_image_and_mask
from mirp._data_import.dicom_file_rtstruct import MaskDicomFileRTSTRUCT
# Find... |
e5aa9f924b14587dafeede2e57745fb565dd605b42657f5ca0af2e6cfbcca8ea | Python | 4,334 | 134 | import os
import tqdm.auto as tqdm
from permacache import stable_hash
from modular_splicing.motif_names import get_motif_names
from modular_splicing.legacy.remapping_pickle import permacache_with_remapping_pickle
from modular_splicing.models.motif_model_stub import EclipMatchingModelMotifModelStub
from modular_splicin... |
00c6d947fb25ec5ef6e58b38baa7bdadbcd0e8c615c6e152be2ecc27cee05f10 | Python | 4,335 | 124 | import numpy as np
import pytest
import torch
import torch.nn.functional as F
from torch import Tensor
from lightly.loss import MACLLoss
def _cal_macl_loss_original(
pos: Tensor, neg: Tensor, tau_0: float, alpha: float, A0: float
) -> Tensor:
"""The original implementation of the MACL loss.
See: https:/... |
5a9219f511c9e3cf7730c45b99c93867eb2c26cfe190b6cbf0b6810fc768d30a | Python | 4,336 | 121 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import tensorflow as tf
import pandas as pd
import argparse
import os
import time
import sys
import pwd
import pdb
import csv
import re
import deepchem... |
956c63690522b8aa6a72aa728cb14995670a6825fd65818aa397d793d156444e | Python | 4,336 | 119 | import string
import numpy
from .cached_projection import CachedProjections
"""
This file implements an exemplary test class, derived from CachedProjections that returns completely random connectivity data.
It mainly serves as an illustration of how such a derived class for a specific data source could be implemented... |
b4684f7edeb61a4569d3eb78573fd105c7cd4f5c435bc5a8091a36475281039c | Python | 4,336 | 121 | from typing import Dict, Callable
import torch
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
import torch.nn as nn
class AdversarialLoss(_Loss):
def __init__(
self,
is_discriminator: bool = True,
weight=None,
size_average: bool = None,
reduce: boo... |
06fbfe5c5bd904f3389fe37eee083c85073189e2eff0618f4b89193a317c44e4 | Python | 4,338 | 137 | #!/usr/bin/env python
import argparse
import readfile
import rest_tool_functions
# dictionary for the allowed output formats
dict_output = {
"cids": "xml",
"aids": "xml",
"sids": "xml",
"description": "xml",
"summary": "xml",
"record": "csv",
"classification": "xml",
"targets": "txt",... |
157435f2c43be6558bf042a3d469790cfe5814fe3d0d9c3d919bac6d75fe93e2 | Python | 4,338 | 101 | import logging
from types import SimpleNamespace
import flash_attn.cute.cache_utils as cache_utils
from flash_attn.cute import fa_logging
def test_persistent_cache_hit_logs_at_host_level_only(tmp_path, monkeypatch, caplog):
caplog.set_level(logging.INFO, logger="flash_attn")
original_level = fa_logging.get_f... |
3b848a698b72b538ae176573e25c29ac4b5abc6895e4d35abaf10e3d1138075f | Python | 4,339 | 98 | """Test-side inverse oracle adapter (design-of-record 6.3).
``op_event_from_record`` feeds the UNCHANGED capture-oracle characterizer: a
compat ``OpEvent`` in, the same object out (identity); a decomposed
``OpRecord`` in (P3+), a reconstructed genuine ``OpEvent`` out, so the
characterizer and its goldens are provably ... |
22f94202735ec3b0501472e0134f74969b0fcb6e982c9147df8627b205c7872a | Python | 4,340 | 128 | """
"""
import warnings
warnings.simplefilter(action="ignore")
import os
import torch
import pickle
from torch.utils.data import TensorDataset
from torch.utils.data import (
DataLoader,
RandomSampler,
SequentialSampler,
DistributedSampler,
)
from irnlm.models.gpt2.dataset import Dataset
from irnlm.... |
5cd0b418a8978a1d96bb742679b5b22c511f734af1e88d666b84a79f416ed65a | Python | 4,340 | 102 | # FAITHFUL PORT of MattRosenLab/AUTOMAP @ master (original framework: TensorFlow 1.x / Keras)
# https://raw.githubusercontent.com/MattRosenLab/AUTOMAP/master/models/automap_model.py
# The official repo (Zhu, Bo, et al. "Image reconstruction by domain-transform manifold
# learning." Nature 555 (2018): 487-492 -- AUTOMAP... |
b3db7c5d1be643350275efa0ba567249f408e8380fc856215d32fc66aee823a4 | Python | 4,340 | 135 | import inspect
from keras.src.api_export import keras_export
from keras.src.optimizers.adadelta import Adadelta
from keras.src.optimizers.adafactor import Adafactor
from keras.src.optimizers.adagrad import Adagrad
from keras.src.optimizers.adam import Adam
from keras.src.optimizers.adamax import Adamax
from keras.src.... |
c254787f841f8e9fdcecc9fd760c5a10fb6eb64d916010eb326509c204ae7368 | Python | 4,340 | 143 | #!/usr/bin/env python
import argparse
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord
def main(
genbank_file,
ofile,
feature_name,
transl_table=-1,
to_protein=False,
is_complete_cds=False,
stop=True,
):
handle = open(genbank_file, "rU")
recs = extract_features(
... |
248849a2514b934a9d102e995e360b6a4bca7d1ecdabf67499878f3bb77192ab | Python | 4,341 | 122 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Test objects and function in the module ``tfep.io.sampler``.
"""
# ===========================================... |
8ae037b9fdb9c98fc1a259f57d54196f8a3d9e0a1da811fb7a5e86e31ec57d06 | Python | 4,343 | 117 | import torch
import numpy as np
import SimpleITK as sitk
from HD_BET.data_loading import load_and_preprocess, save_segmentation_nifti
from HD_BET.predict_case import predict_case_3D_net
import imp
from HD_BET.utils import postprocess_prediction, SetNetworkToVal, get_params_fname, maybe_download_parameters
import os
imp... |
b78e0cd87556b6bf29848cf63a19c82f3b864f7ad30136a8bdcb55d5da675488 | Python | 4,343 | 127 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import string
import re
from setuptools.extern.pyparsing import stringSta... |
d2bee0a78bad191854eeb40e5a54b0062d09375a2c429dec8a17fc68daa87f3b | Python | 4,343 | 83 | import os
from Phys_Seg.run import run_phys_seg
from Phys_Seg.utils import maybe_mkdir_p, subfiles
import Phys_Seg
if __name__ == "__main__":
print("\n########################")
print("########################\n")
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--inpu... |
0caef9ee15ba0f3f3d1ada96efd0b1e24d2daefdf97e14678b7623718a34710b | Python | 4,345 | 98 | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 10 09:56:26 2022
@author: 8
"""
import torch
import math
import random
import numpy as np
import torch.nn as nn
import torch.nn.init as init
import matplotlib.pyplot as plt
import torch.nn.functional as F
import torch.optim as optim
class MScnn(nn.Module)
def __init__... |
371787c423e34d8f3a356ea8f2757b5acb54757e212d72ab3893b789ac82e56e | Python | 4,345 | 131 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import logomaker
def render_psam(psam, psam_mode="normalized", ax=None):
"""
Render a PSAM as a LogoMaker logo. Any NaNs in the PSAM will be replaced with near-0 values
so that they don't cause the LogoMaker to crash. This means t... |
5a627edf8ca6805d1dd251d561f2e29330e56c7084ddbdda6d054dc6733e4298 | Python | 4,345 | 134 | # coding=utf-8
# Copyright 2024 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
a5d8d2d592ed037156c239659ba1ad725586bf002705caf204cdb51c1cf8d81e | Python | 4,345 | 121 | import os
import numpy as np
import pickle as pkl
import nibabel as nib
from os.path import join as pjoin
from scipy.stats import zscore
from scipy.spatial.distance import cdist
from cxy_visual_dev.lib.predefine import proj_dir, Atlas,\
get_rois
anal_dir = pjoin(proj_dir, 'analysis')
work_dir = pjoin(anal_dir, 'g... |
d179becc09f8e2a1047445fadfac96ba01b376667554cd55dfae7c816a2626f5 | Python | 4,346 | 118 | """Tests for optional appliance subfolder imports."""
from __future__ import annotations
import importlib
import sys
from unittest.mock import patch
import pytest
def _drop_module(module_name: str) -> None:
"""Remove a module and its loaded children from ``sys.modules``.
Parameters
----------
modu... |
02d1f897c2af581e778575cd4407f9be9280ef6e4392c95bc57d5125a461f092 | Python | 4,347 | 135 | # 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... |
4e6ae51827ea4be70ca2204efb732db67efc2e423f01212ae3a936bc78694c57 | Python | 4,347 | 147 | import numpy as np
import pytest
from pyriemann.geometry.test import (
is_square, is_sym, is_skew_sym, is_hankel,
is_real, is_real_type, is_hermitian,
is_pos_def, is_pos_semi_def,
is_sym_pos_def, is_sym_pos_semi_def,
is_herm_pos_def, is_herm_pos_semi_def,
)
n = 3
def test_is_square():
asser... |
03492e05edbd120f74704cd1020c386269d2867ce8aba6a2ffed3520101feb78 | Python | 4,349 | 127 | #!/usr/bin/env python3
# coding: utf-8
"""
Created in April 2022
@author: Simon Delarue <sdelarue@enst.fr>
"""
from typing import Iterable, Union
import numpy as np
from sknetwork.gnn.base_activation import BaseActivation, BaseLoss
from sknetwork.gnn.base_layer import BaseLayer
from sknetwork.gnn.layer import get_lay... |
0e4b2f90f60cd0dfe58557a320498af8769e1f75e43bd11604b03e45ef5037b6 | Python | 4,349 | 130 | import sys
import argparse
import logging
import time
def pase_info(seq):
info = {'SVLEN': 0, 'END': 0, "SVTYPE": '', "RE": 0, "CHR2": ''}
for i in seq.split(';'):
if i.split('=')[0] in ["SVLEN", "END", "RE"]:
try:
info[i.split('=')[0]] = abs(int(float(i.split('=')[1])))
... |
b687f51ac9096ba34e68d5e4ddc9bbb715189f93b941242926dd23e761381962 | Python | 4,349 | 132 | import os
import numpy as np
import modular_splicing
from .maxent import FullTable
data_dir = os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(modular_splicing.__file__))), "data"
)
path = os.path.join(data_dir, "splicepoint-maxent")
path_triplets = os.path.join(data_dir, "splicepoint-maxent-triple... |
fef07556969bb12a9167f866655edf049c4217c1b389e9908f1f360fb41dc10b | Python | 4,349 | 128 | import logging
import unittest
from unittest.mock import MagicMock, patch
from codecarbon.output_methods.emissions_data import EmissionsData
from codecarbon.output_methods.logger import GoogleCloudLoggerOutput, LoggerOutput
class TestLoggerOutput(unittest.TestCase):
def setUp(self):
self.emissions_data =... |
405b268c737bc8cc8a66261269066150674d1a02d812f8e3a3ce64c8b14135b1 | Python | 4,352 | 119 | import cv2
import numpy
from scipy import io
from propagation_ASM import *
import model
import tools
pitch=0.0036
wavelength=0.000520
n = 2160
m = 3840
z0=160 #juli
layernum=6
interval=10
layer1=0
layer2=3
reconlayer=layer2
slm_res = (n, m)
pad=True
convert=False
method='phase'
#method='nophase'
im... |
c784758f9dbacf52389dea4d1001c9a18646cd15ce6cdca79c366484f32f4b65 | Python | 4,352 | 108 | # !/usr/bin/env python
## created by Yun Hao @MooreLab 2021
## This script contains functions used to build basic neural network structure for DTox model
## Module
import torch
from torch import nn
## This function defines a root loss-oriented neural network structure for each node module
class DToxNetModule(nn.... |
31c9fc799634a6a2a5a5fe87bc9a59ac651d926255ea4f98293fbb649fef6894 | Python | 4,354 | 100 | """1. Getting Started with Pre-trained I3D Models on Kinetcis400
================================================================
`Kinetics400 <https://deepmind.com/research/open-source/kinetics>`_ is an action recognition dataset
of realistic action videos, collected from YouTube. With 306,245 short trimmed videos
f... |
384bad43b43c0c2d74f4ec1ab9d88eea444edd34eae21beebd0901a00e5ec6c2 | Python | 4,354 | 123 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
import warnings
warnings.filterwarnings('ignore')
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0" # specify which GPU(s) to be used
from role_prediction.graphormer.model import Graphormer
from ro... |
620a8fb85532d22dc87b14a3308ef2ea683e177fa1781456c86ab0a94af0a977 | Python | 4,355 | 109 | from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
import pandas as pd
import os,sys
from parse_blast import parse_needle_results
import biotite.sequence.io.fasta as fasta
def to_fasta(df,name,column='RNA'):
ids = df['ID'].tolist()
sequences = df[column].tolist()
records = ... |
6b55f87d78f287f962837f77cfb1590dfa6519fa9d744724064721afd800d888 | Python | 4,355 | 115 | import tensorflow.compat.v1 as tf
class GATE():
def __init__(self, hidden_dims, alpha=0.8, nonlinear=True, weight_decay=0.0001):
self.n_layers = len(hidden_dims) - 1
self.alpha = alpha
self.W, self.v, self.prune_v = self.define_weights(hidden_dims)
self.C = {}
self.prune_C ... |
963bf8239a7ccb090f88669affd0ad00ea43b4ab741cf4a214cd9d36267e5c65 | Python | 4,355 | 99 | """SURFACE-table audit tail: the deep reachable walk (F35; memo item 7).
C01's wave-1 lockstep (tests/test_arch_spine_surface.py) covers the ROOT
surface: frozen table byte-equality, budget pin, the L6+ ban, and the
fresh-interpreter cold sweep. This suite is the deep tail _surface.py
explicitly hands to lane F35: wal... |
e33a7bba116bc3c47a1af803e03aab398c1907e7048a2ea25b1d8c5befebd513 | Python | 4,355 | 145 | # A simple tool to connect to the AREsite server and retrieve feature
# information using the AREsite REST Interface.
# Parts of this code are from https://toolshed.g2.bx.psu.edu/repos/earlhaminst/ensembl_get_feature_info
import json
import optparse
import sys
import time
import urllib.error
import urllib.parse
import ... |
76701f828756716a11cd7f51582269942c7736735d3e4594dad46067c435fd11 | Python | 4,356 | 123 | import os
import pytest
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
from angorapy.agent.ppo_agent import PPOAgent
from angorapy.common.policies import BetaPolicyDistribution, MultiCategoricalPolicyDistribution
from angorapy.common.postprocessors import RewardNormalizer, StateNormalizer
from angorapy import make_task
f... |
7739019fb96191e6e8a63d21f7fc333e315fe988ebed186b1c7a2ced26961bcc | Python | 4,357 | 83 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
f837dd1f4042e326e36f05df412efa755e7113b7a28b168b7d55658f8a605b31 | Python | 4,358 | 100 | """
Entity bean definitions for preprocessing.
This module contains the EntityBean class used to represent
converted entities during the preprocessing pipeline.
"""
import dataclasses
from typing import Optional, Dict, Any
@dataclasses.dataclass(frozen=False)
class EntityBean:
"""
Class bean representing a ... |
23c10c196dc38f59b1a43e3f823cb30617181bdd6d7717649fc8f0f616c05131 | Python | 4,360 | 123 | """``Layer.do``, ``Layer.set`` and ``Layer.attach_hooks`` address every pass of a multi-pass layer.
A bare layer label addresses only a single-pass layer, so the three Layer doors
must not forward it for a layer that ran several passes: a module reused in a
loop would otherwise refuse with ``SiteAmbiguityError`` on ev... |
91344a39fa951547a70c5c19c935daff7ba95565019d5655002af41b041f27c3 | Python | 4,360 | 125 | # --- 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 = "choropleth.marker"
_pa... |
b13497eec44db18cc619a11ccc423d73b252cf6fc4469d7ec5393f0d8761113b | Python | 4,360 | 111 | """
BASIL GUI for Oxford ASL - Analysis / model fitting options
Copyright (C) 2020 University of Oxford
"""
import os
import wx
from . import OptionError
from .widgets import TabPage, WhitePaperCompatibility
class AnalysisTab(TabPage):
"""
Tab page containing data analysis options
"""
EXCH_OPTIONS ... |
ce5eadc693dd7c11f4822ce37a40429282606ff53ff3383dc55bd1d1694ffbf2 | Python | 4,360 | 131 | from datetime import datetime, timedelta
from pyEcoHAB.utils import for_loading as fl
def convert_int_to_time(number):
if number < 10:
return "0%d" % number
return "%d" % number
def find_light_beginning(dark_beg, dark_len):
hours, mins = dark_beg.split(":")
d_hours = int(hours)
d_mins = ... |
8a538d01ba7e5ea22341b85622711f28d210cdf80a9b96961579da95187c6c2a | Python | 4,361 | 121 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import tensorflow as tf
import pandas as pd
import argparse
import os
import time
import sys
import pwd
import pdb
import csv
import re
import deepchem... |
7707512d00fcc37a1ef21dad4cc7ffab06d3180b5d358fc4971cfa017621e48d | Python | 4,363 | 121 | """Test speed of various code."""
import time
import warnings
import pytest
from neurogym.envs.registration import all_envs, make
from neurogym.utils.data import Dataset
from neurogym.utils.logging import logger
def speed(env, n_steps=100000, warmup_steps=10000):
"""Test speed of an environment."""
if isin... |
4a3c1964a6099da5bbb6375a828a5f8eb9d9bb872acedc4bf3b2fce73983a9ba | Python | 4,365 | 149 | """The dated, monotone KNOWN-GAP manifest (oracles D25).
Gate mechanics, settled 3/3 by the panel: NEW deltas block from the
registry's first merge (a set difference cannot flake); the LEGACY backlog is
a dated, enumerated, monotone manifest where
- a live red item WITHOUT a manifest row fails loudly (new delta), and... |
31909a2f556110a8e2c8e7ae8f869821c9d2769215eebbd7a027b9a230385b58 | Python | 4,366 | 139 | """Tests for multimodal dict auto-routing in ``tl.trace``."""
from __future__ import annotations
from typing import Any
import pytest
import torch
from torch import nn
import torchlens as tl
import torchlens.bridge.hf as hf_bridge
import torchlens.user_funcs as user_funcs
class _DictModel(nn.Module):
"""Tiny ... |
ffa8c799f2e240cc9e231c9e147428e03d5f2ad9b397d1f55ec9940bd5d03d38 | Python | 4,366 | 143 | import logging
import numpy as np
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
class Dictionary:
"""A mapping from symbols to consecutive integers"""
def __init__(
self,
*, # begin keyword-only arguments
bos="[CLS]",
pad="[PAD]",
eos="[SEP]",
... |
862e8b62feb4121d7482cecdd8d6e3d18e546a65891879359ce99116fc6d5ce5 | Python | 4,368 | 78 | """General-purpose test script for image-to-image translation.
Once you have trained your model with train.py, you can use this script to test the model.
It will load a saved model from '--checkpoints_dir' and save the results to '--results_dir'.
It first creates model and dataset given the option. It will hard-code ... |
ad7270797efb78ff9809958426bde162d330a8ba13dcde3187a971ba5e2da84d | Python | 4,368 | 153 | from __future__ import annotations
import pytest
from pybind11_tests import ConstructorStats
from pybind11_tests import operators as m
def test_operator_overloading():
v1 = m.Vector2(1, 2)
v2 = m.Vector(3, -1)
v3 = m.Vector2(1, 2) # Same value as v1, but different instance.
assert v1 is not v3
... |
5376b949b70acfe9c64afdeb4e28b427f13348d755e320144d8965cc2436439b | Python | 4,369 | 99 | import numpy as np
import pandas as pd
from sklearn.metrics import roc_curve, roc_auc_score
import json
class TreatmentRecommender:
def __init__(self, survival_model):
self.survival_model = survival_model
self.thresholds = {'low_risk': None}
def save(self, file_name):
with open(file_n... |
6fcf8d429e8f8fdf8918f5ab0709ebf3d6db0c3d2e3fd2d1f4b9b84d330afd1e | Python | 4,371 | 117 | from collections import OrderedDict
from timeit import default_timer as timer
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import torch
from tqdm import trange
from .model.aug import random_aug
from .utils import coords2adjacentmat
def train_seq(graphs, args, dump_epoch_list, out_prefix,... |
8f09e71dc5166dec2e0c22d7c963dac595bfcf16c9dfc01221742931c327aa72 | Python | 4,371 | 148 | import numpy as np
import torch
from torch import nn, optim
from torch.utils.data import DataLoader
from torch.utils.data.sampler import SubsetRandomSampler
from torchvision import datasets
from torchvision.transforms import ToTensor
from codecarbon import EmissionsTracker
class CNN(nn.Module):
def __init__(self... |
90a869afe146cb77c01ec40b6d86f382b90ecdc7dc930518e9020dce94f8efed | Python | 4,371 | 116 | # %%
'''
Extracts regions based on SPM results. Saves ROI masks and a list of centroids.
Looks at con_0006 ('threat reversal') and con_0007 ('safety reversal') specifically.
Be mindful that this script needs 'supervision', e.g., to hand label each ROI which
may change depending on the exact parameters (namely cluste... |
8609a9529d20d45a495a5315966593dd31af049b86a7a3e8af413553f6c4ad16 | Python | 4,372 | 115 | # 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
import pytorch_l... |
562d2663bceadd52a197d44473ba5d059fdf316984eef62b35424963d4d636c3 | Python | 4,373 | 70 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
cb575c95c807557bf0916fe550286e5e8b4dbc61ecc503dc83bad96700aabe10 | Python | 4,373 | 153 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 5 16:29:34 2021
@author: fcheng
"""
import numpy as np
from skimage.transform import radon
from skimage import draw
def principalOrient_Radon_var(image, r_list, theta=None):
"""
Identify the principal orientation in `img` from a list of o... |
8dd9d6c1be34b91a2b6855463dac5b98da0ab68f3830e62437a9701376e981c7 | Python | 4,374 | 86 | """
Configuration in this file ared used in preprocessing, training and postprocessing stages
"""
import platform
import os.path
isPreprocessing = False # False: for training only, skip preprocessing on Windows
testing = False # True only for data preprocessing debugging purpose, test data not uploaded to... |
f389f8da2dde5921c6c8cee708996e075d2bf2428b129a8706057989a91987fa | Python | 4,374 | 115 | # SOURCE: vendored from cquzys/stImpute @ 5a096592af0746b073b48d08a171355ab1a32797
# https://github.com/cquzys/stImpute/blob/main/model.py
#
# stImpute imputes unmeasured genes in spatial transcriptomics (ST) data by
# transferring information from a paired scRNA-seq reference. The `Trans`
# module is the core graph-ba... |
1715d64abc5dd722730d19470db2785aee99d6378932e896943f03b2419001c7 | Python | 4,375 | 140 | import argparse
from train_mdeepred import five_fold_training, train_val_test_training
parser = argparse.ArgumentParser(description='MDeePred arguments')
parser.add_argument(
'--chln',
type=str,
default="512_512",
metavar='CHLN',
help='number of neurons in compound hidden layers (default: 512_512)... |
6bf5d155be168bceb5a0ec132f018f8215d5c34ad7ed89e62291f02c0cd10e48 | Python | 4,375 | 125 | # --- 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 = "choroplethmap.marker"
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.