sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
17269e59e28003819b28ce5e8edb3a9111df08853fac19a347dd8871cc2d7171 | Python | 3,811 | 131 | # --- 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 Slices(_BaseTraceHierarchyType):
_parent_path_str = "volume"
_path_str = ... |
61e1cfb9c9a545c52cca2905a1a5f73277155f394bdd7fe91f81d0c04094523c | Python | 3,812 | 117 | # --- 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 = "sunburst.marker"
_path... |
e1c9e4a4f819161839bfb6f98b37b434f75cfa96d1314651d6463563c4c37110 | Python | 3,812 | 87 |
import numpy as np
from mitochondria import Mito
from utils import Recorder, Q_nak
from gates import get_ros
def spike_quanta(baseline_atp, q, f_mcu=1e-3, ros=get_ros(), tau_Q=100, tot_time=500):
'''Perturbation due to a spike'''
dt = 0.01
time = tot_time
tt = np.arange(0, time, dt)
m = Mito(base... |
f3e1e32935a0b124ef35390c5cd652f1c0a047fe43247c7e5a82300fc24f342b | Python | 3,812 | 118 | # 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... |
5906c1a7668a999425a53e6d23679d7d2a0bb6d3a6c5a7bb7e157af83f7265ee | Python | 3,813 | 122 | # -*- coding: utf-8 -*-
"""Methods related to image processing."""
from base64 import b64encode
from io import BytesIO
import warnings
import cv2
from PIL import Image, ImageOps
import numpy
warnings.simplefilter('ignore', Image.DecompressionBombWarning)
Image.MAX_IMAGE_PIXELS = None
def tile_image(image, tile_wi... |
d93f3dd02dce69226f4dc28487cecf2ae6d7ad7fd0ca92d3210bad65a93400bc | Python | 3,813 | 117 | import json
import rclpy
from rclpy.node import Node
from rclpy.parameter import Parameter
from std_msgs.msg import Bool, Int32, Float32MultiArray
import numpy as np
from selection_code import TargetSelection
class SelectionROS2Node(Node):
'''
ROS2 node for the target selection model.
'''
def __init__... |
2c9fa7aebb2bd8a36d6cba86ed4b573a4873dfb062cbbd753dba9bc64690a1db | Python | 3,814 | 66 | """3. Extracting video features from pre-trained models
=======================================================
Feature extraction is a very useful tool when you don't have large annotated dataset or don't have the
computing resources to train a model from scratch for your use case. It's also useful to visualize what ... |
3417fcd5ea96bd36dcaff5f1404fb2611e13f7a9ba81516a2e4e8af925fd3675 | Python | 3,814 | 126 | from abc import ABC, abstractmethod
import torch
import torch.nn as nn
import torch.nn.functional as F
from modular_splicing.psams.motif_types import motifs_types
from modular_splicing.psams.psams import TorchPSAM
from modular_splicing.utils.construct import construct
class PSAMMotifModel(nn.Module):
"""
M... |
c4a2a700f17ec4b5747755bd013db6f24101864c61c43c2fbf9bec40e981f74c | Python | 3,814 | 112 | """
Error handling utilities for input validation and preprocessing.
This module contains functions for handling errors found during
entity validation and preprocessing.
"""
import logging
import os
import sys
import copy
from typing import List, Dict, Any, Tuple
from infer_scripts.tools.utils import write_json
from... |
9c79f626b202ee59342b6cb366d854c53907150fd1c7c5b144ec1e47f401715c | Python | 3,815 | 112 | from keras.src.api_export import keras_export
from keras.src.backend.common import standardize_dtype
from keras.src.dtype_policies import dtype_policy
from keras.src.dtype_policies.dtype_policy import AWQDTypePolicy
from keras.src.dtype_policies.dtype_policy import DTypePolicy
from keras.src.dtype_policies.dtype_policy... |
24b8b02cbd0fd37361feca5db1d6c1c9e442e2de46011b9b608e7c79816125fd | Python | 3,816 | 116 | # --- 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 Marker(_BaseTraceHierarchyType):
_parent_path_str = "waterfall.totals"
_p... |
a0007ff787ed4bde668f2710e182f8cc8740fad1a6c05caadc1d0eadec813cd4 | Python | 3,816 | 116 | """Consul result store backend.
- :class:`ConsulBackend` implements KeyValueStoreBackend to store results
in the key-value store of Consul.
"""
from kombu.utils.encoding import bytes_to_str
from kombu.utils.url import parse_url
from celery.backends.base import KeyValueStoreBackend
from celery.exceptions import Im... |
db2d8375c0a7170d289a57656c1c1fe1f844af37dbd5eb6e356e870b099817c6 | Python | 3,816 | 129 | # --- 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 Threshold(_BaseTraceHierarchyType):
_parent_path_str = "indicator.gauge"
... |
3f413aebf12729b04d40181468dacf4f6185bcf5b26c06ca5ddf1979daec1c3f | Python | 3,817 | 131 | """Regenerate the committed oracle baselines from the live tree.
Run from the repo root::
python tests/oracles/_regen.py [--check]
This is the CONSCIOUS-UPDATE tool the gate teaching messages point at: when a
gate reports a surface/census delta, the author of the change reruns this,
reviews the diff (the diff IS... |
3fe3de6f73b8f9df23a029e8a4edd386861b8174ee05e0a8358fe86d09af8633 | Python | 3,818 | 114 | import json
import os
import pickle
import numpy as np
from modular_splicing.dataset.h5_dataset import H5Dataset
from modular_splicing.dataset.multi_setting_h5_file import MultiSettingH5File
class MultiTissueProbabilitiesH5File(MultiSettingH5File):
"""
Represents a multi-tissue probabilities dataset.
P... |
5fb70f779992f2c91ad2d6c6f1007af3c968788ad7cfa8400f8a2c0e32ce3d81 | Python | 3,818 | 154 | import snapatac2 as sa2
import os
import sys
import matplotlib.pyplot as plt
import numpy as np
import polars as pl
import pyprojroot
code_root_dir = str(pyprojroot.here())
pack_dir = f"{code_root_dir}/package/python"
sys.path.insert(0, pack_dir)
import utils # type: ignore # noqa: E402
from utils import head, printfn... |
d5c556ffea4e630666e1989013adbefc8be99158b77e1e943c7136e15e19ffc5 | Python | 3,818 | 91 | """Lane F44 stage 2: the real-model persistence gate (foldA MEMO s6).
The realism rule -- toy-only validation is disqualifying: SAE-style
injected computation on a REAL GPT-2 MLP site persists, loads
degrade-to-unattested, and replays to attested; a torchvision ResNet
block-boundary splice does the same. Fixed token i... |
7f02e520d48e63f78499e86b6585186ef93d0e008bce57063f722fe30a07db2d | Python | 3,820 | 122 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"""I/O for wave files"""
from pathlib import Path
import numpy as np
from .._data_obj import NDVar, Scalar, UTS
from .._types import PathArg
from .._utils import ui
FILETYPES = [("WAV files", "*.wav")]
def load_wav(
filename: PathArg = None,
... |
9246e127c628dfda45fcbd03bd1676770c6764c370cf62704bbe4966bb3f9622 | Python | 3,820 | 119 | """
Base API Infrastructure
Provides common utilities, decorators, and base classes for all API modules.
"""
import json
import logging
import traceback
from functools import wraps
from typing import Any
import bottle
def error_decorator(func):
"""Decorator to return error dict for display in webUI."""
@w... |
103f4d3a3bb4fbca8bb5f342296bb3571665433d87d7e00195ded7db614c0d42 | Python | 3,821 | 111 | """Wrapper that converts the info format for vec envs into the list format."""
from typing import List
import gym
class VectorListInfo(gym.Wrapper):
"""Converts infos of vectorized environments from dict to List[dict].
This wrapper converts the info format of a
vector environment from a dictionary to a... |
1c483b04955be3e2242f5f1359f260141e7b4dc2aaec696665152a7bb5ed037c | Python | 3,821 | 99 | """The module describes the ``cpuinfo`` job metrics plugin."""
import logging
import re
from typing import Any
from galaxy import util
from . import InstrumentPlugin
from ..formatting import (
FormattedMetric,
JobMetricFormatter,
)
log = logging.getLogger(__name__)
PROCESSOR_LINE = re.compile(r"processor\s*... |
4f64762bc7604fe70e199ead2350f5eac391c0dbf781840902f3d164e49b5835 | Python | 3,822 | 117 | # --- 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 = "funnelarea.marker"
_pa... |
a8fdfe185fee40cb4d707707de9329b251439128066a054892e0e8c5e8edd9bc | Python | 3,822 | 182 | #!/usr/bin/env python
# coding: utf-8
# Only differences between this notebook an `1task-concept.ipynb` will be commented here. See `1task-concept.ipynb` for more thorough explanations.
# # General setup
# In[15]:
import os, sys, subprocess
import time
from glob import glob
import itertools
from functools import p... |
e42161cf5a95ad947414ee5f1d9fb8c1c2079fe14523979fd27340c5a899c938 | Python | 3,822 | 126 | import sys
import time
from unittest.mock import Mock, call, patch
import pytest
from celery.utils import timer2 as timer2
class test_Timer:
@pytest.mark.parametrize('has_entries', [False, True])
def test_init_with_schedule(self, has_entries):
schedule = timer2.Schedule(max_interval=7)
if h... |
fa0b65678a560c5c492957d82436742aca8f9816fcb52ef9f2fff2aa26852d02 | Python | 3,822 | 78 | """C.2: осмысленность метки и подбор mark_cost.
Проверяем, что канал знаков не вырождается ни в молчание, ни в равномерную
кашу. Свип mark_cost 0.1..2.0 (STAGE3_DESIGN §5.3, C.2), evolved-популяция,
signs=True. Меряем:
* mark_rate — доля действий MARK;
* MI(состояние; содержание метки) — метка о чём-то?
* свежес... |
89f5d753e1b2dd138f569fa11face142769ee88d31605a39f57f2a19aa3f462c | Python | 3,823 | 107 | import json
import logging
from pydantic import (
BaseModel,
Field,
HttpUrl,
)
from galaxy import exceptions
from galaxy.util.resources import resource_string
log = logging.getLogger(__name__)
# https://github.com/spdx/license-list-data/blob/master/accessingLicenses.md#license-list-table-of-contents
cl... |
af0027cfab29f637df051cc41ea53a13f36af375b7d97e9abaae9ba72aaf1ff3 | Python | 3,823 | 101 | # -*- coding: utf-8 -*-
"""
General class to pipe the different steps of the encoding analysis.
Allows flexible result aggregation between the functions of the defined flow.
===================================================
This module allows malleable task flow.
It doesn't require any argument for instanciation.
The... |
312a680992d05a945bf5626de5d688453a784e72b8783cae7b112f1820e1d324 | Python | 3,824 | 125 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from os.path import join
import mne
from numpy.testing import assert_array_equal
import numpy as np
import pytest
from eelbrain import gui, load, save, set_log_level
from eelbrain.testing import TempDir, gui_test
from eelbrain._wxgui.select_epochs import Docume... |
b7031c72f96506463759f62687730bacd2d4b095e851ea8870d3bbe4a15e8973 | Python | 3,824 | 133 | import numpy as np
import torch
from numpy.random import default_rng
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from tqdm import tqdm
import multiprocessing
from multiprocessing import Pool, freeze_support, current_process, RLock
from functools import partial
import pathlib
from causal_o... |
da1818988d72fa7221ce4c8aa98843eeb7f924fa74fc3ef80112d7dfa4ca66bb | Python | 3,826 | 78 | # -*- 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 Discriminator(nn.Module):
d... |
eda538818f73f3611f81ffba8cbdff277b868b64802a52b527114ed498bd9d90 | Python | 3,826 | 89 | from __future__ import annotations
import logging
from typing import Optional
from bream4.device_interfaces.devices.base_device import BaseDeviceInterface
from bream4.toolkit.procedure_components.feature_manager import ChannelNotifierState
from bream4.toolkit.procedure_components.sequencing_features.internal_state_in... |
2346bb6a5f9c3d386cf1384bd54a9e7bbab8d4454fa84f0701e89e6c0f0b7a00 | Python | 3,827 | 114 | #!/usr/bin/env python
"""
Input: tabular format file with one column storing the unique id for the compounds and any other with the Spectrophores(TM) descriptors.
Output: parse the target file using the same protocol used to generate the databases in our servers. Physico-chemical properties are computed and sto... |
ca6d94ab92ef6b60526c09c598a4e652c3b4533aebb13c548071f8d202751190 | Python | 3,827 | 108 | from ._permutation import _permutation_1samp, _permutation_ind
import numpy as np
def _optimize_lambda(p, alpha, delta = 0):
'''
finds best lambda parameter given the permutation distribution of p-values
based on https://github.com/angeella/pARI/blob/master/src/lambdaCalibrate.cpp
but only supports Si... |
23684e73468226b4521c5a06cd72fc48014e747e03d6371081957dc6584e1b8f | Python | 3,828 | 138 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 3 14:17:57 2023
@author: cvriend
Modified:
- replaced deprecated read_csv(delim_whitespace=) with sep=r'\s+'
- added logging, empty-file guard, no-files-found guard
- os.chdir removed (use explicit paths throughout)
- added --version flag
... |
2827ee013e45d1df09e62d0c2d82fee3f79742c468d61b7177bf3c8b166e1a64 | Python | 3,828 | 91 | import sys
from pathlib import Path
import re
def test_python_version(
look_for_verion_in_environmentYaml=True,
filename_environmentYaml='environment.yml',
fallback_version=3.11,
verbose=1,
):
"""
Test python version.
Either use the version specified in environment.yaml file or
falls ... |
2a1b132180119a6162e84af758dd508b5bcc984938cd75f9d8e89f956db92b5e | Python | 3,828 | 111 | # 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... |
79c34a50651d9bc75ec6c27868e6313be3cbbfda56cbf66ed72f9ed6bc6fe441 | Python | 3,828 | 96 | """P2 gates: reducer passthrough, handle-index reads, dead-field verification."""
from __future__ import annotations
import pytest
from _source_corpus import package_ast, package_files
import torchlens as tl
from torchlens.ir.capture_events import CaptureEvents
from torchlens.utils.hashing import compute_raw_event_s... |
04318fcc156decf83090ce92f285309900c8d1631008c278bdc061303ff03a22 | Python | 3,830 | 112 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""BatchNorm (BN) utility functions and custom batch-size BN implementations"""
from functools import partial
import torch
import torch.nn as nn
from pytorchvideo.layers.batch_norm import ( # noqa: F401
NaiveSyncBatch... |
326845e6206dd9825036317016e3125286b23867e5ace8ae5ba99bb4c0e0df11 | Python | 3,831 | 109 | """
Code here identifies ABFs with mismatched ADC/DAC settings.
"""
import os
import sys
PATH_HERE = os.path.abspath(os.path.dirname(__file__))
PATH_SRC = os.path.abspath(PATH_HERE+"../../../../src/")
sys.path.insert(0, PATH_SRC) # useful for imports
import pyabf
import glob
import shutil
import struct
BLOCKSIZE = 5... |
a7967ce04ac97b8252a7e9aeee3c490fbf2272ad252bd54878f57c1e2b05d74d | Python | 3,831 | 126 | """
An implementation of sparsemax (Martins & Astudillo, 2016). See
:cite:`DBLP:journals/corr/MartinsA16` for detailed description.
By Ben Peters and Vlad Niculae
"""
import warnings
import torch
from torch.autograd import Function
import torch.nn as nn
import torchsparseattn as sparse
def _make_ix_like(input, dim=0... |
6462ba305a6985082e7bb465dd70349f5e1ff75a3e26f0172416c9b936803607 | Python | 3,832 | 90 | """Secure serializer."""
from kombu.serialization import dumps, loads, registry
from kombu.utils.encoding import bytes_to_str, ensure_bytes, str_to_bytes
from celery.app.defaults import DEFAULT_SECURITY_DIGEST
from celery.utils.serialization import b64decode, b64encode
from .certificate import Certificate, FSCertStor... |
719ace83c8ca7cb75c1ea7d2504e2267038e5986782cbec1cf4c13c9caa1a22d | Python | 3,832 | 128 | import numpy as np
import tensorflow as tf
from tensorflow.keras.models import load_model
from gradient_accumulator import GradientAccumulateModel
from gradient_accumulator.layers import AccumBatchNormalization
def test_bn_conv2d(
custom_bn: bool = True, accum_steps: int = 1, epochs: int = 1
):
# make toy da... |
d7a05bb3b76cb829960c43fe11debaa5d824476059d639c8ba0ab8900071991c | Python | 3,833 | 118 | import datetime
import os
import socket
import tempfile
import pytest
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.x509.oid import NameO... |
0b738b5fde88ba01b3de0736fe6042c5da1753c615c282cd0a863b3204a2dd28 | Python | 3,834 | 139 | import time
from typing import Optional
import numpy as np
import gym
from gym.spaces import Box, Dict, Discrete, MultiBinary, MultiDiscrete, Tuple
from gym.utils.seeding import RandomNumberGenerator
spaces = [
Box(low=np.array(-1.0), high=np.array(1.0), dtype=np.float64),
Box(low=np.array([0.0]), high=np.ar... |
3ffd91e9893ebf5fca6d2824593d33d47cd063725b77d5c268fda341cd16fd84 | Python | 3,834 | 111 | import torch
import deep.model as models
import deep.training as training
import pandas as pd
from tool.preprocessing import DataCollection
from tool.create_dataset import creation
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
import torch
import numpy as np
import torch.nn as nn
... |
d5de835d681e141f36f5329ed24b40c4f4aaad9a61d49eb797b8005c0b874706 | Python | 3,834 | 106 | """Regression tests for r18o (A5/M1): mapping-KEY tensors must not bypass the
scrub/blobify tensor-policy + blob-inventory belt.
Before the fix, a tensor embedded in a mapping KEY was copied verbatim into
``metadata.pkl`` while the identical tensor in a VALUE became a manifest-indexed
``BlobRef``. That produced two fa... |
51a4e2a86d6bb29490b80d77433632b451087b846a001ca067a6b53838ff5d46 | Python | 3,836 | 100 | import tensorflow as tf
import numpy as np
from load2data import extraData
from model_resnet import Resnet
from gpopy import FlowTunning
####################################
# load data(train set、vaild set and test set) and get data shape for model
#####################################
train_dir = 'D:\JW... |
98903ec29a45626ff49ff1720bcc82692c29c50a6a24685446e8167bbd9d09c1 | Python | 3,837 | 131 | """Comprehensive module-event behavior tests for fastlog."""
from __future__ import annotations
import pytest
import torch
from torch import nn
import torchlens as tl
import torchlens._state as torchlens_state
import torchlens.capture.projections as fastlog_state
from torchlens.fastlog import PredicateError, RecordC... |
69ed6757fab040ecb8528db41eb3597199b79d53ddb85d80c23966f70a213328 | Python | 3,838 | 106 | """tviz bridge rows (memo D18 + composition row 14).
The CircuitsVis payload carries identical coordinates/values to the static
records with bridge provenance attached; oversized payloads and the missing
dependency refuse typed; and the native static path is unaffected by any
bridge state. The BertViz tuple adapter's ... |
b7ee7de612ddfca2812dd47e2ebcb71c7bc5ccb620c3b118e05aa10848112821 | Python | 3,839 | 90 | import sys
import tensorflow as tf
@tf.function
def policy_loss(action_prob: tf.Tensor,
old_action_prob: tf.Tensor,
advantage: tf.Tensor,
mask: tf.Tensor,
clipping_bound: tf.Tensor,
is_recurrent: bool) -> tf.Tensor:
"""Clipped object... |
dc54a44952012d2a6f3c661867c7d80c9e6b57416d155e3245e21a55d0816ef7 | Python | 3,840 | 97 | class BiomedisaTrainingParameter:
name: str = "BiomedisaTrainingParameter"
path_to_model: str = ""
stride_size: int = 32
epochs: int = 100
validation_split: float = 0.0
balance: bool = False
swapaxes: bool = False
flip_x: bool = False
flip_y: bool = False
flip_z: bool = False
... |
0568a487948d6d42324efcc5c9507f1e1af5790e6c4a3c69453c71a5ee8586e4 | Python | 3,841 | 108 | """Functions for statistically testing trial data."""
import numpy as np
from scipy.stats import ttest_rel, ttest_ind
from spiketools.measures.trials import compute_pre_post_rates, compute_pre_post_averages
###################################################################################################
##########... |
a84988e3902ad8deac516afc723f23153156af22e9a784834902796ee80d9e53 | Python | 3,841 | 121 | """
=================================
Datasets Remote Sensing Helpers
=================================
This file contains helper functions for handling remote sensing datasets
"""
import os
from urllib.request import urlretrieve
from scipy.io import loadmat
from pyriemann.utils._data import get_data_path
from pyri... |
d2d042147251a196291a7bd92660ef787673f61f9fc2a6a9df2cfffa6cd068f6 | Python | 3,841 | 102 | """Invariance witnesses for declared cache-key dont-cares (item 6b; wave 1-2).
D14 inverted the burden: every field declared irrelevant to the capture-cache
key carries a WITNESS SLOT -- a registered test proving the field cannot
change capture semantics. This module funds the two mechanically witnessable
empty slots ... |
c37fb92c1aa627fe7ccf88c6ce5f133e15ae0eac14b0a0db1cbdd898e79aea0e | Python | 3,842 | 115 | # dataloader test
import unittest
from unittest import TestCase
import logging
from ml_collections import ConfigDict
logging.basicConfig(level=logging.INFO)
log = logging.getLogger(__name__)
import os
os.environ['CUDA_VISIBLE_DEVICES'] = ''
import jax
from deepfold.model.config import model_config
data_config = Co... |
d8c294d31693cfac71ce55c9266751995a93ba52fde57430b61aae75df0b7492 | Python | 3,843 | 89 | import os
import PIL
import numpy as np
import torch
import torchvision
from torch.utils.data import Dataset
from datasets.basic import MultiSiteDataset
from utils.project_utils import get_platform_specific_value
class FundusDataset(MultiSiteDataset, Dataset):
def __init__(self, train: bool, task: str = 'segmen... |
00767eae5ecbe0c05cdf1143a6a16dd3acf20c09e4553e847f6e5da914d369cf | Python | 3,844 | 100 | import os
import re
import shutil
import subprocess
import tempfile
import unittest
from permacache import stable_hash
from modular_splicing.utils.io import load_model
def regression_hash(experiment, seed, do_eval_limit):
path = f"model/just_for_testing_{seed}"
try:
os.makedirs(path + "/model")
... |
c9a39be07c8c9ef105a6de18ace74c2c99ec20be5b0d5a6b71e7ef0a69603872 | Python | 3,844 | 104 | # 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... |
13767fe518580d0816f04d9ac166b5a1c5b374735a0fb15fbeec4fbb4874ed55 | Python | 3,845 | 110 | from typing import Optional, Union
import numpy as np
import pandas as pd
from pyvista import PolyData, UnstructuredGrid
from scipy.spatial import KDTree
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
def map_points_to_backbone(
model: Union[PolyData, Unstructu... |
21d9930017b36c384f12c45e6f78fc891e702593af1a89f9f3dcd5a83aec69d7 | Python | 3,845 | 101 | import os
import numpy as np
from torch.utils.data import Dataset
from pl_bolts.utils import _PIL_AVAILABLE
from pl_bolts.utils.warnings import warn_missing_pkg
if _PIL_AVAILABLE:
from PIL import Image
else: # pragma: no cover
warn_missing_pkg("PIL", pypi_name="Pillow")
DEFAULT_VOID_LABELS = (0, 1, 2, 3, 4... |
2f0ee037b2f7dbe60e75a0bdc9b7ab09baa749906d9baffafad7aefc921fcf0d | Python | 3,845 | 117 | """
Client for a brain model running in a remote Brian simulator.
Exchanges sensory input and motor output with an external process over a
socket, so that a Brian network can drive a larvaworld agent.
"""
from __future__ import annotations
from typing import Any
import datetime
from uuid import uuid4
from .... impor... |
7e63c1f9397d688d0a6401caeeb2a16b59533e802d0e3be08cd227c4f4bb1a13 | Python | 3,845 | 83 | import numpy as np
import math
import pdb
## ------------------------------------------------------
##-- datatype_check
def datatype_check(swc_matrix, soma_rows, tree_rows, check_list_df):
set_defaultradius_flag = False
invalid_XYZ_flag = 0
# -- check if ITP is int
if np.issubdtype(swc_matrix["Index... |
949927d0d14b232a7626113ad75348a3787ec7d6903f4466341ad83b1b71b36e | Python | 3,846 | 91 | """
Tests for pcmci.py, including tests for run_pc_stable, run_mci, and run_pcmci.
"""
from __future__ import print_function
import numpy as np
import pytest
import sklearn.linear_model
from tigramite.models import LinearMediation
import tigramite.data_processing as pp
from tigramite.toymodels import structural_causal... |
cd8ef44fe1c7438d6bfe655d9392ede4b3fbe0fe516803c8d510cddf8bc952c5 | Python | 3,846 | 88 | #!/usr/bin/env python
# Created on: November 26, 2013
__author__ = "Sven Kreiss, Kyle Cranmer"
__version__ = "0.1"
__description__ = """
Second stage of Decouple.
"""
import Decouple.effectiveModel
import optparse
parser = optparse.OptionParser(version=__version__, description=__description__)
parser.add_option("-... |
d2483d3effefbb699d96324ae32b2f8cae4c202e309400f43b99ed4a9f169d2f | Python | 3,846 | 102 | """
Database API Module
Handles database queries for runs and experiments and cached database information.
"""
import json
from .base import BaseAPI, error_decorator
class DatabaseAPI(BaseAPI):
"""API endpoints for database queries."""
def register_routes(self):
"""Register database-related routes... |
172eaad3edf083edc91f4142da3a92fc36f83f220982e354c081b88962b3106e | Python | 3,847 | 92 | """A.4: выход главной метрики на плато.
3 seed'а × 400 000 тиков. Плато проверяем на БЛОЧНЫХ СРЕДНИХ по блокам
15 000 тиков (preregistration §4: мгновенное MI следует за фазой колебания
численности «выел пятно — обвал — отрост», а не за эволюцией). Для этого
пишем лог с log_every=15000, так что каждое значение mi_wind... |
73b59b687923b4baae19da916bb825c98005308ef56e28d1e35ea251e5bcfb6c | Python | 3,847 | 119 | import os
from typing import Any, Generator, Tuple
import pytest
import pytorch_lightning as pl
import torch
import torch.distributed
from pytorch_lightning import LightningModule, Trainer
from pytorch_lightning.strategies.ddp import DDPStrategy
from torch import Tensor
from torch.nn import Linear, Module
from torch.o... |
c72fb6ff63846cf0d1ceb5722b3afb42fc8428b7c5115b76c42d7322efd5904e | Python | 3,847 | 94 | """10. Skip Finetuning by reusing part of pre-trained model
===========================================================
There is a dilemma that pre-trained public dataset detection models need finetuning
before we can apply them to our interested domain.
While it is still a chanllenging
task, in this tutorial we showc... |
a74da6425ce6d73d7f4481f519031d79d740a009463e2818025f3b92d0fb1e79 | Python | 3,848 | 100 | import torch
import numpy as np
import SimpleITK as sitk
from Phys_Seg.data_loading import load_and_preprocess, save_segmentation_nifti, read_file, save_img
from Phys_Seg.predict_case import predict_phys_seg, physics_preprocessing, image_preprocessing
import importlib
from Phys_Seg.utils import postprocess_prediction, ... |
6ff68c3b9e4a2987720bae19e371be878999c08f37a8d87f9d153f30ccba27f5 | Python | 3,850 | 74 | import argparse
import os
from train_singlebranch import Trainer
parser = argparse.ArgumentParser()
parser.add_argument("--model", type=str, default="finetune", help="train, test, finetune")
parser.add_argument("--noisetype", type=str, default='None')
parser.add_argument("--sim", type=bool, default=True) # W... |
8776198e247d001822e69412900dd1b92660ecc0e54151a0a0699d5b052be6d1 | Python | 3,850 | 97 | import numpy as np
from bertalign import model
from bertalign.corelib import *
from bertalign.utils import *
class Bertalign:
def __init__(self,
src,
tgt,
max_align=5,
top_k=3,
win=5,
skip=-0.1,
... |
177d97456a5f7d88ece161e07ab71a3f683a113c963febbc42ff408ce7fdf8bb | Python | 3,851 | 132 | # --- 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 Caps(_BaseTraceHierarchyType):
_parent_path_str = "isosurface"
_path_str ... |
2c2638a132068073cc2fe34d37adf0d3570177c9635c3b84a0c89f2712b938e1 | Python | 3,851 | 109 | import warnings
import numpy as np
import pytest
from conftest import approx, to_backend
from pyriemann.geometry.median import (
median_euclid,
median_riemann,
)
@pytest.mark.parametrize("kind", ["spd", "hpd"])
@pytest.mark.parametrize("median", [median_euclid, median_riemann])
def test_median_shape(kind, m... |
ba3802c05a9fe04fdaec38c91346d3b9a8b4cff72d0c01b928888304883b7203 | Python | 3,851 | 100 | """Floor-drift tripwire for the smoke executed-test floor (megaplan D13).
The smoke leg of ``.github/workflows/tests.yml`` attests execution with
``check_ci_executed_tests.py <junit> <floor> 0.15`` where ``<floor>`` is a
hand-written literal intended to sit at roughly HALF the smoke selection. That
literal has drifted... |
0420afc08d0627f23ad99b6da23f6786f52a1056690ad2bb6ebcc68876f6661e | Python | 3,852 | 98 | import pathlib
import numpy as np
from PyQt6 import QtCore, QtWidgets
from helpers import retrieve_data
data_dir = pathlib.Path(__file__).parent / "data"
def test_basic(mw):
"""Run the program and exit"""
pass
def test_load_bmlab_brillouin_data(mw, qtbot, monkeypatch):
paths = retrieve_data("fmt_bri... |
e59e3ff8aa74a4177a253ccb0514351746161328198f5e92e3ccec08ff4d157e | Python | 3,852 | 111 | # Asteroid Impact (c) by Nick Winters
#
# Asteroid Impact is licensed under a
# Creative Commons Attribution-ShareAlike 4.0 International License.
#
# You should have received a copy of the license along with this
# work. If not, see <http://creativecommons.org/licenses/by-sa/4.0/>.
"""
Virtual display transformatio... |
0f9bb564205dc28a99df6bfbcc07440b44ab98e47f84900a63051bfb9ba3d08f | Python | 3,853 | 128 | # -*- coding: utf-8 -*-
"""**Lightly Embed:** Embed images with one command.
This module contains the entrypoint for the **lightly-embed**
command-line interface.
"""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
import os
from typing import List, Tuple, Union
import hydra
import numpy ... |
fc905fc51aed108cf8cc1fa43035f5f1105e47435af56899ce679dfd9ef7733c | Python | 3,853 | 132 | import numpy.typing as npt
import plotly.express as px
import plotly.graph_objects as go
from ase.data import atomic_numbers, atomic_names, atomic_masses, vdw_radii
from ase.data.colors import jmol_colors
from coeffnet.postprocessing.transformations import (
OrthoCoeffMatrixToGridQuantities,
NodeFeaturesToOr... |
87d07c96daa4450caa16b867bde56a1d1b94f6167d342c4d5e4b027c9a5c8afc | Python | 3,854 | 116 | # General imports
import os
import sys
import torch
import numpy as np
import pandas as pd
import pytorch_lightning
# EUGENe imports and settings
import eugene as eu
from eugene import models, train, evaluate, settings
from eugene.models import zoo
settings.dataset_dir = "/cellar/users/aklie/data/eugene/revision/ray13... |
c3d1019ad5057313d3022e4645f536925fc3cb101cc9cd751768b7129be8b4f5 | Python | 3,854 | 100 | import cpuinfo
from carbontracker.components.handler import Handler
from typing import List, Optional
import csv
import os
from carbontracker.loggerutil import Logger
import statistics
logger = Logger()
class GenericCPU(Handler):
def __init__(self, pids: List[int], devices_by_pid: bool):
super().__init__(... |
c43bea00f912e96a394033efdb537d70be38e014a0c4499a0461a2ece8fe931d | Python | 3,854 | 123 | from collections import namedtuple
import numpy as np
import pandas as pd
ALL_PBS = range(1, 13)
Q1, Q3 = 0.25, 0.75
PB = "pb"
MUX = "well"
PIXEL_BLOCK_SIZE = 250
def add_pb_columns(data: pd.DataFrame) -> pd.DataFrame:
if "channel" not in data.columns:
if len(data.index) and "channel" in data.index.n... |
030e815ff363da1faeaa9f6a8fac9a9a85daaa88961aa31204098868d88d1643 | Python | 3,855 | 114 | from urllib.request import urlopen
import torch
from torch import nn
import numpy as np
from skimage.morphology import label
import os
from HD_BET.paths import folder_with_parameter_files
def get_params_fname(fold):
return os.path.join(folder_with_parameter_files, "%d.model" % fold)
def maybe_download_parameter... |
468572ffc03ffc1fea7f5b7572e7e426507742f4c0bd395c0f25f5825432c21f | Python | 3,856 | 109 | """W051-TRACK / AUD-CODE 2.14a: tier M activations flow under ``step=callable``.
The module forward hooks filled the collector's staging BEFORE
``optimizer.step()``; the boundary hook then opened the implicit block, which
zeroed that staging, so the documented ``step=`` spelling emitted ZERO
activations and never refu... |
01c0ad6691073e2ea360fec34385255274ac2478cbadedf44d8b16f7537dc721 | Python | 3,857 | 128 | """Regression coverage for RF built-in rule-pack initialization and restoration."""
from __future__ import annotations
import importlib
import subprocess
import sys
from collections.abc import Mapping
from pathlib import Path
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.rece... |
649afd541a7f7f473a7f9bfae30c5d0cbea1a5b3f2f05dc8a274a69deb292fc4 | Python | 3,857 | 136 | # Copyright 2020 Google Inc. 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 applicable law or a... |
871ea70b162356b61545881954b0dbbc098911d2ec95a55537cc04bab2c444a5 | Python | 3,857 | 143 | from textwrap import dedent
from caper.dict_tool import (
dict_to_dot_str,
flatten_dict,
merge_dict,
split_dict,
unflatten_dict,
)
def test_merge_dict():
d1 = {
'flagstat_qc': {'rep1': {'read1': 100}, 'rep2': {'read2': 400}},
'etc': {'samstat_qc': {'rep1': {'unmapped': 500, 'm... |
db25cceccf8f6475e9aa2c40fc8d4e59b0a03fac74d6c36d05a85ab0be3c284a | Python | 3,858 | 84 | import sys
# setting path
sys.path.append('../TM2_segmentation')
import os
import SimpleITK as sitk
import numpy as np
import functools
from skimage.transform import resize
import nibabel as nib
import numpy as np
import pandas as pd
from scripts.preprocess_utils import load_nii, get_id_and_path
def slice_to_offse... |
977e7f2124ed530d1ce37870387d099b0a02ed44c634426b4bca4992d68b1b28 | Python | 3,859 | 109 | from anndata import AnnData
from scipy.sparse import issparse
from sklearn.decomposition import FactorAnalysis
def run_fa(
adata: AnnData,
n_factors: int = 20,
tol: float = 0.01,
max_iter: int = 1000,
svd_method: str = "randomized",
iterated_power: int = 3,
random_state: int = 2108,
us... |
a638ee8c55f0ac1f30ce029c64d5a652b452e5cba66dd5d2ce9a779c3d1fdde6 | Python | 3,859 | 94 | import glob
import json
import os
import numpy as np
import argparse
from mp_dip.research.generate_features import normalise_tags, examples_for_tags
from mp_dip.utils.db_atoms_utils import read_db_atoms
from mp_dip.utils.utils import get_all_atoms, read_raw, preanalyse_raw, get_mp_book_paths
from mp_dip.utils.data_p... |
b8a9a09b07b5762559e787ff26dcb7b557d8ca42571182e6ba0bff05a87a3d6d | Python | 3,859 | 115 | try:
from dropboxdrivefs import DropboxDriveFileSystem
except ImportError:
DropboxDriveFileSystem = None
import posixpath
from typing import (
Annotated,
)
from pydantic import (
AliasChoices,
Field,
)
from galaxy.exceptions import (
AuthenticationRequired,
MessageException,
)
from galax... |
5a48c9585a18f2422701f6b5ef36db4dd0852ce2cb9341de61b5732cd40cdf6d | Python | 3,860 | 142 | # -*- coding: utf-8 -*-
from docutils.parsers.rst import roles
from .directives import (
findoutmoreref,
windowswitref,
)
from sphinx.addnodes import manpage
from sphinx.roles import (
XRefRole,
)
class HandbookRefRole(XRefRole):
"""Custom :ref: roles base class"""
refnodecls = None
refnodecl... |
5582af59d7fa01db3eab4e8e5d3a5b109ccd0b6682e553c3cc1b9db59aaf1f25 | Python | 3,861 | 101 | """Tests for the Parameter Database popup trigger in the portal header."""
from __future__ import annotations
from larvaworld.portal.panel_components import build_template_header
def _find_by_css_class(root: object, css_class: str) -> object | None:
"""Depth-first search for the first descendant carrying `css_c... |
48382e62366abc6e35ff7260d5d458037f32666c72526bce953ec0279246a010 | Python | 3,862 | 104 | from typing import Dict
import networkx as nx
import numpy as np
from nfp.frameworks import tf
from nfp.preprocessing.preprocessor import PreprocessorMultiGraph
from nfp.preprocessing.tokenizer import Tokenizer
class PymatgenPreprocessor(PreprocessorMultiGraph):
def __init__(self, radius=None, num_neighbors=12, ... |
9486f7ed62be859e30bb860cede7dce7fd5430f21017bf244a733b019faad227 | Python | 3,862 | 125 | 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,
construct_connectivity_matrix,
simulate,
... |
ec9e0013fbf7ffba06780cbe6516f8525c2ff74a4918c1ab1c07a80e510d10dc | Python | 3,863 | 95 | """
Ethoscope is a platform developed at `Gilestro lab <http://lab.gilest.ro/>`_.
It provide an integrated set of tools to acquire behavioural data on small animals and build feed back modules to interact with them in real time.
A description of the whole system is available on its `website <http://gilestrolab.github.i... |
3145cb7e37cbeefc204242c036fe558d40f5046473b91e9b98c054660d7aa5d5 | Python | 3,864 | 123 | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function
import glob
import os
import shlex
import subprocess
import sys
from multiprocessing.dummy import Pool
if sys.platform.startswith('win'):
ARGS = ['/nologo', '/D KENLM_MAX_ORDER=6', '/EHsc', '/source-charset:utf-8']
OPT_ARG... |
350e5e3c67ccce3fd9f94cddea2521dc48f246f21088b68ce1f32f6e334c333e | Python | 3,864 | 115 | import os
import tempfile
import time
import unittest
import pandas as pd
from codecarbon.emissions_tracker import (
EmissionsTracker,
OfflineEmissionsTracker,
track_emissions,
)
def heavy_computation(run_time_secs: int = 3):
end_time: float = (
time.perf_counter() + run_time_secs
) # R... |
6b82c6c4f9a5f1e258cc5af5a419d87ace5bf913bd2dbc7a54caceb71bc7f634 | Python | 3,864 | 113 | """Tests for bdpy.recon.torch.modules.optimizer"""
from __future__ import annotations
import unittest
from functools import partial
import numpy as np
import torch.nn as nn
import torch.optim as optim
from bdpy.recon.torch.modules import build_generator, ArbitraryLatent
from bdpy.recon.torch.modules import build_opt... |
cd353fd934d3cecb7376432d1da2e7f0685a6acb92ac24fe9affb67753c3b703 | Python | 3,864 | 134 | """
BASIL GUI for Oxford ASL - Code to run the oxford_asl pipeline
Copyright (C) 2020 University of Oxford
"""
import os
import sys
import shlex
import subprocess
from threading import Thread
import wx
from wx.lib.pubsub import pub
class Cmd:
""" Run a shell command """
def run(self):
""" Run the com... |
d9d8e355c78c132f64427e75f4377bd990e983dcf6e9a2032d05962ff863dede | Python | 3,864 | 98 | 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. """
fragment_bed = pybedtools.BedTool(fragmen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.