sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
275fb1f604d8d98d59bdb4e465f1482cbb86d40cbeba3c5a0bcfcee188b07ea2 | Python | 2,842 | 92 | """
Copyright (c) 2022 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE BLUE BRAIN PROJE... |
07309bc36e386534c5acb6f3cebe3e25b7c5f130e513bf200508cabcc1dd37b2 | Python | 2,843 | 82 | #!/usr/bin/env python
#=========================================================================
#
# Copyright NumFOCUS
#
# 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://... |
4928f235cdea2f343ac192800f1c63b0c1758f47da9fd15a084a5b1fe538d7af | Python | 2,843 | 94 | ### Functions for Multiscale median transform and variants
from scipy.ndimage import median_filter
import numpy as np
## TODO:
## - [ ] implement pyramidal median transform
# when s=2 in decompose_mwt
sigmaej_mwts2 = [[], # 0D
[7.2353e-01, 3.0455e-01, 1.7494e-01, 1.0408e-01, 8.2297e-02,
... |
42565fd6f92846f358ca2cdd2878e70957fffd5adc03757f755b824ce05acea6 | Python | 2,844 | 95 | # 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... |
fd974a914de54422689f5920f000a7ea2c1aca71acda51e335d1765ecf8c9baa | Python | 2,844 | 89 | #
# Code for managing session state, which is needed for multi-input forms
# See https://github.com/streamlit/streamlit/issues/1557
#
# This code is taken from
# https://gist.github.com/okld/0aba4869ba6fdc8d49132e6974e2e662
#
from streamlit.hashing import _CodeHasher
from streamlit.report_thread import get_report_ctx
f... |
185e21afd3bba181f1f8868e33982fb09720fffbeafb6369abc248b82ec46fc0 | Python | 2,845 | 76 | """Loading of Admin panel extensions."""
import logging
import os
import yaml
from pydantic import ValidationError
from galaxy.config import GalaxyAppConfiguration
from galaxy.schema.admin_extensions import AdminExtension
from galaxy.util import config_directories_from_setting
log = logging.getLogger(__name__)
CON... |
87f012c16ac1c11ee539afa58deb4b419e3b10a5070beedc85b608e07ab38391 | Python | 2,845 | 121 | """Phase 5a tests for sequential hook composition and handles."""
from __future__ import annotations
import torch
import torchlens as tl
class ReluModel(torch.nn.Module):
"""Small model with a ReLU site."""
def forward(self, x: torch.Tensor) -> torch.Tensor:
"""Run ReLU.
Parameters
... |
f6cc6439061a0385f779c385b310af6d89c6ad4c8f551ad962538dceef575cf7 | Python | 2,845 | 78 | """
utility funcs for logging
"""
from os import path
import logging
import torch
import albumentations
import sys, os
sys.path.append("../..")
# source: https://stackoverflow.com/questions/7507825/where-is-a-complete-example-of-logging-config-dictconfig
LOG_CONFIG = {
# Always 1. Schema versioning may be added ... |
e37611ea7c1d2e22d9659a16480dcddce02482fac15233efd86d977dadc5bd2a | Python | 2,846 | 95 | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function
from distutils.command.build import build
from setuptools import setup, Extension, distutils
import argparse
import multiprocessing.pool
import os
import platform
import sys
from build_archive import *
try:
import numpy
t... |
37f7e9252c48121893b3f3a5ec58afad8359f6ab088dbc5c9428cf7afc1697a3 | Python | 2,847 | 78 | #=========================================================================
#
# Copyright NumFOCUS
#
# 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/license... |
e6e5951a4ce5a98ed6a997cf6990b4777ac3b7e8cfcdf5bafa0a9fffc006b689 | Python | 2,848 | 79 | """
Gregory Way 2017
PanCancer Classifier
scripts/snaptron/process_tp53_junctions.py
Takes in snaptron data and classifier decision scores for each sample and
outputs a summarized table of snaptron exon-exon predictions for samples which
have a c.375G>T mutation in TP53.
Usage: Run by dna_damage_repair_tp53exon.sh
O... |
20f383a95e7d2edcac1a8519e3f26a357878794b86a5c673c14c381d00c7dcc1 | Python | 2,849 | 76 | from keras.src import ops
from keras.src.api_export import keras_export
from keras.src.backend.common import set_keras_mask
from keras.src.layers.layer import Layer
from keras.src.saving.serialization_lib import deserialize_keras_object
@keras_export("keras.layers.Masking")
class Masking(Layer):
"""Masks a sequen... |
5d24e6dcc6f7f59ec32ae9984afce341b977aa54542164e0948254b30207af9e | Python | 2,849 | 90 | #!/usr/bin/env python3
import os
import sys
f_1 = open(sys.argv[1], "r", encoding = "utf-8")
f_2 = open("candidate_probes.txt", "r", encoding = "utf-8")
o_1 = open("tmp.txt", "w", encoding = "utf-8")
i = 0
probe_dict = {}
for file_1 in f_1:
line_1 = file_1.strip().split(',')
if len(line_1) >= 52:
if ... |
09dc6f7409de797a4ab2a087e0cfbd39bc780b5e75ee9774e25cf14d3d923976 | Python | 2,850 | 63 | import os, sys
import numpy as np
from scipy import stats
from scipy.signal import welch
import matplotlib; matplotlib.use("Agg")
import matplotlib.pyplot as plt
ROOT = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, ROOT); sys.path.insert(0, os.path.join(ROOT, "src"))
from data_loader_01 import CANONICA... |
88fedbc4e2d95b63638876a38ab47aeb3bbf1955103be5967d90e35bbc530e1d | Python | 2,850 | 85 |
"""
This script converts compressed DICOM files to images.
Lots of code came from here:
https://groups.google.com/forum/#!topic/pydicom/PJ9K37dsmBk
I used this to convert images from my CT to somthing ImageJ can easily open.
https://github.com/pydicom/pydicom/blob/master/examples/input_output/plot_read_dicom.py
pip i... |
9b85baabbe069cd14240eb2f85ee454e808419d2ef92a756944364b541d93648 | Python | 2,850 | 99 | """
State model behind the interactive arena canvas.
Holds the arena, the placed objects and the preview overlays as plain data, so
that the canvas rendering and the configuration mapping share one source of
truth.
"""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Liter... |
d6149a0ce06c487c4d9890cd875957f3f9d4bf63380ad35f580c0ddd9c927585 | Python | 2,850 | 129 | """
save.py
Create directory and path for figure savings and
exporters.
"""
import os
import pickle as pkl
###################################################################################################
###################################################################################################
def sav... |
0ecb1d8323c63cb58211a8ef9b0aea66d3a6201fe550f7fce1349c7842b2cd29 | Python | 2,851 | 70 | import os
import argparse
import torch
import torch.nn as nn
import torch.distributed as dist
import torch.optim
from tensorboardX import SummaryWriter
from gluoncv.torch.model_zoo import get_model
from gluoncv.torch.model_zoo.pose import directpose_resnet_lpf_fpn
from gluoncv.torch.data.pose import build_pose_train_l... |
454a4f4abd6653f804f83c9f0a3b79740116b77bc6a6a5e94193f04a408fc14c | Python | 2,851 | 79 | from codecarbon.external.logger import logger
from codecarbon.output_methods.base_output import BaseOutput
from codecarbon.output_methods.emissions_data import EmissionsData
class LogfireOutput(BaseOutput):
"""
Send emissions data to logfire
"""
def __init__(self):
try:
from logfi... |
7467e167493a1fe3820cad5718eae14999ab6b4f74a32fb4a90adc34d541a9e7 | Python | 2,851 | 100 | """
====================================================================
ERP EEG decoding in Tangent space.
====================================================================
Decoding applied to EEG data in sensor space decomposed using Xdawn.
After spatial filtering, covariances matrices are estimated, then project... |
9c10c58480628dd9d88ddc6d8a7e0b219ffd2db7e3678bb8a16713fc0f0e5c21 | Python | 2,851 | 85 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
r"""
Utility class to merge multiple PyTorch ``Dataset``\ s.
For usage examples see the documentation of :class:`.M... |
82987eaee0374ec42425a627a4df533c3ffd417dd80ccc653921486f05a82a5f | Python | 2,852 | 87 | # 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 pytorch_lightning as p... |
0bd4401282130685868a6d2ab966d64c04195162a2bd2a7d181b892308ed0603 | Python | 2,854 | 70 | """
The scaler for the regression task.
This implementation is adapted from
https://github.com/chemprop/chemprop/blob/master/chemprop/data/scaler.py
"""
from typing import Any, List
import numpy as np
class StandardScaler:
"""A StandardScaler normalizes a dataset.
When fit on a dataset, the StandardScaler le... |
b0a5d0ce7e415bb23a2dc41bd9f55d4e7c338e7a33980f9b76fa240856f2174d | Python | 2,854 | 87 | import os
from base64 import b64encode
from tempfile import NamedTemporaryFile
from unittest.mock import patch
import pytest
import t.skip
from celery.utils import term
from celery.utils.term import _read_as_base64, colored, fg, supports_images
@t.skip.if_win32
class test_colored:
@pytest.fixture(autouse=True)... |
b8c6ecd533c5c31a7cdb87c50b62e1eb8f0bc6ca21b5f1d60fb29b6eb3797d75 | Python | 2,856 | 107 | # -*- coding: utf-8 -*-
# @Author: Guillaume Viejo
# @Date: 2023-07-10 14:38:27
# @Last Modified by: Guillaume Viejo
# @Last Modified time: 2023-07-11 16:00:06
"""Tests of IO folder functions"""
import json
import shutil
import warnings
from pathlib import Path
import numpy as np
import pandas as pd
import pytes... |
54176afc7c020124603d105e47f6fad4466baa40f9ec99b9ee27f22c05574966 | Python | 2,857 | 68 | #=========================================================================
#
# Copyright NumFOCUS
#
# 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/license... |
faa5668316b2b427285cd99914694200bdf0213b86b028256ea27281944d4b4f | Python | 2,857 | 88 | import copy
from typing import Any
import numpy as np
import pandas as pd
from mirp._images.generic_image import GenericImage
from mirp._imagefilters.generic import GenericFilter
from mirp._images.transformed_image import TransformedImage
from mirp.settings.generic import SettingsClass
class LogarithmTransformedIma... |
0e9f628dca44a877bb84c41e5e29d7b2f4ec40e53d251c6c3f3bbd2a174d0855 | Python | 2,858 | 83 | import json
import re
import matplotlib
import numpy as np
from matplotlib import pyplot as plt
from angorapy.common.const import QUALITATIVE_COLOR_PALETTE as COLORS
import statsmodels.stats.api as sms
from angorapy.utilities.util import stack_dicts
font = {'family' : 'Times',
'weight' : 'normal',
's... |
62a7e78da8b26c1f6bd9bd7cce8e5c424691082bfda99238e911077a82e5bde2 | Python | 2,858 | 87 | # --- 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 Textfont(_BaseTraceHierarchyType):
_parent_path_str = "bar.selected"
_pat... |
631a67b0d8f397a4c8b2e976cfcf4db2b2249ec9eb6116926ccf83fbd76ff795 | Python | 2,858 | 75 | """
Base class for plugin-UI components.
SimplyFire - Customizable analysis of electrophysiology data
Copyright (C) 2022 Megumi Mori
This program comes with ABSOLUTELY NO WARRANTY
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
... |
a0be52884e7317299fee925eda57fbe11c22c0d06201fe15517b3495ca2c7870 | Python | 2,858 | 104 | import equinox as eqx
import jax.numpy as jnp
from cvsx.unit_conversions import convert
class RespiratoryPatternGenerator(eqx.Module):
hb: float = convert(1.0, "1/l")
a: float = -0.8
b: float = -3.0
alpha: float = 1.0
lam: float = convert(1.5, "mmHg")
mu: float = convert(1.0, "mmHg")
beta... |
ea2212f222beac51955833e8c9f0bedef2c1593cccf525fb992a5b48a420d560 | Python | 2,859 | 77 | """Deployment envelope (lane F37): PEFT/LoRA verification.
PEFT had ZERO mentions in TorchLens before this lane. These tests pin the
verified story: a LoRA-wrapped model captures with output parity, adapter
modules appear in the hierarchy, adapter parameters attribute to their
addresses, forward replay validation pass... |
d0d953d98a3495ff3c7de06fb98dda1aebde7ecca84772866afb878031fa52ea | Python | 2,860 | 103 | # Example::
# >>> R = A.apply_async()
# >>> list(joinall(R))
# [['A 0', 'A 1', 'A 2', 'A 3', 'A 4', 'A 5', 'A 6', 'A 7', 'A 8', 'A 9'],
# ['B 0', 'B 1', 'B 2', 'B 3', 'B 4', 'B 5', 'B 6', 'B 7', 'B 8', 'B 9'],
# ['C 0', 'C 1', 'C 2', 'C 3', 'C 4', 'C 5', 'C 6', 'C 7', 'C 8', 'C 9'],
# ['D 0', 'D 1', '... |
3ad021a68b10903e6ded3d8b7d7b01370cf546e78ff83e5164ed595723cedc3d | Python | 2,861 | 83 | from pyevtk.hl import imageToVTK
import numpy as np
import pandas as pd
import skimage.morphology
import skimage.draw
data_3d = pd.read_csv("test.csv", sep = ";")
print(data_3d)
#remove negative/ to small z coordinates
annotated_macrophages = np.zeros((np.max(data_3d['# time_point'])+1,1024,1024,256))
data_3d = da... |
60e2d0b0117b8433274dd5e83c0b0cd593d9f5708ef28e48bbfce48d236846ca | Python | 2,861 | 64 | import os
import XML_Parse as parse
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#######################################################################################################################
# Analysis Functions
def euclidean_distance_formula(x1,y1,z1,x2,y2,z2):
"""The purpos... |
a72afefd13e947eeb240de57df6f448b0ae68cf83a0a1f95d08eaa0a485beb2f | Python | 2,861 | 104 | # --- 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 Title(_BaseLayoutHierarchyType):
_parent_path_str = "layout.scene.yaxis"
... |
b38446f6a76b9954883931302e773d0d319a14e65c57470175fc49810ea1b64a | Python | 2,861 | 104 | # --- 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 Title(_BaseLayoutHierarchyType):
_parent_path_str = "layout.scene.xaxis"
... |
bac03c2ab7a5126dc3fbac74b551e89e77963d0e5743388240d26633b0198819 | Python | 2,861 | 104 | # --- 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 Title(_BaseLayoutHierarchyType):
_parent_path_str = "layout.scene.zaxis"
... |
1266ac6538ee13c1571a33311dded1019f48c470eb3c6c740fada8c02d70fa9b | Python | 2,862 | 87 | import pandas as pd
from pathlib import Path
from argparse import ArgumentParser
if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument(
"--result_dir",
type=str,
required=True,
help="Full path to directory that contains directories with results for each fold"
... |
53882cd86ba70e0e5c820929dbda9ceec311ef61f105a508269a359fdb68c88e | Python | 2,862 | 75 | import comedi
import subprocess, datetime
from pyoperant.interfaces import base_
from pyoperant import utils, InterfaceError
class ComediInterface(base_.BaseInterface):
"""docstring for ComediInterface"""
def __init__(self,device_name,*args,**kwargs):
super(ComediInterface, self).__init__(*args,**kwar... |
f572d31dce16d23d194a09e58b1a74bc29781d4c40541db8fa28709b7fb94669 | Python | 2,862 | 82 | import copy
from mirp._data_import.numpy_file import ImageNumpyFile, MaskNumpyFile
from mirp._data_import.generic_file_stack import ImageFileStack, MaskFileStack
class ImageNumpyFileStack(ImageFileStack):
def __init__(
self,
image_file_objects: list[ImageNumpyFile],
**kwargs
... |
66429902b396ef3630838fd495c1b52839848af06a544825008eb2f8a08c2622 | Python | 2,863 | 105 | """
This module start slurm job on the cluster
"""
import os
import argparse
FOLDER_CONFIG_FILE = "data/models/fine_tune_models/"
# Specification of the argument to specify when you launch the script
parser = argparse.ArgumentParser()
parser.add_argument(
"cluster_type", help="It is a Slurm(slurm) or a Oar cluste... |
711ff2c7f473989fbcc4ffc8bc6b03379b29dfe1cab261ef6ab09f9576a4e495 | Python | 2,864 | 85 | """Smoke test for DisabledBackend chain failure handling.
Regression test for issue where _fail_chain() called get_state() for plain chain
elements, causing NotImplementedError with DisabledBackend.
"""
from __future__ import annotations
import uuid
from time import monotonic, sleep
import pytest
from pytest_celery... |
2cc1bfb48a8c41b026a3f54fede26387e420728b1fba8fbdd2e9d116b88ba606 | Python | 2,865 | 69 | import sys
sys.path.append('./utils')
sys.path.append('./graphs')
sys.path.append('./dataset')
import pandas as pd
import argparse
# import featurizer
from featurizer import MolecularGraphData, SMILESToECFP4
import graphalgos
import torch
from torch_geometric.data import Data
from torch.utils.data import DataLoader, Te... |
65bf8b921069eb22c8de1430b47bb336d916cf2f99d5ca4e6950db9c389f1f6e | Python | 2,865 | 65 | import unittest
import tempfile
from random import uniform, choices
from svim.SVIM_clustering import form_partitions, partition_and_cluster
from svim.SVSignature import SignatureDeletion
from svim.SVIM_input_parsing import parse_arguments
class TestSVIMClustering(unittest.TestCase):
def setUp(self):
self... |
a8d5622435cc099211f6846a742b8ef278be78a6a88884ce9dda0943b75f3c52 | Python | 2,865 | 98 | """Dataset utilities."""
from typing import List, TypedDict, Union
import hashlib
import inspect
import os
import subprocess
import urllib.request
from tqdm import tqdm
class FileDict(TypedDict):
name: str
url: str
md5sum: str
def download_file(url: str, destination: str, progress_bar: bool = True, m... |
74d39c628cfffc33026e2f90f770b125f7055885f3b2d7993764beed003d2e78 | Python | 2,867 | 116 | """Configuration file for pytest."""
import os
import shutil
import pytest
import numpy as np
from specparam.modutils.dependencies import safe_import
from specparam.tests.tdata import (get_tdata, get_tdata2d, get_tdata2dt, get_tdata3d,
get_tfm, get_tfm2, get_tfg, get_tfg2, get_tft... |
aeef38be9b0fd14f4a98567c2ab32df6a7179eb7979db0751f41d7bc84c0adc8 | Python | 2,868 | 96 | from rdkit import Chem
from rdkit.Chem import AllChem
"""Code to perform molecule standardization, and curation."""
def main(smiles, remove_salts=True, sanitize=True, neutralize=True):
# initialize the outputs
salt = []
failed_sanit = []
neutralized = []
# performs the molecule preparation based... |
de3d7e63a301b0ef40129ce93109c9c607d62bae5b7a657df4564d255ff04527 | Python | 2,868 | 72 | import torch
import numpy as np
from brainbox import trainer
from stack import models, loss
class Trainer(trainer.Trainer):
def __init__(self, root, model, train_dataset, n_epochs, batch_size, lr, loss_type, lam, lam0=None, crop=10, detach_target=False, device="cuda", id=None, pred_steps=1, lam_activity=10**-7)... |
4b8358f03d831e9fd863ea13e70ca705856fb26daa56e41aa6bf21f3a87f8cc0 | Python | 2,869 | 67 | """
Usage:
From within the training/ directory, call this script as a module:
$ python3 -m deepspeech_training.util.check_characters "INFILE"
e.g. $ python3 -m deepspeech_training.util.check_characters -csv /home/data/french.csv
e.g. $ python3 -m deepspeech_training.util.check_characters -csv ../train.csv,... |
6f48d2142095886841d515a78b7e7f34c907dd8fa66d9ad5eb8f0318c6a00e3b | Python | 2,869 | 78 | #!/usr/bin/env python
from __future__ import absolute_import
import locale
import logging
import os
import warnings
import sys
# 2016-06-17 barry@debian.org: urllib3 1.14 added optional support for socks,
# but if invoked (i.e. imported), it will issue a warning to stderr if socks
# isn't available. requests uncond... |
b244e4235112cf2e41d927b124452dd777c26cb30b0e426d9b3445d8e893045c | Python | 2,869 | 88 | import torch
import torch.nn as nn
from modular_splicing.utils.construct import construct
from modular_splicing.models.modules.activations import activation_types
from .sparsity import SparseLayer
class SpatiallySparseByChannel(SparseLayer, nn.Module):
"""
Spatially sparse by channel.
This is a sparse ... |
054645ee0e9e474bdce077bd7f72d85058cdf182996d1829291c7c391b0cbd58 | Python | 2,872 | 88 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2023 The NiPreps Developers <nipreps@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... |
31c8e897a6e9960a50dd1d61a77a2bdc642a09865ddd0da8a15f34939b12a300 | Python | 2,872 | 103 | import pathlib
from collections import namedtuple
import pytest
import numpy as np
from bmlab.session import Session
from bmicro.gui.main import BMicro
def data_file_path(file_name):
return pathlib.Path(__file__).parent.parent / 'data' / file_name
Event = namedtuple('Event', 'xdata ydata')
@pytest.fixture
... |
f02720a7055757fe29cf477ac3354068fc2bb72f58f81cb15f1f2711fd0f690e | Python | 2,872 | 71 | """Accuracy metirc with ignored labels."""
# pylint: disable=assignment-from-no-return
import numpy as np
from mxnet import ndarray
try:
from mxnet.metric import EvalMetric, check_label_shapes
except ImportError:
from mxnet.gluon.metric import EvalMetric, check_label_shapes
class Accuracy(EvalMetric):
"""... |
052df4efaad0d8be856b906e493199f8f901156cfe8049815fa5c5e9fb85906b | Python | 2,873 | 75 | """
Created on 15/07/2014
@author: Andrew Robinson
"""
import abc
class AuthProvider(metaclass=abc.ABCMeta):
"""A base class for all Auth Providers."""
@property
@abc.abstractmethod
def plugin_type(self):
"""Short string providing labelling this plugin"""
@abc.abstractmethod
def au... |
7682c7c916a2f23fd0afaf808e5e9f75d6db6c2e2a49c56b865ec09b1e694e1f | Python | 2,873 | 98 | """
Demonstration app exercising the generic conftype editor.
"""
from __future__ import annotations
from typing import Any
import panel as pn
import param
from larvaworld import CONFTYPES
from larvaworld.lib import reg
from larvaworld.portal.config_widgets.conftype_widget import build_conftype_widget
def _unsupp... |
193d669c0a77716c046732059a0fad7e2085b7c908a2a18a10e4509cee7f029c | Python | 2,874 | 97 |
from Bio.PDB import MMCIFParser
from Bio.PDB.MMCIF2Dict import MMCIF2Dict
import pandas as pd
import base.configs as configs
AA3C = list(configs.AMINOACIDS.keys())
def load_mmcif(file_path, aa3c = AA3C):
chain_, residue_, position_, atomName_, x_, y_, z_ = [], [], [], [], [], [], []
occupancy_ , bfactor_ ,... |
7e558a733d6b1e9f6dbe806cf6af1975c1d8030e1ee07ebbeb282592290eea09 | Python | 2,874 | 71 | """Regression tests for r20l IR docstring/consistency polish (N11, N12).
These lock the documented (and deliberately divergent) semantics of the
same-named ``backend`` field on ``DtypeRef`` vs ``DeviceRef`` (N11) and the
presence of the ``output_of_module_calls`` field plus its docstring entry on
``RecordContext`` (N1... |
c4dd90afe4c4a75d8ff0060ee968a0c45af9a7c9093d451bd1fe545f716d1e32 | Python | 2,874 | 146 | """Abstract classes."""
from abc import ABCMeta, abstractmethod
from collections.abc import Callable
__all__ = ('CallableTask', 'CallableSignature')
def _hasattr(C, attr):
return any(attr in B.__dict__ for B in C.__mro__)
class _AbstractClass(metaclass=ABCMeta):
__required_attributes__ = frozenset()
@... |
c8fb4e63e6d755c37d3d35366dfb06726e1fa06e95d30d3432185acdfa33f7cc | Python | 2,874 | 51 | ##########################################################################
## ##
## Copyright (c) 2022 Philipp Lösel. All rights reserved. ##
## ##
## This file is par... |
d5f68b06b347533788d0afa215271d9d7918c2df89a94eab6b708c7315209b04 | Python | 2,875 | 104 | # --- 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 Title(_BaseLayoutHierarchyType):
_parent_path_str = "layout.ternary.caxis"
... |
db97b5c4ea6b32112d0b589484264b543d814bfe5c4b318249a1074ebf6d46a8 | Python | 2,875 | 104 | # --- 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 Title(_BaseLayoutHierarchyType):
_parent_path_str = "layout.ternary.aaxis"
... |
f81665d33fe44134afbfd8b1cf18b8fea8bb21b9506ef627f4c1122e6abbec63 | Python | 2,875 | 104 | # --- 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 Title(_BaseLayoutHierarchyType):
_parent_path_str = "layout.ternary.baxis"
... |
58b1f467247a0da7334c19265bd5559f2436c2302b14473f6e9eb390a179680d | Python | 2,877 | 121 | # --- 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 Center(_BaseLayoutHierarchyType):
_parent_path_str = "layout.scene.camera"
... |
dc3fbff667ffe8645b3321723ab969b5df02a4220c7c09e543e9b18cad43635e | Python | 2,877 | 97 | from __future__ import annotations
import panel as pn
import pytest
from larvaworld.portal import notebook_launch_app
@pytest.fixture
def onload_callbacks(monkeypatch: pytest.MonkeyPatch) -> list:
callbacks: list = []
monkeypatch.setattr(
notebook_launch_app.pn, "extension", lambda *args, **kwargs: ... |
e216e1e4f5303ec994f9f57884a13a055beffa648d878df027c65694e592e42d | Python | 2,877 | 81 | import matplotlib
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
from os import path, makedirs
import warnings
class ICAPlotsIPython:
def __init__(self, ica, source, samples_window, exclusive_components, output_dir):
self.ica = ica
self.source = source
self.samples_window ... |
0c336293d60fa758014956d14470366c96815598f280fd2165fe79cc04e870df | Python | 2,878 | 96 | from typing import Generic, TypeVar
from uuid import UUID
from dependency_injector.wiring import Provide, inject
from fastapi import APIRouter, Depends, Header, Query
from fastapi_pagination import Page, paginate
from fastapi_pagination.default import Page as BasePage
from fastapi_pagination.default import Params as B... |
0e1061725e5647bfa8b025c218956feb7cd5c30193c3eca0630581e3cb5d53dd | Python | 2,878 | 82 | ''' Module to extract morphometrics about diameters of cells.'''
from itertools import chain
import numpy as np
from neurom import get
from neurom.core import Tree, iter_neurites
from neurom.core.types import tree_type_checker as is_type
from neurom.morphmath import segment_length, segment_radius
from tns.morphio_ut... |
39231285703de3acc6b90aa17ca800117b7b02c43980b235a2aaadb10aacfc84 | Python | 2,878 | 95 | """
_framework_core — single source of truth for the framework's compute functions.
Importing pattern:
from _framework_core import compute_phi_5d, gc_matrix, PHI_REF
from _framework_core.signal_io import fft_resample, bandpass_filter
from _framework_core.constants import EPOCH_SAMPLES, FS_TARGET
Consumer... |
4e7ea69d55babf912f3792c20ddd4a698bf9ab7d66999cc79ab2fc9afe8d8d91 | Python | 2,878 | 122 | # --- 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 Up(_BaseLayoutHierarchyType):
_parent_path_str = "layout.scene.camera"
... |
b47b7e66da567b0679737fe8c0450517529d3057ae8bb081c069b9f8e6cdb247 | Python | 2,878 | 87 | # --- 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 Textfont(_BaseTraceHierarchyType):
_parent_path_str = "scatter.selected"
... |
a8b3e3506a3c1a9c7c54da7238d921199e2bdcbf86a1be9bebd07c17e7442f67 | Python | 2,879 | 117 | #!/usr/bin/env python
import io
import os
import re
import sys
try:
from Cython.Build import cythonize
except ImportError:
cythonize = None
from setuptools import setup, find_packages, Extension
try:
import cv2
except ImportError:
cv2 = None
with_cython = False
if '--with-cython' in sys.argv:
if no... |
ccf4b7e82b27a5d5b98a48bed62252f18a2f551d4ebf5bd88c60be73738809ac | Python | 2,879 | 106 | """
====================================================================
One Way manova time
====================================================================
One way manova to compare Left vs Right in time.
"""
import numpy as np
import seaborn as sns
from time import time
from pylab import plt
from mne import E... |
d1f3df8460b08d30d94044eae487cdc3ecc1a46f7ca267705c6b8d76e9bacfb9 | Python | 2,879 | 74 | from unittest import mock
from PyQt6 import QtCore, QtWidgets
import pyjibe.fd.main as fdmain
def test_autosave_override_remembered_across_instances(qtbot, tmp_path):
# Ensure test isolation: this is a session-level value (class attribute),
# so we must reset it explicitly at the start of the test.
fdma... |
8da6e650f2880ffbd1b7f7948390b4bba059b27d875bc79bdb415c6f9a3de3aa | Python | 2,880 | 83 | #!/usr/bin/env python
import unittest
import numpy as np
from numba.typed import List
from stlearn.tl.cci.base import lr_core
def _reference_lr_core(spot_lr1, spot_lr2, neighbour_lists, min_expr, spot_indices):
"""Plain-numpy oracle for lr_core's intended semantics (slow but obvious)."""
n_rows = len(spot_... |
e2e1a10acbc796f4c771fcb42fe9d88e98e5bef7dcc363fdfda540514ebcecfa | Python | 2,882 | 91 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Build the sccdftb.dat file for each molecule.
The sccdftb.dat must point to the files corresponding to the atom ... |
8b5207f2a19417bb388c93e11cc7d572fc7251d7d307b63afae3e1fd4447cfc3 | Python | 2,883 | 76 | from datetime import datetime, timedelta, timezone
import pytest
from celery.exceptions import CPendingDeprecationWarning
from celery.utils.iso8601 import parse_iso8601
def test_parse_iso8601_utc():
dt = parse_iso8601("2023-10-26T10:30:00Z")
assert dt == datetime(2023, 10, 26, 10, 30, 0, tzinfo=timezone.utc... |
a66f323090f5707092002260aedc3e21b25981eb50a6f210ce58bca7a61778a7 | Python | 2,883 | 87 | # --- 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 Textfont(_BaseTraceHierarchyType):
_parent_path_str = "barpolar.selected"
... |
cc3444a45e04e955b89b928e054a97b21abc6294f93126e5e639ab07f28aa9d3 | Python | 2,883 | 80 | # 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... |
ee589058b4ea24a4e13004153f75306599fae90e945601ec1288925438f74bd6 | Python | 2,883 | 90 | from typing import List
import logging
import os
import copy
import numpy as np
from pymatgen.core.structure import Molecule
from pymatgen.io.ase import AseAtomsAdaptor
import ase.io as ase_io
from ase.neb import NEB
from instance_mongodb import instance_mongodb_sei
logger = logging.getLogger(__name__)
logger.... |
19ecafd6223823acd61a043a36482e90f5863404fb123fec7b7e382d4061f517 | Python | 2,884 | 97 | 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_to... |
6b5af8d41163ac7b1ee94b1e87b71ab400096af89ed52d166c79a14fbca415cd | Python | 2,884 | 91 | #!/home/ubuntu/miniconda2/bin/python
from __future__ import division
import sys
import glob, os, gc
import uuid
import os.path
import csv
import numpy as np
from time import time
from subprocess import (call, Popen, PIPE)
from itertools import product
import shutil
import re
import pickle
from boto3.session import Ses... |
15331da55bbf68ea230ba5268287cc2763aa190c802f6c88247d0311f1cb597b | Python | 2,885 | 80 | from __future__ import annotations
import panel as pn
import pytest
from larvaworld.lib.param.enrichment import EnrichConf
from larvaworld.lib.reg.generators import ExpConf
from larvaworld.portal.config_widgets import build_enrichment_widget
from larvaworld.portal.config_widgets.conftype_widget import ConftypeWidgetC... |
565a9ba74074dfda9068c26efc77328cb5816071591f0c9da81fd6952bcec173 | Python | 2,885 | 73 | """.. _lightly-tutorial-export-labelstudio:
Tutorial 10: Export to LabelStudio
=============================================
This tutorial shows how you can easily label all images of a tag from Lightly
using the open-source data labeling tool `LabelStudio <https://labelstud.io>`_.
What you will learn
-------------... |
86af946a3b0860d42b9298fe83cc2b6bf7f33cd26fe548772172304b8d7e174a | Python | 2,885 | 92 | """
This vendored script comes from scikit-learn:
https://github.com/scikit-learn/scikit-learn/blob/master/doc/sphinxext/github_link.py
"""
import inspect
import os
import shutil
import subprocess
import sys
from functools import partial
from operator import attrgetter
def _get_git_revision():
git_cmd = shutil.w... |
4ef7a6fa705eca4bdc2282a368e8194b6971673282278770edaaadc79caa47c1 | Python | 2,886 | 80 | import warnings
def parse_parallel_backend(backend: None | str, num_cpus: None | int, ray_allowed: bool = True) -> str:
from mirp.utilities.parallel_ray import ray_is_available, ray_is_initialized
from mirp.utilities.parallel_joblib import joblib_is_available
if num_cpus is None or num_cpus <= 1 or backen... |
6ed2b591ca2677bb48a8cd2b4229de6bb6a68b3a3892ba092755e989623abb30 | Python | 2,886 | 74 | # This file is part of ASMC, developed by Pier Francesco Palamara.
# ASMC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# ASMC is d... |
6f1c62fd7fa7f98e0aae6964191ffd69f72f15d205d5f278797c22582960f45b | Python | 2,886 | 73 | from __future__ import division
import unittest
import numpy as np
from wyrm.types import Data
from wyrm.processing import select_epochs
from wyrm.processing import swapaxes
class TestSelectEpochs(unittest.TestCase):
def setUp(self):
ones = np.ones((10, 5))
channels = ['ca1', 'ca2', 'cb1', 'cb... |
de26aa860bc12fa2e7828119d980734b18ba8e4f8e68c3ca7a755d26fbaa17f3 | Python | 2,886 | 86 | __author__ = "quentin"
import logging
import traceback
import numpy as np
from ethoscope.utils.debug import EthoscopeException
from ethoscope.utils.description import DescribedObject
class BaseROIBuilder(DescribedObject):
def __init__(self):
"""
Template to design ROIBuilders. Subclasses must ... |
9d4a82f028babbafeb4f41b62d4f8703196498bdd201b04c0b81ec08899dc907 | Python | 2,887 | 104 | import psutil
import time
import os
FROM_WATTs_TO_kWATTh = 1000*3600
class RAM():
"""
This class is the interface for tracking RAM power consumption.
The RAM class is not intended for separate usage, outside the Tracker class
"""
def __init__(self, ignore_warnings=False):
"""
... |
d1d426700ab50a9a15bdbfb7af76d4380eedf68d2d8aad00ae9a872b2075d04a | Python | 2,887 | 80 | import argparse
import os
from sklearn.model_selection import train_test_split
def get_basename(f):
return os.path.splitext(os.path.basename(f))[0]
def pair_files(images_dir, labels_dir):
img_files = [f for f in os.listdir(images_dir)]
lbl_files = [f for f in os.listdir(labels_dir)]
image_dict = ... |
17b885723524a47512c2eeca1f3abe538464d405b4ecfe50dc7d1ad6f499cc9c | Python | 2,888 | 94 | import warnings
class deprecated(object):
"""Mark a function or class as deprecated (decorator).
Issue a warning when the function is called/the class is instantiated and
adds a warning to the docstring.
The optional extra argument will be appended to the deprecation message
and the docstring. N... |
cf26ba3c75310ac15168967c8b87080f94977dfe57dd93d03ee4484452a49d11 | Python | 2,888 | 87 | # --- 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 Textfont(_BaseTraceHierarchyType):
_parent_path_str = "scattergl.selected"
... |
d9f48c4eef9e60d2317424de228751f003e0d5cb0c24c0adcbef45e97f79f9a6 | Python | 2,888 | 87 | # --- 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 Textfont(_BaseTraceHierarchyType):
_parent_path_str = "histogram.selected"
... |
67b118dc0b04fff1e24f308f61619f5598f71463e2520843efc005b16b7bec43 | Python | 2,889 | 92 | import torch
from tqdm import tqdm
import numpy as np
from interpretability.utils import (
set_hook_to_get_repr_all_layers,
load_sequences,
load_model_and_vocab,
)
import pickle as pkl
from sklearn.decomposition import NMF
import inspect
from interpretability.create_NMF_projector import get_all_tokens_repr
... |
8bbb07e72193aa3a7063e2d543bff1474f32aa7a34f1974b666d2466219c9ec8 | Python | 2,889 | 69 | """
Run MegIn's maxfilter program on the data.
"""
import sys
sys.path.append('..')
import os
import subprocess
import argparse
import mne
from config import fname
import pandas as pd
# Be verbose
mne.set_log_level('INFO')
# Handle command line arguments
parser = argparse.ArgumentParser(description=__doc__)
parser.add... |
95d180fa1b58f2c4b26e58c54417769ee8bb596cdd6832c7f30998072e07eac2 | Python | 2,889 | 89 | from __future__ import annotations
import datetime as dt
import os
import random
nfns = 4 # Functions per class
nargs = 4 # Arguments per function
def generate_dummy_code_pybind11(nclasses=10):
decl = ""
bindings = ""
for cl in range(nclasses):
decl += f"class cl{cl:03};\n"
decl += "\n"
... |
a3f2b3c1ed274aa60b2212c949c910d3d87b5560068f3a3c0fe080b2507d316d | Python | 2,890 | 92 | # coding=utf-8
# Copyright 2025 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
b85ff47635d545c33923f84afca05e760121e4fc97488e02e8e95ce2a7c60854 | Python | 2,890 | 106 | from tempfile import NamedTemporaryFile
import polars as pl
import polars.testing as pl_testing
from pytest_cases import parametrize_with_cases
import seqdata as sd
def bed_bed3():
bed = pl.DataFrame(
{
"chrom": ["chr1", "chr1", "chr1"],
"chromStart": [1, 2, 3],
"chro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.