sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
12bc1d4821f78a916b7033766d7e0a674cb4e083ba5b241885cb6039474f004b | Python | 5,892 | 143 | import datetime
import json
import os
import numpy as np
import warnings
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.callbacks import TensorBoard, LearningRateScheduler, ModelCheckpoint, LearningRateScheduler, EarlyStopping, ReduceLROnPlateau
from tensorflow.keras.callbacks import ModelCheckpoin... |
c5fbfaf17de10c18025d26e0eba05ccf06de0be0929c038071bd8c68a4fa332c | Python | 5,892 | 195 | """
This part of the code was originally published by mahmoodlab and adapted for this project.
https://github.com/mahmoodlab/CLAM
Lu, M.Y., Williamson, D.F.K., Chen, T.Y. et al. Data-efficient and weakly supervised computational pathology on whole-slide images.
Nat Biomed Eng 5, 555–570 (2021). https://doi.org/10.1038... |
b598b0113d72d617b76e5138c21d1f125e6eb0f5b5ef81021bee423999916c84 | Python | 5,893 | 136 | # coding=utf-8
# Copyright 2026 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... |
34494cfe1b5bb89a36f64b7dc837ea861e8d229ba3076aee1e092f689205a31c | Python | 5,894 | 150 | import logging
from galaxy.exceptions import ConfigurationError
from galaxy.files.models import FilesSourceRuntimeContext
from galaxy.files.sources._fsspec import (
CacheOptionsDictType,
FsspecBaseFileSourceConfiguration,
FsspecBaseFileSourceTemplateConfiguration,
FsspecFilesSource,
)
from galaxy.util.... |
ed7ca0df12505531b88d32cedfcadef02f948646ff24c0ed3cd1785add93ad60 | Python | 5,894 | 158 | """Zero-arithmetic reclassification + the named unknown ledger (costreport D2/D3).
Lane A07 (2026-08-27). Two-sided witnesses: every reclassified
construction name is proven zero-by-rule, AND ambiguous names (RNG draws,
interpolating fills) are proven to STAY unknown -- a confident wrong zero is
worse than an honest u... |
32a652a96edaccbdc54fc56fd26d8d00b8278805881a8188a6147d960a80730f | Python | 5,895 | 153 | """Functions to generate simulated RNA data.
Adapted from code written by @HailinPan.
"""
from collections import deque
from typing import Optional, Tuple
import cv2
import numpy as np
from anndata import AnnData
from scipy import stats
from ..configuration import SKM
from ..errors import SegmentationError
def _cr... |
fb11d90be8a752ac4127bf2ea3d11f78f43268219e57a919da74e37de4c2f85a | Python | 5,897 | 167 | """KITTI Dataset. (KITTI Raw, KITTI Odom, KITTI Depth)
Vision meets Robotics: The KITTI Dataset, IJRR 2013
http://www.cvlibs.net/datasets/kitti/raw_data.php
Code partially borrowed from
https://github.com/nianticlabs/monodepth2/blob/master/datasets/kitti_dataset.py
"""
# pylint: disable=abstract-method, unused-import
#... |
003e45e5d9df0ba90b4c0254582ba68c4b5c5d0f0ff62b68d12bbae68312b02f | Python | 5,898 | 164 | # -*- coding: utf-8 -*-
# Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl>
# All rights reserved.
"""
This module provides classes for managing data source.
Author:
Mateusz Kruszyński <mateusz.kruszynski@gmail.com>
"""
import copy
from typing import Optional, Union
import numpy
fro... |
ef02c4c390a5bfa226ae9413a198acbc8cccdd9b581203b15e3a8093e17c9d24 | Python | 5,898 | 159 | import importlib
from inspect import getmembers, isclass, isfunction
from pathlib import Path
import gymnasium as gym
from neurogym import _PSYCHOPY_INSTALLED
from neurogym.envs.collections import get_collection
from neurogym.utils.logging import logger
_INCLUDE_CONTRIB = False # FIXME: these are currently not pass... |
f9aeb2af210ea7295f0d221b9934d023246ad9396164899dc03df54ea7201ca6 | Python | 5,898 | 162 | # 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 complian... |
df4e0a16bc64f25f7b95c5dd1268f964b871bf464f22b092a52910926a7fea03 | Python | 5,899 | 189 | """ArangoDb result store backend."""
# pylint: disable=W1202,W0703
from datetime import timedelta
from kombu.utils.objects import cached_property
from kombu.utils.url import _parse_url
from celery.exceptions import ImproperlyConfigured
from .base import KeyValueStoreBackend
try:
from pyArango import connectio... |
62e18b63334c9bacbd363d0b65eb0b10944d2bd742fef2c6781f956121b3e650 | Python | 5,900 | 176 | """Graph-path and source-seeded receptive-field extension tests."""
from __future__ import annotations
from collections import OrderedDict
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.receptive_field import _engine
from torchlens.receptive_field._errors import NoInfluencePat... |
4976851f569ecd7fdb927fea9a312dc87a23598f02a1f94d3710eacfdbc84dd9 | Python | 5,901 | 123 | from utils import construct_vocabulary,create_var,decrease_learning_rate,KLAnnealer
from data_structs import Vocabulary,MolData
from torch.utils.data import DataLoader
from tqdm import tqdm
from model import DMPN
import torch.nn as nn
import argparse
import torch
import torch.nn.functional as F
import matplotlib.pyplot... |
0dc43cc2154e98991a6068f05a41058f1f7c92eaa7d290261973edeef7972e09 | Python | 5,902 | 200 | #!/usr/bin/env python
import os, sys
import traceback
import argparse
import numpy as np
import pandas as pd
from mpi4py import MPI
from hhcrf import *
import hhcrf_pred as hh
from hhcrf_pred import *
from mydata import *
import glob
#import matplotlib.pyplot as plt
pd.set_option('display.max_columns',30)
pd.set_opt... |
bc0dfc23aa77e32bff364e0969412b15f8066e2d6033fcdbcd83cf1bc03854a8 | Python | 5,903 | 223 | """tiny-cuda-nn HashGrid and FullyFusedMLP compact reconstructions.
tiny-cuda-nn provides CUDA kernels for multiresolution hash-grid encodings and
fully fused MLPs. These pure-torch components preserve the public architectural
operations while omitting only the fused-kernel implementation detail.
"""
from __future__ ... |
56c2fcf36bd5a1bf53d9b6ae13d1c0579f77cea26b713899bbe18d27b19a6d90 | Python | 5,905 | 150 | # -*- coding: utf-8 -*-
import os
import sys
import argparse
import mne
import matplotlib.pyplot as plt
from mne.preprocessing import read_ica, corrmap
from run_ica import get_excludes, plot_ica_results, create_report
def get_templates(subjects, task, input_dir, output_dir):
raws = []
icas = []
raw_fname... |
7792fa6c196b1398444da84319e9cd0dd4990f8cee42b65b60a8265faf86fc48 | Python | 5,905 | 147 | import torch
import torch.nn as nn
import torch.nn.functional as F
from models.basic import DeepLearningModel
from models.resnet import resnet18, resnet50
from models.utils import get_nonlinear, get_norm
class UNet(DeepLearningModel):
task = 'segmentation'
def __init__(self, in_channels, num_classes, biline... |
c0d7d721e6a697f08db4922d69f29668a5aa12cef581791fa0e29804fcc7afbd | Python | 5,905 | 203 | """Issue #74: tuple keys after the leading axes index the right axis.
Each key in a tuple targets the next *output* axis, as in NumPy/awkward. Keys
after a non-int key used to be applied to axis 0 of the intermediate result.
The oracle is awkward indexing on the equivalent array.
"""
from __future__ import annotation... |
c43f172f25d92eedb83a86cf8d9d51cc13dd18d01c85d9140ad832c78ec3202c | Python | 5,906 | 157 | """CO2 Regularizer"""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
from typing import Sequence, Union
import torch
from torch import Tensor
from torch.nn import Module
from lightly.models.modules.memory_bank import MemoryBankModule
class CO2Regularizer(Module):
"""Implementation ... |
00b7538298b291c93728cdbabaec91d3f911dd510356b9cfa37198df2003b070 | Python | 5,907 | 185 | from typing import Any, Generator
import numpy as np
from mirp._images.generic_image import GenericImage
from mirp._images.mask_image import MaskImage
from mirp._masks.base_mask import BaseMask
def standard_image_process_checks(
image: GenericImage,
masks: None | BaseMask | MaskImage | list[BaseMask... |
c1a59ddcd6936c0e2fc704ad5b0cd3c98e234f8055d541fe0bac832a8981afcf | Python | 5,907 | 181 | import numpy as np
from permacache import permacache, stable_hash, drop_if_equal
from modular_splicing.evaluation.predict_motifs import predict_motifs
from modular_splicing.eclip.test_motifs.calibrate_sparsity import (
compute_sparsity_thresholds_for_model,
)
from modular_splicing.fit_rbns.rbns_data import RBNSDa... |
db819307ade0d93fa196a9af7a8903c79084b23aa1e53950a7294c17996b84fe | Python | 5,907 | 213 | #!/usr/bin/env python
from __future__ import division
import time
import logging
import cPickle as pickle
import sys
import argparse
sys.path.append('../')
import numpy as np
from matplotlib import pyplot as plt
from wyrm import processing as proc
from wyrm.types import BlockBuffer, RingBuffer, Data
logger = log... |
ed006e20aa66d5d147634d48c12a28a6a9161784714c2b7ffbdd29bee653bc6c | Python | 5,907 | 156 | """M2: exact semantic-state key-set contract for all 11 record classes.
``state_items`` is the single enumeration every persistence path (save,
pickle, scrub, fork) walks. This contract freezes, per record class and
lifecycle stage, the EXACT key set it yields on the pre-columnar baseline.
When a class moves to column... |
5137ffac0f1cded41987addda63718c9a9312ea6a2672ad04b71b63421606912 | Python | 5,910 | 168 | import itk
import os.path
import copy
import numpy as np
from mirp._data_import.generic_file import ImageFile, MaskFile
class ImageITKFile(ImageFile):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def is_stackable(self, stack_images: str) -> bool:
"""
Is the image potentia... |
60a8f83751b2f075912dec1aa275575cc53348ad9ce2cd5bcb55ae76bac2d243 | Python | 5,911 | 152 | import os
import shutil
import json
import numpy
from .parcellation_level import ParcellationLevel
class AibsLevel(ParcellationLevel):
def __init__(self, root, config, hierarchy, structures, region_volume, overwrite=False):
super().__init__(root, config, hierarchy, region_volume, overwrite=overwrite)
... |
a303f34522b19b15cc334970892bfd1bb135396094545c2369ee1abd81ab614d | Python | 5,911 | 187 | import urllib.parse
from argparse import ArgumentParser
import torch
from pytorch_lightning import LightningModule, Trainer
from torch import nn
from torch.nn import functional as F
from pl_bolts import _HTTPS_AWS_HUB
from pl_bolts.models.autoencoders.components import (
resnet18_decoder,
resnet18_encoder,
... |
1a83e2dda832ff2da9d628e891ebebe1bf0a21dca38def2f07cdb5969b194f03 | Python | 5,913 | 151 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from pathlib import Path
from ultralytics.utils import LOGGER, TESTS_RUNNING
try:
assert not TESTS_RUNNING # do not log pytest
import clearml
from clearml import Task
assert hasattr(clearml, "__v... |
866a8e20d516eac1a2401524afaa1748fc93c0c2123fcdc553545148e8d2f4cf | Python | 5,913 | 153 | from typing import List, Optional, Tuple, Union
import torch
from pytorch_lightning import LightningModule
from torch import Tensor
from torch.nn import MSELoss
from torch.optim import AdamW
from torch.optim.optimizer import Optimizer
from lightly.models import utils
from lightly.models.modules import AIMPredictionHe... |
9baaed60291b6b9c44a0d38afa0229a9ee6ec7cad1fb727da4d1ccc88cbe5c14 | Python | 5,913 | 190 | #!/usr/bin/env python
"""
Run kernel CCA using kcca() from R 'kernlab' package
usage: %prog [options]
-i, --input=i: Input file
-o, --output1=o: Summary output
-x, --x_cols=x: X-Variable columns
-y, --y_cols=y: Y-Variable columns
-k, --kernel=k: Kernel function
-f, --features=f: Number of canonical ... |
60abb0e8ea2dc119840c6d5964ced12dc26d48db0c6834d79852f2097112919c | Python | 5,915 | 160 | from __future__ import annotations
import json
import pytest
from pytest_celery import RESULT_TIMEOUT, CeleryTestSetup, CeleryTestWorker, CeleryWorkerCluster
from celery.canvas import StampingVisitor, chain
from t.integration.tasks import StampOnReplace, identity, replace_with_stamped_task
def get_hybrid_clusters_... |
132599efaf7beca8d25aa01d308dd4133b95682bdbc2e1d894de7f9e93f7e1f2 | Python | 5,916 | 152 | """Provocations for the R65a/R65c stable refusal codes (fixwave-6).
R65a: ``PredicateError.__init__`` historically swallowed the structured
payload channel (bare ``super().__init__(message)``), so ``exc.fields`` was
empty at every raise site and no site could carry ``code=``. R65c:
``TrainingModeConfigError`` inherite... |
a75bf412301428c6e33bcff27ba58b1e69e5f1ea0cee783f86bad582af2d661f | Python | 5,916 | 171 | import os
import numpy as np
from scipy.stats import chi2_contingency, kruskal, chisquare, ttest_1samp
from library.comput_utils import fisherexact, ranksums
import scikit_posthocs as posthoc_tests
from pycircstat import watson_williams
from pycircstat.descriptive import std as circstd, mean as circmean
from statsmode... |
8d9228b9e64386e4c6829ad3f0bf77b0863c7578352806cc95b44f1788368625 | Python | 5,918 | 155 | from collections.abc import Sequence
from typing import Any
import numpy as np
import skimage.transform
from dask import array as da
# This module contributed by Andreas Eisenbarth @aeisenbarth
# See https://github.com/toloudis/ome-zarr-py/pull/1
def _better_chunksize(
image: da.Array, factors: np.ndarray
) -> ... |
7ded796605a1b6dc9d325ecea07b9ccee662ffd92f72a1453715f8e27b4b0afe | Python | 5,919 | 175 | # -*- coding: utf-8 -*-
"""
this determines what times (out of entire time-series) to use; issue being fitting can get distorted if there are large times of inactivity (all zeros)
@author: cjquinn, yididiya
"""
import os
import argparse
import numpy as np
import pandas
from multiprocessing import Pool, cpu_count
... |
11120e390258fccab089bc1b07f16d43ce6e094f2ba36d5f818c3c934cd64e1a | Python | 5,920 | 196 | '''Cross-validation functions
This module provides utility functions for cross-validation.
'''
import numpy as np
def cvindex_groupwise(group, nfolds=None, return_bool=False, exclusive=None):
'''Return k-fold iterator for group-wise cross-validation (e.g, run-wise, block-wise, ...)
n_folds` specification ... |
32dbbe5886e0aa6b47987c2fff397f9af53ea191ef649945445de42441e411c0 | Python | 5,920 | 198 | import numpy as np
from math import exp, erf
# -------------------------------------
# K ANT = 0.001; PSI_max = 0.1865
# K ANT = 0.005; PSI_max = 0.1833
# K ANT = 0.2; PSI_min = 0.132
# K ANT = 0.5; PSI_min = 0.1288
# K ANT = 1; PSI_min = 0.1273
# -------------------------------------
PSI_max = 0.190 # V
PSI_min... |
47a3ee38a2795e4f4c69e1d2aa6d02f99c177a6acd064d01b69f4bd0b2d974be | Python | 5,922 | 144 | import torch
from hn_cnn.cnn import HNANN, HNCNN, HNLR
from hn_cnn.constants import *
from hn_cnn.utils import update_parameters, save_model
DEFAULT_HYPERPARAMETERS = {
EPOCHS: 3000,
LEARNING_RATE: 0.05,
MOMENTUM: 0.9,
DAMPENING: 0,
RELU_SLOPE: 0.01,
WEIGHTS_DECAY: 0.0001,
OPTIMIZER: torch... |
8f2a653d2bb15722885901e601ed05192a92b9101a15898689bd57501b4cee79 | Python | 5,922 | 219 | from abc import ABC, abstractmethod
import attr
from permacache import permacache, stable_hash
from cached_property import cached_property
from modular_splicing.utils.arrays import run_length_encoding
from .flatten_distance_distributions import flatten_hsmm
from .shorten_distance_distributions import shorten_states
... |
7c4dd24a225238cd5ab022fcf95a797e95b2b88b20980cccd10772508b7d0d69 | Python | 5,924 | 160 | # 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... |
f7b3643ad9e5ac22fffce1386f8a2c9358599b3d8cfb915590876f9dbfa9d222 | Python | 5,927 | 164 | """Zero-executed-tests CI guard conformance.
The preview backend CI legs guard optional-dependency suites: with the
framework missing, every test importorskips away and pytest exits 0, leaving
a leg green while covering nothing (sol review, 2026-08-11). The nightly
workflow closes this with ``scripts/check_ci_executed... |
203e2faaa79c38a435ef6e567fe997d07c8b6466bca58796aa92b43c417c3a66 | Python | 5,929 | 138 | # validate cross correlations for the 3d align case.
import resource
import time
import dill
import os
import cupy
import numpy as np
import multiprocessing as mp
from xcorr import BatchXCorr
from rcc_xcorr.xcorr import XCorrUtil as xcu
# NOTE: remember to set the crop to (0, 0) when using 2d alignment data
#export_x... |
81a84cd295f8edcb482f09993cd9dbe9ac8f59b54bd56cae7ffdf87b772374ed | Python | 5,929 | 173 | #!/usr/bin/env python
# encoding: utf-8
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import os, sys, re
import logging
import argparse
import collections
import numpy
import time
import TNode
import Trinity_util
logger = logging.getLogger(__name__)
c... |
770951d078e44856bb382991a73f646caa533978217e0b550f2a7022909d9940 | Python | 5,930 | 111 | import torch
from torch import nn
from torch import Tensor
from collections import OrderedDict
import numpy as np
import opt_einsum as oe
class GetDensity(torch.nn.Module):
def __init__(self,rs,inta,cutoff,neigh_atoms,nipsin,norbit,ocmod_list):
super(GetDensity,self).__init__()
'''
rs: tens... |
9165133f4eaa87f2101213d7454599fbe1ffbd44c09956100cf44a3dd6057bc9 | Python | 5,930 | 157 | """Tests for the xcp_d.utils.modified_data module."""
import numpy as np
import pytest
from xcp_d.utils.modified_data import censor_between_outliers
def test_censor_between_outliers_zero_is_noop():
"""A censor_between of 0 flags nothing."""
outlier_mask = np.array([1, 0, 0, 1, 0, 1])
result = censor_bet... |
7e472559a8eeaa2d3b4843dc38c81d679634f5f8cd562e6ee46539190334068c | Python | 5,932 | 160 | _DM_help_msg = """
Diameter Manager:
- left-click or type 'i' to add point under mouse
- rigth-click or type 'd' to remove point under mouse
- type 'a' to calculate propagation velocity
"""
class GWExpansionMeasurement1:
def __init__(self, ax):
self.ax = ax
self.points = []
self.line = Non... |
a44bcbad550b77432cc7f1ed53cad45f0bc5af8a16b57225b1ced160db3bce3a | Python | 5,933 | 117 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
c71a7a6800c64decfbf9cfeab8044cb37b204010009d0e68185e63b2e038dafd | Python | 5,933 | 202 | # coding: utf-8
import platform
import pytest
import rpy2.rinterface as rinterface
import rpy2.rinterface_lib
import rpy2.rlike.container as rlc
rinterface.initr()
L10N = rinterface._l10n_info()
def _noconsole(x):
pass
@pytest.fixture(scope='module')
def silent_consolewrite():
module = rinterface.callbacks... |
448438e19562e0dd185a69731791f432b345b5677fb730cc13d44508a89675cd | Python | 5,934 | 144 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import torch
from ultralytics.data import YOLODataset
from ultralytics.data.utils import get_split_fraction
from ultralytics.models.yolo.detect import DetectionValidator
from ultralytics.utils import colorstr, ops
... |
5b74c45fbce0a2033bf0559ec7054a1e1357874a56dcdf3339603cc950fc3ecc | Python | 5,934 | 181 | """util.py - General utilities for running, loading, and processing benchmarks
"""
import json
import os
import tempfile
import subprocess
import sys
import functools
# Input file type enumeration
IT_Invalid = 0
IT_JSON = 1
IT_Executable = 2
_num_magic_bytes = 2 if sys.platform.startswith('win') else 4
def is_execu... |
7b4539083d262333b0ed1a8ba5c1f775ab8af2b48bccf4fb3f8db904626b6508 | Python | 5,934 | 158 | import torch
from typing import Dict
from rbm.custom_fn import one_hot
from rbm.potts.sampling import sample_hiddens, sample_visibles
def init_chains(
num_chains : int,
num_visibles : int,
num_hiddens : int,
num_colors : int,
device : torch.device
) -> Dict[str, torch.Tensor]:
chains = {}... |
86363705e8425eb2e606435df0c84f003379f4800f6abca44d70b6cfb20a7c06 | Python | 5,935 | 156 | """
ABFs can be created when signals are applied using the DAC. If these "stimulus
waveforms" are used, they either come from an epoch table or from a DAC file.
Code in this file determines where the stimulus comes from and returns it for
a given sweep and channel.
If the stimulus waveform comes from a file, code here... |
8a509f4f633ea52bc97e532cc79d36f4590ea239d64d01fd8456b0cb81ba4512 | Python | 5,935 | 134 | # Copyright (c) 2023, Tri Dao.
import math
import pytest
import torch
import torch.nn.functional as F
from einops import rearrange
from flash_attn.layers.rotary import RotaryEmbedding, apply_rotary_emb_func, apply_rotary_emb_qkv_
from transformers.models.gpt_neox.modeling_gpt_neox import RotaryEmbedding as RotaryEmbe... |
9fc908f5995fedac746df952af8b6e9a0cad08d1a1b37802dba69ee0b315d122 | Python | 5,935 | 176 | import argparse
import json
import re
import warnings
import h5py
import numpy as np
import pandas as pd
warnings.simplefilter("ignore")
def _get_longest_sequence_length(fasta_file):
max_len = 0
max_id = None
for name in fasta_file.keys():
seq_len = len(fasta_file[name])
if seq_len > max... |
0c8302eefa638a68b79cceb596ca10c8e7a0460053f51d41493b7b1ac2e7ebe3 | Python | 5,936 | 172 | import os
import numpy as np
from sklearn.metrics import roc_curve, auc, precision_recall_curve, precision_recall_fscore_support, accuracy_score
from matplotlib import pyplot as plt
import pickle
import xlsxwriter
from ..config import *
model_name = {
# 'resnet18' : 'ResNet18 (w/ Aug.)',
# 'resnet34' : 'ResNet... |
83669f07b8dcdefe3e363d4f031c3085c20a2dfe3c70941a9e4390c83f373181 | Python | 5,938 | 162 | '''
Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands
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 requir... |
a171910016f845bd716134420b0c4d1df97458dba807445238a4979afe6be7c7 | Python | 5,938 | 172 | """
The run manifest catalog.
Lists the recorded runs a workspace holds and drives their validation and
rerun from the browser.
"""
from __future__ import annotations
from html import escape
from pathlib import Path
from typing import Iterable
import panel as pn
from larvaworld.lib.sim.manifest import (
Manife... |
597d4c6a41fde17b37ef4402c167b05e54fc548e8c9bb88ac4dcdca7dc620b92 | Python | 5,939 | 192 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Interfaces to generate reportlets."""
import os
import time
import pandas as pd
from nipype.interfaces.base import (
BaseInterfaceInputSpec,
File,
InputMultiObject,
SimpleInterface,
... |
a42f44b7c84e3f3e7d8dd782c28e898a063b5d71361e96afe42c55d7ae8a292d | Python | 5,939 | 169 | import datasets
import argparse
from copy import deepcopy
import logging
import random
from collections import defaultdict
from os.path import join
import numpy as np
from sklearn.metrics import accuracy_score, roc_auc_score
from sklearn.model_selection import train_test_split
import joblib
import imodels
import inspec... |
cbd4ad3cfccef1c73ce1efcf311458463e26497a84aa8624cd5b1d0528a3f020 | Python | 5,939 | 141 | """S-17 refusal-site census: classification ledger + monotone ratchets (row 0.3).
The panel's signed refusal clauses are unenforceable while 72.6% of the raise
surface is codeless and NOBODY HAS DECLARED WHICH SITES ARE USER-REACHABLE
(memo 5.1). This module makes the census a tracked obligation: every site is
eventua... |
22bbd1cc16b20276ac03ab7b18691da694013a0879f54acfe27e4ec64baaa9cc | Python | 5,940 | 152 | from argparse import ArgumentParser
from typing import Any, Dict, List, Tuple, Type
import torch
from pytorch_lightning import LightningModule, Trainer, seed_everything
from torch import Tensor, nn
from torch.nn import functional as F
from torch.nn.functional import softmax
from torch.optim import Adam
from torch.opti... |
9b86fa12f45707f8383cb9cc1229479c7883697c8c195a33f6de6312aeeddd57 | Python | 5,942 | 153 | '''
Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands
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 requir... |
aa1044a226a2d94d57ae4d849eee76102101ccd359c9a4bcea1e339ebe80795c | Python | 5,942 | 162 | """
Create GAN images from white Gaussian noise.
"""
import argparse
import os.path
import numpy
import skimage.io
import torch
def parseargs():
"""
Parse arguments.
"""
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('-g',
'--generator_path',
... |
3e77874fe53b90f849d2584945955755e46bfc5c3594feb432f8d453876031fb | Python | 5,943 | 159 | import pybedtools
import pandas as pd
import sys
from tqdm import tqdm
import argparse
import os
import time
from sqlalchemy import create_engine
def find_variant_fragments(
query_fp,
fragment_fp,
output_fp,
db_url,
table):
""" Create table of variant fragment IDs.
"""
... |
7a22f9db3271d920cf6a802c2cb713e580fbc1be129fa98a238d7c72031ed115 | Python | 5,944 | 158 | #!/usr/bin/env python3
"""
File: export_toppfun_to_excel.py
Created: 2022/06/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 tree... |
de3eff9baffeb85279adbee8d502c2969c87655027484f7414be0df3b08abe16 | Python | 5,944 | 205 | '''View data as images'''
import matplotlib.pyplot as plt
import io
import base64
import numpy as np
import multiprocessing as mp
def tobase64(fig):
buf = io.BytesIO()
fig.savefig(buf, format='png', bbox_inches='tight')
buf.seek(0)
return base64.b64encode(buf.read()).decode()
def mp_wrap(f, *args):
... |
a8e3f271eed85b452b508f2bc74f2d12574f2e83a9e2cf23ba2adc9fffb53256 | Python | 5,945 | 163 | #!/usr/bin/env python3
import numpy as np
import os, sys
import os.path
sys.path.append("/home/dkoes/git/gninascripts/")
sys.path.append("/net/pulsar/home/koes/dkoes/git/gninascripts/")
import train, predict
import matplotlib, caffe
import matplotlib.pyplot as plt
import glob, re, sklearn, collections, argparse, sys
... |
bc8d5ad75c45e1669203f31114c6573e9f167cc3bab4238426c7297ec100ecce | Python | 5,946 | 176 |
import torch
from base.pdb_loader import load_pdb
import numpy as np
from base.features import process_features
from base.preprocess import get_distances
class MetalBindingSite:
def __init__(self, site_path=None, features = None, coord_CA=None, coord_CB=None, adj=None,
sequence = None, site_name... |
3faa65168b560c3aa5a7117b07921effecc1306f339392c87f7020449cefae51 | Python | 5,947 | 169 | """
Demonstrate how to calculate Cm from a ramp protocol.
INPUT:
model_vc_ramp.abf is from Patch-1U Model Cell (33 pF +/- 10%)
OUTPUT:
model_vc_ramp as a capacitance of 30.88 +/- 0.20 pF
171116sh_0014 as a capacitance of 202.32 +/- 11.49 pF
2018_08_23_0009 as a capacitance of 170.90 +/- 13.54 pF
"""
... |
de23a92d05298daac05e9d2b6849d994a441972e291f1f538d96cf2fb32fb5ae | Python | 5,947 | 146 | from typing import Optional
import torch
from torch import Tensor
from torch.distributed import ProcessGroup
# `all_gather_into_tensor` and `reduce_scatter_tensor` are new placeholders for
# `_all_gather_base` and `_reduce_scatter_base`. They require the most recent
# version of PyTorch. The following 4 lines are for... |
3f321cab28fdbfb752d1dfb4559cc6d8013839ab6c7f619cb0561569de866a96 | Python | 5,950 | 146 | """Workflow-gallery venue gate + pinned-artifact loaders (testing memo D2/E2).
VENUE CONTRACT (testing memo 5.1/5.3): gallery scenarios run ONLY inside the
offline preflighted venue (``HF_HUB_OFFLINE=1`` + ``TRANSFORMERS_OFFLINE=1``,
warmed caches). IN VENUE nothing here may skip and nothing may xfail -- a
missing art... |
04de2bc86b4048a9a573cd500ecf3a786e163e56c7f0370563b642f2ffc0fdb1 | Python | 5,951 | 200 | from functools import lru_cache
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
from modular_splicing.eclip.test_motifs import sparsity_matched_coverage_results
from modular_splicing.eclip.trained_on_eclip.train import models_trained_on_eclip
from modular_splicing.fit_rbns.load_rbns_neura... |
c083c87b5d8ac5d622ff2ed36ded44df9a728cf0c6d2b13933d8d268fcd7fd6c | Python | 5,951 | 154 | """Typed refusal for malformed envelope/literal fact paths (r75 L1).
Round-74 (free-roam) found lane hygiene drift: a foreign artifact whose metadata-envelope
``path`` was literal-encoded as an int crashed ``tuple(fact.get("path", ()) or ())`` with a
``TypeError`` into the generic parse catch-all (``run_capability_una... |
2acc6303dc40966ac2c859f1ac9e22302175f2ef62fd8718d9c4b722c618d02e | Python | 5,954 | 165 | from __future__ import annotations
from typing import Any, Callable, Optional
import numpy as np
import pandas as pd
from bream4.device_interfaces.devices.base_device import BaseDeviceInterface
from bream4.toolkit.procedure_components.data_extraction.collect_raw_data import collect_raw_data
# Should all be function... |
df6a428dc04aa365d6a033e2f4ba8546c25779bf8c5f612fcd15a008e595b702 | Python | 5,954 | 172 | import logging
from galaxy.datatypes import data
from galaxy.datatypes.binary import Cel # noqa: F401
from galaxy.datatypes.data import get_file_peek
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.protocols import DatasetProtocol
from galaxy.datatypes.sniff import (
build_sniff_from_p... |
6766f5dc67a377a9fcb906ece821817f3312a71b44ccc99df60fd24c67202bc0 | Python | 5,957 | 199 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Autorangeoptions(_BaseLayoutHierarchyType):
_parent_path_str = "layout.yaxi... |
7eb404e44d7c580fbbb89005040c5d7d1fecb6c0444e720a9a84054795371cb0 | Python | 5,957 | 167 | """Selector-valued ``layers=``: resolve on batch zero, freeze, attest (D12).
The frozen plan is ordered structural site keys + pass-qualified labels;
every later batch re-resolves and must attest the exact plan. Zero-site and
plan-drift refusals fire typed BEFORE any wrong shard commits; mapping
selectors namespace ch... |
acaa7eba815d2ddf2ca52ead5467a53c23c4691b5699ded9677aeb927723a745 | Python | 5,957 | 199 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Autorangeoptions(_BaseLayoutHierarchyType):
_parent_path_str = "layout.xaxi... |
bf09be6f1f9c218ce61a8110ccda416de103f495b3c19ca0e7a5b18bb7132868 | Python | 5,957 | 179 | """Tests for the facet-coverage report feeding the maintenance pipeline."""
from __future__ import annotations
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.semantic import facet_coverage
class Block(nn.Module):
"""Tiny transformer block with attention and MLP children."... |
c551398a7e367f78b059c2d0497b317bd71b5db7488ba29e80601e39d34dbbc4 | Python | 5,958 | 193 | import os
from pathlib import Path
import matplotlib
import numpy as np
from anndata import AnnData
from matplotlib import pyplot as plt
def add_mask(
adata: AnnData,
imgpath: Path | str,
key: str = "mask",
copy: bool = False,
) -> AnnData | None:
"""\
Adding binary mask image to the Anndata ... |
45c13f59642a083b43815ed86b7a724a4be5f68901420c6fa01bcb80afde7334 | Python | 5,960 | 165 |
from functools import partial
import numpy as np
from numpy import linalg
from scipy.interpolate import RectBivariateSpline
from scipy import ndimage
from scipy.ndimage.interpolation import map_coordinates
from skimage import feature as skfeature
from .. import core
from ..multiscale import atrous
from .. import ... |
de7fea4ee62bcf09064c2e6bc6174ca558d86c3a2b91b0c37b1221e5b5d390ff | Python | 5,960 | 156 | import pandas as pd
from tqdm import tqdm
import os
import torch
import torch.nn as nn
from omegaconf import OmegaConf
from Bio.PDB import PDBParser
import sys
ABPATH = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.dirname(ABPATH))
from datasets import Mutation
from train_thermompnn import Transf... |
22dba9122c1a828d3d6d29085824c2548e6da6a03c2f0bc288ffd556cec4249e | Python | 5,961 | 161 | import os
import numpy as np
import pandas as pd
from os.path import join as pjoin
from scipy.stats.stats import sem
from magicbox.io.io import CiftiReader, save2cifti
from cxy_visual_dev.lib.predefine import proj_dir,\
s1200_1096_curv, s1200_1096_thickness
anal_dir = pjoin(proj_dir, 'analysis')
work_dir = pjoin(a... |
27b472bc9f8d38078d8e3c9e74a7ec73dd3a2656f5384c25c9aa2906c425a72a | Python | 5,961 | 155 | # Copyright 2025 Google.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... |
9e89bf2b348cbe7739dc45a5f82e1d117bd88ff5d582c0bc2c3bb12bf2ff0e05 | Python | 5,961 | 194 | """Tests for execution-aligned activation stacking."""
from __future__ import annotations
from typing import Any
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.data_classes.op import Op
from torchlens.intervention.resolver import SiteTable
class _TwoRelus(nn.Module):
"""... |
e36f99dc5ef6c14ed7b2f0996cf42a976da63d954653e7b10df36282a1c5c0b4 | Python | 5,961 | 147 | #!/usr/bin/env python
#
# Copyright 2008, 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... |
9b47d00125b025203beca0e8d1895c5ca62c3aeedf4f5c1b7c79d5fd1a2b24ae | Python | 5,962 | 128 | # -*- coding: utf-8 -*-
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
fontsize = 16
plt.style.use('seaborn-colorblind')
plt.rcParams.update({'font.size': fontsize,
'font.family': 'sans-serif',
'font.sans-serif': ['Arial'],
... |
8c41d8375ad0288f4de3562c91bbf60b7ef4379d462cd6ef21c10270b00aa934 | Python | 5,963 | 195 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
a3d9aef7df0687ea6ad68007b00b49295c38a47a02cb973bbe11245111cff4e7 | Python | 5,963 | 167 | """ Report manager utility """
import time
from datetime import datetime
import bioseq2seq
from bioseq2seq.utils.logging import logger
def build_report_manager(opt, gpu_rank):
if opt.tensorboard and gpu_rank <= 0:
from torch.utils.tensorboard import SummaryWriter
if not hasattr(opt, 'tensorboard... |
8513068329029aafe611d4f8dc2d781718425a247039e50760a70ff4c767550d | Python | 5,965 | 113 | import argparse
from os import fspath
from pathlib import Path
import pandas as pd
from cefcon.cell_lineage_GRN import NetModel
from cefcon.cefcon_result_object import CefconResults
from cefcon.utils import data_preparation
# TODO: 1) Modify the processing of input data to accommodate multiple lineages; 2) I... |
851d31b9c5adfae7ecea06e63a3f0e09229eb13a009ad122f214be68e3969e31 | Python | 5,967 | 199 | """
@author: Dylan Stewart
updated: 04/16/2020
input variables:
GroundTruthBox - numpy array [x y width height]
DetectionBox - numpy array [x y width height]
output:
score - float
to use this code:
from parameters import evaluation_parameters
from RandCrowns impo... |
abf4fce7797a89d6ca960914868c93ccdce07306579524ac3d7307a8268eadb4 | Python | 5,970 | 164 | """Default setting in training/testing for action recognition"""
from yacs.config import CfgNode as CN
_C = CN()
# ---------------------------------------------------------------------------- #
# Distributed DataParallel setting: DDP_CONFIG
# --------------------------------------------------------------------------... |
1e6d30adf6d4463c606d56379cc5b9c4e71e677270b8363ecc0146aeae8e8900 | Python | 5,971 | 180 | # """ Example code for running CCI analysis using new interface/approach.
# Tested: * Within-spot mode
# * Between-spot mode
# TODO tests: * Above with cell heterogeneity information
# """
################################################################################
# Environment setup #
#################... |
47ecaf9b124a716be17199aa6e703d2e1a08efc4838ee53f6d4b68db1e4567df | Python | 5,971 | 135 | import pandas as pd
import numpy as np
from src.features.loader import *
data_version = "20230117"
def import_TQIP_data(tr, dep_var="DECEASED"):
TQIP= pd.read_pickle(tr+'data/processed/'+data_version+'_TQIP.pkl')
TQIP = TQIP[cat_names+ cont_names+[dep_var,]]
return TQIP
def import_DK_data(tr... |
e6f9b15b5fd6f4906b352b2fcc6e016ffb3125851c1e4ef29f97aea53d137036 | Python | 5,971 | 144 | '''
other static NE method...
DeepWalk-SGNS version by Chengbin Hou
'''
import warnings
warnings.filterwarnings("ignore")
# warnings.filterwarnings(action='ignore', category=UserWarning, module='gensim')
import time
import random
import pickle
import gensim
import logging
import numpy as np
import networkx as nx
c... |
19e8a7c69f8ab8afe8598ea08f82e32fc8c1e9dff4e6919eaa252614ca914182 | Python | 5,972 | 160 | import numpy as np
import math
import pdb
# -----------------------------------------------------
def checkConsecutive(index_list):
return (sorted(index_list) == list(range(min(index_list), max(index_list) + 1))) and (sorted(index_list) == index_list)
# ------------------------------------------------------
# -... |
5995541340d1ee79cb5ceec76c55659e9ec7973e2070387ebe92622be521ac13 | Python | 5,973 | 174 | # -*- coding: utf-8 -*-
# Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl>
# All rights reserved.
"""Module provides classes representing single blink and blink buffers."""
import collections
import numpy
from . import ring_buffer as rbn
Sample = numpy.zeros
class Blink:
""":class:... |
151d6f1145989966c3dc4a431b569ebf599c46250e4773a3692f9f2702bad7fa | Python | 5,974 | 141 | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 27 08:41:56 2023
@author: Caterina Brighi
"""
#%% Import functions
import matplotlib.pyplot as plt
import SimpleITK as sitk
import numpy as np
import pandas as pd
import os
from scipy.stats.stats import pearsonr
def allVoxInt(image, roi):
''... |
26677efb40ed492ea9cc4eda546a95beb27db6f401ea8271ad7d27148367a521 | Python | 5,974 | 178 | import os
import sys
import numpy as np
import json
from os.path import join, dirname
from ridge_utils.interpdata import lanczosinterp2D
from ridge_utils.SemanticModel import SemanticModel
from ridge_utils.dsutils import make_semantic_model, make_word_ds, make_phoneme_ds
from ridge_utils.stimulus_utils import load_tex... |
3bee78eec9d059b7785e396ecfc43b915339629a582d16dcac26c2152ff54cff | Python | 5,976 | 224 | """Define model parameters object."""
import numpy as np
from specparam.modes.mode import Mode
###################################################################################################
###################################################################################################
class ModelParameters... |
7108d3bfb8e1126025516949cb4819964a10402090f4d3ada6de1a859d07b38f | Python | 5,977 | 145 | """Themes substrate tests (lane C05; themes memo items 1, 2, 6).
Pins the lens registry-as-data (N12), defaults-not-overrides preset
resolution (N1), the N14 ``encodings`` renderer-capability bit, and the
N15 above-ceiling disclosure fix (an explicit ``collapse="max"`` above the
compute ceiling is never a SILENT byte-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.