sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
f2b9feb6d57fd794a1204d7f33f63114376d872bc5118312272a3defdc20ac65
Python
26,957
776
"""Hardening tests for the technical-preview MLX backend.""" from __future__ import annotations import os import sys from pathlib import Path from typing import Any import numpy as np import pytest if sys.platform != "darwin" and os.environ.get("TORCHLENS_RUN_UNSTABLE_MLX_TESTS") != "1": pytest.skip( "M...
8f0e2d843cb901a604d17dbccde1dee5409644090f2d25ca36638c1f036c21d4
Python
26,965
784
from __future__ import annotations import numpy as np import pytest from larvaworld.portal.canvas_widgets.environment_canvas import ( DEFAULT_LARVA_COLOR, EnvironmentCanvas, STATIC_LARVA_GROUP_MEMBER_HALF_LENGTH, ) from larvaworld.portal.canvas_widgets.environment_models import ( CanvasArena, Canv...
d76c22623f9080c2992021d4074c6a3f766fe1c8f9922fad10a4d5743f6a9462
Python
26,998
644
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created in December 2018 @author: Quentin Lutz <qlutz@enst.fr> @author: Nathan de Lara <nathan.delara@polytechnique.org> @author: Thomas Bonald <bonald@enst.fr> """ from csv import reader from typing import Dict, List, Tuple, Union, Optional from xml.etree import Elem...
da960c5792daf2f1cef8c14113d9c95c8ce389a9689abb395fe867f4054d0ba1
Python
27,017
692
from __future__ import annotations import os import typing as t from collections import defaultdict from functools import update_wrapper from .. import typing as ft from .scaffold import _endpoint_from_view_func from .scaffold import _sentinel from .scaffold import Scaffold from .scaffold import setupmethod if t.TYP...
8b692d2aecbefb9e2dbf96f35c8d1b4dad1fdb7ef89320459ef76a9c6f434ed3
Python
27,031
529
# Created by: Pieter Barkema # Date: February, 2022 # Description: # This file creates a GUI for uploading and processing neuroimaging data # with normative modelling. The backend computes results and returns them to # users accessing from all over the world. # It is hosted as a website from a remote gunico...
c2ae6f248d251f2177047ae162a0654d2a5328171ef6a0a0e48ffbce5dc6445f
Python
27,031
753
# -*- coding: utf-8 -*- """Benchmark Results Updated: 13.02.2023 ------------------------------------------------------------------------------------------ | Model | Batch Size | Epochs | KNN Test Accuracy | Time | Peak GPU Usage | -----------------------------------------------------------------------...
9942072af35170b70f1ced884c76538aadd5cb906e37a52158940a51fc6d9bc5
Python
27,035
654
#!/usr/bin/env python3 """ Dx AK — all-cohorts epoch-count sensitivity. Extension of Dx AJ from a single-cohort variation (figshare) to all-cohorts simultaneous variation. For each cohort we re-extract per-epoch 5D features and per-epoch CAR data, then aggregate to K in {2, 3, 5, 7, 10}; for each K we plug the K-epoch...
5dd53cc52fd2ee94828daaab221e0a3754f8f85cd3964f55c4fb2aafc3472cc0
Python
27,041
639
import math import time import ipdb import torch import numpy as np from pandas import read_csv import os from torch.utils.data import DataLoader, Dataset from tqdm import tqdm import torch.utils.data as dat import matplotlib.pyplot as plt from ourmodel import TransferLoss #A为原始列表,a为左移位数 def list_move_left(A,a): ...
77745ef5eb7cb1a36ce084764a51b22b025fcb474f8664c80eb290c4251bb5c9
Python
27,049
745
import awkward as ak import numpy as np import pytest from seqpro.rag._core import Ragged from seqpro.rag._layout import RaggedLayout, RecordLayout, validate_layout from seqpro.rag._utils import OFFSET_TYPE, lengths_to_offsets def _two_field_record(): shared = lengths_to_offsets(np.array([2, 1, 3], dtype=np.uint3...
32caa7c1bb50e42cbc7b244161f955eac6aaa8f721f5105c400a2edb235d7302
Python
27,059
671
from contextlib import contextmanager from unittest.mock import MagicMock, Mock, patch import pytest from celery import Celery, signals from celery.concurrency.thread import TaskPool as ThreadTaskPool from celery.fixups.django import DjangoFixup, DjangoWorkerFixup, FixupWarning, _maybe_close_fd, fixup from celery.loc...
8c86f39a4cbfdce98a3e041463c8a417060fdceeebb0c69eb818c775b62f7a23
Python
27,060
811
""" Functions for Multiscale vision model implementation """ #import itertools as itt import numpy as np from scipy import ndimage from . import atrous, mmt from .utils import threshold_w, simple_rec, simple_rec_iterative from imfun.cluster import metrics from imfun.core import deco from imfun.core import array_han...
2bfa56bc5ebe59df2fd98ad66ad5be367ddedd884e2a6489d03fe2afd861ddc8
Python
27,064
756
from ..utils import constants, utils import folium from folium.plugins import HeatMap import numpy as np import pandas as pd import matplotlib.pyplot as plt import shapely from geojson import LineString import geopandas as gpd import json import warnings # COLOR = { # 0: '#FF0000', # Red # 1: '#008000', # G...
98b07dbde2e25c98bac9d162db41eca23a417ce9cb4bc6bfaba726429525730b
Python
27,065
679
## ---------------------------------------- # this script was taken from the rslds package: https://github.com/davidzoltowski/ssmdm # and modified by Elaheh Imani # You need to clone the main version of the code from # the above repository and replace this file with the originial one ## import autograd.numpy as np imp...
9d5cbe50e411fc2b9d8a01d37b4f3c85a961229c9b5fc7b82147ebb6cde21402
Python
27,086
658
"""P4 amendment lane: dual-leg reducer, watermark transport, lifecycle. Covers DoR 4.3-4.6 plus the binding reviewer notes: * append-only op lane with lane-local amendment seq (Tier-F event ``seq`` facts never shift when an amendment lands), * canonical reducer fold (amendment order, last-wins per path, absent-face...
bbef30fb92b1ec9133ec5a042ea06beeaa1713982705fce32b13da76979cce43
Python
27,107
567
from __future__ import annotations import builtins import logging from typing import ( TYPE_CHECKING, TypedDict, ) import jwt as pyjwt from social_core.exceptions import ( AuthAlreadyAssociated, AuthCanceled, AuthForbidden, AuthTokenError, ) from social_core.utils import module_member from ga...
585adf41681eeb1c607d50ea1079b83d2468eeed03c07a8a29b53d420acce9ec
Python
27,110
749
from threading import Thread import urllib.request, urllib.error, urllib.parse import os import datetime import json import time import logging import traceback from functools import wraps import socket from zeroconf import ServiceBrowser, Zeroconf from ethoscope_node.utils.etho_db import ExperimentalDB class ScanEx...
b79fd8874f37170b61a92d670b3220df23beae77a7c8e913eb8d7ac4b111564d
Python
27,115
494
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # Written by Yuichiro Yada #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ################################################ # A code for Supplementary Figure 3 ################################################ import numpy as np import pandas as pd import seaborn as ...
9a7a8607efadb27ba46addc5a1a01d42b8d4985c4ba583cf2eb44d9d55ca1479
Python
27,122
659
#!/usr/bin/env python3 """ File: bryois_ct_eqtl_replication.py Created: 2022/10/25 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 t...
4e2dec0da7ec48bc0820835c4630f6d72bb80cd9f0a1f030efdf7b49d3cfc370
Python
27,130
685
import json import logging import os import pickle import warnings from copy import deepcopy from typing import Union import numpy as np import pandas as pd from sklearn.decomposition import PCA from scipy.io import loadmat from scipy.signal import savgol_filter # global variables, double check these ma...
82cacd5d12166acc318c87a8527f43bda5408080bf40e04ddf2f43d810a6fc5b
Python
27,132
666
import pytorch_lightning as pl import torch from monai.networks.blocks import UnetOutBlock, UnetrBasicBlock,\ UnetrUpBlock, UnetrPrUpBlock from monai.losses import DiceLoss from survival_plus_x.models.vit import ViT3D from survival_plus_x.models.multitask import MultitaskHead,\ multitask_metrics_from_step_out...
ca73773fe32c2ee6a5fcb4074f1803e7ff1e9c4a0b078e923e304d96f3f34195
Python
27,137
686
from math import ceil, floor, log, log2, sqrt, inf import random from numpy import pi from numpy.lib.type_check import iscomplex import numpy as np from minimize import minimize def TAFKAP_decode(samples=None, p={}): def fun_negLL_norm(params, getder=True): if getder: minll, minder = fun_LL_...
baa740d10328c98c16b7f6deb934dc3218bd480d2dafc30ab757ca2ec40cb5e6
Python
27,142
594
#!/usr/bin/env python3 """ File: calculate_explained_variance.py Created: 2022/01/18 Last Changed: 2022/07/25 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 ...
558a7547aeb82358c9b4eae1324c3232051d0d4ebb4b6b442c76789d561ad88d
Python
27,146
762
import torch import torch.nn as nn import torch.nn.functional as F from ..base import _layers as layers from ..base import _blocks as blocks from ..base import _towers as towers from typing import Union, Callable, Optional, Any, Tuple, List class FCN(nn.Module): """Basic fully connected network Instantiate a...
3b56689ec70ffc0c21e503674cc1eb016f72ccff4d56c4c7b8fc0e27120661fb
Python
27,150
724
""" Unit tests for Tunnel Utils API endpoints. Tests tunnel configuration, service management, and URL generation. """ import json import os import unittest from unittest.mock import Mock, mock_open, patch from ethoscope_node.api.tunnel_utils import TunnelUtils class TestTunnelUtils(unittest.TestCase): """Test...
ad015404b32fbb00955b5b9ce1bdf4ba4cdec43ff71caad13c934976bd736b16
Python
27,151
759
# adapted from https://github.com/facebookresearch/detectron2/blob/master/detectron2/data/detection_utils.py """ Common data processing utilities that are used in a typical object detection data pipeline. """ # pylint: disable=pointless-string-statement import os import logging import numpy as np from PIL import Image ...
9257747e90f623063be266a73ef289b111e2032ed0f0dd1aa2b3630277cd80d3
Python
27,152
860
""" Methods for dataset evaluation/comparison """ from __future__ import annotations from typing import Any, Dict, List, Optional, Sequence import numpy as np import pandas as pd import param from scipy.stats import ks_2samp from sklearn.preprocessing import MinMaxScaler, StandardScaler from .. import reg, util from...
b58e7963851c91434eeb96442f6ff7ac09a23f6c11f33d27e36fe9e52d70b408
Python
27,160
671
import hashlib import importlib.resources import io import logging import os import pathlib import time import traceback import afmformats.errors import nanite import nanite.fit as nfit import numpy as np from PyQt6 import uic, QtCore, QtGui, QtWidgets from .. import colormap from ..head.custom_widgets import show_wa...
253b667ae31293810eb986bc519e78e22449b6ae74f5e6b6840efb0b8cb9cbd6
Python
27,190
494
''' Copyright 2023 Douglas Feitosa Tomé This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hop...
ce7446e8634e92b8f103ef98773bc0fed04a3b261687eb9274f25e159e6e572f
Python
27,197
524
""" Ensemble inference Copyright (c) 2023 Polytechnique Montreal <www.neuro.polymtl.ca> License: see the file LICENSE """ import logging import os import shutil import time from pathlib import Path import glob import multiprocessing as mp from ivadomed import inference as imed_inference from totalspineseg.inference ...
92caf2151aa136833abb7f6d6c705a09f2e34cb78be664262730974aa03d7336
Python
27,200
552
''' Date: 23/09/22 @author: Kaan Karas & TMSi Counts the events and at the end save them to a txt document. TMSiSDK: Real-time filter that can be applied to incoming data Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands Licensed under the Apache License, Version 2.0 (the "License"); ...
8d2b7afe0be450b6dea56763382e724b3cf24d04844065f15eea2f7b5a3f7db0
Python
27,210
634
from __future__ import annotations from dataclasses import asdict from PySide6.QtCore import QSignalBlocker, Qt from PySide6.QtWidgets import ( QCheckBox, QComboBox, QDoubleSpinBox, QFormLayout, QFrame, QHBoxLayout, QHeaderView, QLabel, QLineEdit, QMessageBox, QPushButton, ...
e040d9fe4727bd83ad6ea58184c53c0a8ad4b08a89568d6ae72b58d9b141f26a
Python
27,217
686
from copy import copy from math import sqrt from typing import Optional import numpy as np import torch from tqdm import tqdm import networkx as nx from torch_geometric.nn import MessagePassing from torch_geometric.data import Data import matplotlib.pyplot as plt from torch_geometric.utils import k_hop_subgraph, to_ne...
23e2b56fc28dcbf1e9a02cc283e51fc3a975a228bd1a50a0dd76e6317022574a
Python
27,254
555
''' Date: 08/09/22 @author: Kaan Karas & TMSi TMSiSDK: Real-time filter that can be applied to incoming data ''' import os import sys from .. import sample_data_server from ..device import ChannelType import numpy as np import queue from copy import deepcopy import threading import time from datetime import datetim...
a36de76069992fc3ffab470df2202e229d1113c8b6c64063eb5f980f7b260df3
Python
27,274
620
"""Live input sites and metadata contract checks.""" from __future__ import annotations from collections.abc import Callable, Mapping, Sequence from typing import TYPE_CHECKING, Any, cast import torch from .errors import ( ReattachError, RunCapabilityUnavailableError, RunPreconditionError, ) from .runna...
f31922a9ecb817923038db3addcd83a9486a8bfba2b0d74be6ee23f42256e704
Python
27,276
575
# Copyright (c) 2025, Jay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar, Pradeep Ramani, Tri Dao. # A reimplementation of https://github.com/Dao-AILab/flash-attention/blob/main/hopper/flash_bwd_preprocess_kernel.h # from Cutlass C++ to Cute-DSL. # # Computes D_i = (dO_i * O_i).sum(dim=-1), optionally adjusted for L...
a9372b8db97d5cf65f51a02b8d3d1c0236cf4561e2920eb9db2293e9d31b1ba8
Python
27,278
864
# -*- coding: utf-8 -*- import numpy as np from matplotlib import pyplot as plt import random import sklearn import seaborn as sns import scipy as sp from matplotlib import rc import matplotlib.ticker as mtick import matplotlib as mpl from scipy import signal from sklearn.linear_model import LinearRegressi...
0be30cda9099b8f4198aa26e7fea14a777869e20b874074e2d280e9a2e1c6f1e
Python
27,279
800
import torch from torch.nn import Linear from torch.functional import F from torch_geometric.nn import GCNConv, GraphConv, MetaLayer, MessagePassing from torch_geometric.nn import GINConv, GINEConv from torch_geometric.nn import global_mean_pool, global_add_pool, global_max_pool from torch_geometric.nn import SGConv fr...
4835822ea89ddb30430f07b7543ae78019536369f4b38268d5ecae5d0fc457fe
Python
27,289
557
''' Date: 23/09/22 @author: Kaan Karas & TMSi Counts the events and at the end save them to a txt document. TMSiSDK: Real-time filter that can be applied to incoming data Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands Licensed under the Apache License, Version 2.0 (the "License"); ...
8676b732ce83752a854a49acfe19a93e93689827576a5a3ba2ca1d34c6756a65
Python
27,299
589
"""r61 whole-class immunizer -- allocation projection completeness (free_1 + corr_2 close). r57/r59 bounded per-op allocation via a ``FakeTensorMode`` projection, but GATED it on ``_has_numeric_literal``: a call with no int/float literal skipped the projection on the premise "sizes coming only from live tensor shapes ...
01da3b6d208ce48b970c7666de86f37ed07cc9942d17981ce43b81d690084a22
Python
27,301
601
# Copyright (c) 2024 PaddleHelix Authors. All Rights Reserved. # # Licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 # International License (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at # # http://creativecommo...
ba0759191097b8e4c2deaffa7c467393698f5a4ace61c81380cd4ba5299b867a
Python
27,309
678
#!/usr/bin/env python """ Unit tests for the Mattermost notification service. """ import datetime import json import time from unittest.mock import MagicMock, Mock, call, patch import pytest from ethoscope_node.notifications.mattermost import MattermostNotificationService class TestMattermostNotificationService: ...
632aed5608681ae63ba62d75c6d49b32c13cc02954809a4f75507af0e7685942
Python
27,311
726
import sys from datetime import datetime, timedelta from datetime import timezone as _timezone from datetime import tzinfo from unittest.mock import Mock, patch import pytest from dateutil import tz as dateutil_tz if sys.version_info >= (3, 9): from zoneinfo import ZoneInfo else: from backports.zoneinfo impor...
78c1a33423c90e30ea7a3de25f3dab4761ec091dfaacb5c7cd161dd1c607d547
Python
27,328
669
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import itertools import logging as log import matplotlib.pyplot as plt import numpy as np import slowfast.utils.logging as logging import torch from detectron2.utils.visualizer import Visualizer from slowfast.utils.misc imp...
6d2b356ded360cda7e5687dcaf61c1466118772df8f2389234bd6527aade7d7a
Python
27,330
806
from typing import Callable, Optional import random import math import cutlass import cutlass.cute as cute import torch from flash_attn.cute import utils from flash_attn.cute.block_sparsity import fast_sampling # ============================================================================= # CuTe mask_mod function...
f28c987632bfff18dbca4bfc3b992f1b0de70de4b504e8621855e55b8d152a94
Python
27,331
695
""" Optimizers class """ import torch import torch.optim as optim from torch.nn.utils import clip_grad_norm_ import operator import functools from copy import copy from math import sqrt import types import importlib from bioseq2seq.utils.misc import fn_args def build_torch_optimizer(model, opt): """Builds the PyT...
5b88dc60cf1039c9f40d1363760037d13bd96978303a790e881874ea539bf3a3
Python
27,340
579
import matplotlib.pyplot as plt from sklearn.linear_model import LogisticRegression from sklearn.manifold import TSNE from scipy import stats from sklearn.decomposition import PCA from sklearn.model_selection import KFold from sklearn import svm import os from utils_analysis import make_piechart, plot_sorted_averaged_r...
2001577ee5c459126a827b3dad20872cf25b1f2ac0afe26d22bc1d29edae1b8d
Python
27,350
700
import copy import collections import math import numpy as np import paddle from paddle.nn.layer.common import Linear, Dropout from paddle.nn.layer.norm import LayerNorm from paddle.nn import functional as F from paddle import tensor from paddle.fluid import layers from paddle.fluid.dygraph import Layer, LayerList fro...
22b8583ffae57410a441453c5380d0c731033a6c140d2dcba980dbff0eb9aa43
Python
27,352
765
""" Module to manage datasets and loaders """ import os import re import cv2 import numpy as np import pandas as pd import torch from torch.utils.data import Dataset, DataLoader import pytorch_lightning as pl import albumentations as A from albumentations.pytorch import ToTensorV2 import matplotlib.pyplot as plt impor...
ca28ce8a9e971f7d98b91c0791e115b6713f98dec0ef646410247b533a17fb2b
Python
27,367
617
name = "ptltSNEcv" # Loading necessary libraries libnames = [('mdtraj', 'md'), ('numpy', 'np'), ('tensorflow', 'tf'), ('keras', 'krs'), ('argparse', 'arg'), ('datetime', 'dt')] for (name, short) in libnames: try: lib = __import__(name) except ImportError: print("Library %s is not installed or not working ...
ecbfdae6b48b1358ccaa84308ea05846b6871fc057bc0a021e8a84ba9e5da6d6
Python
27,370
735
# --- 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 = "scatter3d" _path_str...
dfe4826a14fbbd642568fc134f1dbdb779a38dae6f89fbd453c3a0b10ec3de9a
Python
27,392
679
import torch import torch.nn as nn class LSTMCNN(nn.Module): def __init__(self, input_size: int = 1280, dropout_input=0.25, n_filters=32, filter_size=3, hidden_size=64, num_lstm_layers=1, dropout_conv1=0.15, n_tissues=0): ''' bidirectional LSTM - CNN model to process sequence data. returns output...
03fede1e5579f6fca3f2e52a00aea57b6fbe729ca6e6a46ddc4af1c1c91b9bf2
Python
27,394
519
"""Faster RCNN Estimator.""" # pylint: disable=logging-not-lazy,abstract-method,unused-variable,logging-format-interpolation,arguments-differ import os import math import time import warnings from PIL import Image import pandas as pd import numpy as np import mxnet as mx from mxnet import gluon from ....data.batchify...
4ebedc2a5be09855c73e3f8594a75260cdf93e590128da74ad93b897880e0c87
Python
27,410
987
""" Composite grid-structured figure """ from __future__ import annotations from typing import Any, Dict, List, Optional, Sequence, Tuple import os import numpy as np from matplotlib.gridspec import GridSpec from .. import plot, reg, util, funcs __all__: list[str] = [ "calibration_plot", "model_summary", ...
b4485233bfc3946ec79dc4f955d8ee5e43f3f676fbe65dd2bcb8ee558eb72bd6
Python
27,412
623
import pandas as pd import geopandas as gpd from ..utils import constants, utils, plot import numpy as np from warnings import warn from ..tessellation.tilers import tiler from shapely.geometry import Point, Polygon class FlowSeries(pd.Series): @property def _constructor(self): return FlowSeries ...
71335912ce88cfd785df82942fbf040f886c640dbb719063535d144b430fbd3e
Python
27,426
562
from bdb import set_trace from typing import Any, Sequence, Tuple, List import torch from torch.utils.data import Dataset import torch.nn.functional as F import os import pandas as pd from hashlib import md5 import numpy as np def make_hashes(names: List[str]) -> List[str]: hashes = [] for name in names: ...
38199282f8b06c0ab736c066f94bce3efba46a95556b4ee157a296f15d7efd2a
Python
27,427
700
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """The primary workflows for xcp_d.""" import os import sys from copy import deepcopy from pathlib import Path import bids import matplotlib as mpl import nibabel as nb import nilearn import numpy as np i...
939aaaf39d71ad5394c5806ae7d7157c5e6b8df1449ab1b1e08d68100b1fd251
Python
27,430
711
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/Importing.ipynb (unless otherwise specified). __all__ = ['read_file', 'extract_rawfile_unique_values', 'import_spectronaut_data', 'import_maxquant_data', 'convert_ap_mq_mod', 'import_alphapept_data', 'convert_diann_mq_mod', 'import_diann_data', 'con...
51fc8afe452a42a1c45a1214ec529154e5ab8da85115641e7cdb375f4e61c96c
Python
27,435
650
import pandas as pd import numpy as np import os import random import json, pickle from collections import OrderedDict from rdkit import Chem from rdkit.Chem import MolFromSmiles import networkx as nx from sklearn.utils import resample from utils import * import random,ast #Setting the protein and ligand properties f...
1887e167e1693e7518326efaf05b649100a2e0c314e76eacf68d4bad763c29a4
Python
27,438
770
#!/usr/bin/env python """ Unit tests for the notification base analyzer. """ import datetime import json import time from unittest.mock import MagicMock, Mock, patch import pytest from ethoscope_node.notifications.base import NotificationAnalyzer class TestNotificationAnalyzer: """Test cases for NotificationA...
3450b8d929d8b226d6e97842c1ce5b2f73b63e73a09c7601987d42bf2163d0ba
Python
27,452
846
"""Code adapted from https://github.com/open-mmlab/mmaction and https://github.com/bryanyzhu/two-stream-pytorch""" import random from PIL import Image, ImageOps import numpy as np import numbers import math import cv2 import collections import PIL class Transform: def __call__(self, data): raise NotImpl...
dd963e7e657b29e1a0138e29f9daa16f9a45c56026a1fc0f8c54f50c2407ad92
Python
27,454
568
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from pathlib import Path from typing import Any import numpy as np import torch from ultralytics.cfg import _handle_deprecation, get_cfg from ultralytics.data.build import load_inference_source from ultralytics.en...
2e6b57280a7ffa9b939c44cadff7d115255cc6352de743314d451de8e97d7db5
Python
27,471
769
import contextlib import inspect import math as python_math import jax import jax.experimental.sparse as jax_sparse import jax.numpy as jnp import ml_dtypes import numpy as np from jax import export as jax_export from keras.src import tree from keras.src.backend import config from keras.src.backend.common import Kera...
fc9d54d238477369ad67fe6b1f13180d95898815d2f4db36d95ac6dada675ebe
Python
27,475
808
""" corr_plots.py This script contains functions for plotting USI correlation analyses. Authors: Colleen Gillon Date: January, 2021 Note: this code uses python 3.7. """ from matplotlib import pyplot as plt import numpy as np from util import logger_util, math_util, plot_util from sess_util import sess_plot_util f...
933c4e09141c4686e736878251353dff5092b13bc5b6ad1d347889ba8bc8db5f
Python
27,478
821
"""Panel UI layer for the Parameter Database popup: the draggable popup shell, the table + sidebar, database-wide actions (Remove confirmation), and the top-level dropdown/standalone-page wiring. Single-parameter popup content (Inspect, Add) lives in `parameter_popups.py`. """ from __future__ import annotations impor...
40aa0999419a2d8bf26b0559f5759523286785ede57d741ffea235203ec43bfa
Python
27,481
678
# Copyright (c) 2024 PaddleHelix Authors. All Rights Reserved. # # Licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 # International License (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at # # http://creativecommo...
d87bea6d95af4a30c59e75f5026fb3ff3e94f8d5972054485715f7ea7b0c53d3
Python
27,485
684
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license import json import logging import plistlib import shutil import subprocess import sys import threading import time from datetime import datetime from pathlib import Path from ultralytics.utils import LINUX, LOGGER, MACOS, RANK, WINDOWS class Consol...
971fdb84fd0089aea2ecf06ae202d8da575b1bc1c90133baa925b0b126e50435
Python
27,488
645
"""Wrap-state identity shims: torch-internal ``x is F.y`` checks stay truthful. TorchLens wrapping replaces public torch callables with wrapper functions, so a torch-internal identity check whose two operands were read at different wrap epochs (a class-def-time default or a protocol-passed original on one side, a post...
3e9e95517cb6b3a9e0a13f45a616e95545c643837a503aa325707f828c3876dd
Python
27,511
652
import pandas as pd import numpy as np import os import random import json, pickle from collections import OrderedDict from rdkit import Chem from rdkit.Chem import MolFromSmiles import networkx as nx from sklearn.utils import resample from utils import * import random,ast #Setting the protein and ligand properties f...
f22cc9a6c2abed380515c6115a2ef9fa5492a936470d607a43f4b67daf08d332
Python
27,511
711
"""Seed, RNG, attestation, and fork utilities.""" from __future__ import annotations import dataclasses from collections.abc import Mapping, Sequence from typing import TYPE_CHECKING, Any import torch from . import _state from ._io._torch_symbols import torch_attr from ._runnable_state import ( PreparedRunnable...
3ba9b7abf7d11ac662eb6b3f95f6d25a976323df4b218d3291e197357f1f4b0c
Python
27,529
755
#!/usr/bin/env python3 """ Unit tests for backup helper functions including file-based cache system. Tests the enhanced backup functionality with video file caching, rsync integration, and device backup information extraction. """ import json import os import pickle import shutil import sys import tempfile import tim...
85961de70323fbf7d5b98d6204837472d5bccdaac586f9e03d9789efc4dfeff3
Python
27,535
791
"""Tensor kwargs must be extracted as op parents (bug ARG-KWARGS-MISSING). ``extract_tensors_and_params()`` consults static ``ArgSpec`` table entries whose ``tensor_kwargs`` tuples were empty (or wrongly named) for several common functions, so tensors passed as KEYWORD arguments were silently dropped from parent/param...
367db6145a1529834f24471465e2b7c86c43ab0a12cc1a6e6f4a694f027bd2b1
Python
27,539
750
from __future__ import absolute_import import torch from torch import nn import torch.nn.functional as F import math from transformers import BertConfig from transformers.modeling_outputs import BaseModelOutputWithPooling, BaseModelOutput from LRP.layers_ours import * from transformers import ( BertPreTr...
0e1d502b24e72c52d7ed791e90771e3c9168de5996ea93cffe03ad69a9ca99b0
Python
27,547
730
import pandas as pd import Code_General_utility_spikes_pickling as util import numpy as np import matplotlib.pyplot as plt import os import scipy.stats as stats _RES_DPI = 48 _SAVEDATA = False _X_MARKER_SIZE = 50 _show_excluded = False ID_trunk = [0,1,2,3,4] # IDs of trunk dendrites (add 7 to ID to return linear i...
5d7ca98a4f04d83a78567984a5e75a0539db5463cc99d18fcb58247c6a8a9334
Python
27,547
810
""" Keyboard shortcut configuration for the simulation display. Lets the user inspect and rebind the keys the running simulation responds to. """ from __future__ import annotations import json from dataclasses import dataclass from pathlib import Path from typing import Any import panel as pn import param from lar...
10b4a0d5b7c2a1d4a7da728e35143fff4112ec0b8325d15b21383ff7d40434f7
Python
27,548
791
from functools import partial import warnings from joblib import Parallel, delayed import numpy as np from scipy.stats import multivariate_normal from sklearn.base import BaseEstimator from sklearn.utils import check_random_state from ..geometry._docs import deprecated from ..geometry.base import ctranspose, sqrtm fr...
f5d34b4afbf1e399b8095235a7edcaff8e0626d30a27f5dbc3fef5f665819eb3
Python
27,572
873
import torch import cutlass import cutlass.cute as cute from cutlass._mlir.dialects import math as mlir_math import operator # ============================================================================= # Score_mod functions that don't use global indices # All use signature: (tSrS_ssa, b_idx, h_idx, q_idx, kv_idx, s...
c68f8fa4b1ff2dd24dd7fb169af79e4c29ded16bbd10862a5ae9754ee765ec8c
Python
27,578
720
""" Rewrite of liquid time-constant network from https://github.com/rtqichen/time-series-datasets """ import numpy as np import os import argparse from _datasets import * import brainpy as bp import brainpy.math as bm from enum import Enum bm.set_environment(bm.training_mode) if any( [ not os.path.exi...
da3c7b80a374b6fa0f4c74ffb028d2a238c02fb54b8556e202d89777c1576a25
Python
27,593
881
""" 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...
022e0959964f9b45c2b88617ffb9c589de1ceb8c5977c078dbd167c71f907b61
Python
27,596
783
# SPDX-License-Identifier: LGPL-2.1-or-later from __future__ import print_function, division, absolute_import import os import unittest import numpy as np from pyEcoHAB import incohort_sociability as ics from pyEcoHAB.utils import general as utils from pyEcoHAB import data_path, sample_data from pyEcoHAB import Loader...
0d7bae89d87ba125ed7cf440a5345384298e1bf9f330ea333462dedbb32e4769
Python
27,604
906
"""Single-cell subprocess runner for TorchLens performance benchmarks.""" from __future__ import annotations import argparse import json import os import platform import random import resource import statistics import subprocess import sys import tempfile import threading import time from collections import Counter f...
fffd8caa2b89b36a6eeeb94d01ec9824a4acbfa1c4fed40b95a189a8c5e9897c
Python
27,608
684
"""An async vector environment.""" import multiprocessing as mp import sys import time from copy import deepcopy from enum import Enum from typing import List, Optional, Sequence, Tuple, Union import numpy as np import gym from gym import logger from gym.core import ObsType from gym.error import ( AlreadyPendingC...
d9aa680638bc04427ccc643b9b00453a3a678ea4ebe32a3989793977eb0c16d3
Python
27,622
770
"""Clustering functions.""" import numpy as np from scipy.stats import norm, chi2 from sklearn.base import (BaseEstimator, ClassifierMixin, TransformerMixin, ClusterMixin, clone) try: from sklearn.cluster._kmeans import _init_centroids except ImportError: # Workaround for scikit-learn...
dd69c8b9e45f86f2517a0e64ba5fb98c0c48813d5e88208626ab34bb5589725c
Python
27,636
854
#!/usr/bin/python import time import os import subprocess import sys import re import pandas as pd import numpy as np import tabix import glob import ConfigParser from bisect import bisect_left ##### initialize parameters ##### class getParams: def __init__(self, filedir, cfg, param_cfg): leadSNPs = param_cfg.get('...
a0192008918380bfc1fd824809cfe7a078ab28cc24e26ae296cbbd6fda2d961f
Python
27,643
817
import argparse import json import os import sys import warnings import imblearn import joblib import numpy as np import pandas as pd import skrebate from galaxy_ml import __version__ as galaxy_ml_version from galaxy_ml.binarize_target import IRAPSClassifier from galaxy_ml.model_persist import dump_model_to_h5, load_m...
c4bc410b9d891c1d3ccc752859e96439bd5d1c1736a5a645be7fcf008c52bd1d
Python
27,700
795
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> """Plot uniform time-series of one variable.""" from typing import Any, Callable, Dict, Sequence, Tuple, Union import matplotlib.axes import matplotlib.colors import matplotlib.patches import numpy as np from .._colorspaces import oneway_colors, to_rgba from .....
bf68634022008a2f6cdab0e5495794d7e11e3c233b5ce4f1ff3173873cd6ffe2
Python
27,707
739
# noinspection PyPackageRequirements import cv2 import numpy as np import time import datetime import warnings import logging from PyQt5 import QtCore from .global_defs import DeviceState as State from score_behavior.video_control import VideoControlWidget from score_behavior.score_config import get_config_section l...
cc2026f955ba653223b66136f916485c2cab5ec674c354ad41bbb88acf9bdb5b
Python
27,719
864
""" 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...
20299e53a2c4ba51f74ea45425b5ee88cf0b248019a3402c6cd64cb84a07dc21
Python
27,728
887
from typing import ( Annotated, Any, Literal, ) from pydantic import ( Field, field_validator, model_validator, RootModel, ) from galaxy.util.config_templates import ( ConfiguredOAuth2Sources, EnvironmentDict, expand_raw_config, get_oauth2_config_from, ImplicitConfigura...
55ff0a8a4a68509031a67ed5f489f8a89ef1dc680f5af19eebf5502f9c6b5e84
Python
27,732
703
"""P2 settlement proofs: every termination path settles through the authority. The product-constructor inventory (design section 4): each reachable path stamps a typed ``CaptureOutcome`` as its final settling act, failure phases attribute exactly (FORWARD / FINALIZE / POSTPROCESS / TEARDOWN), secondary failures keep e...
71ecb0f110ef0ac2fbe72cf0538bf5e1101ad67a406a1d88684dbc11eb776fe4
Python
27,733
776
import logging from webbrowser import get #from matplotlib import test import numpy as np from tqdm import tqdm import torch from sklearn.model_selection import KFold from graphmae.utils import ( build_args, create_optimizer, mask_edge, set_random_seed, TBLogger, get_current_lr, load_best_c...
ff726010171e328b2de8c9413e16747ba34b8f4abb2da7c8518a897f6129577e
Python
27,792
683
""" Developmental Data Demo ======================= An example analysis applied to developmental data, demonstrating best practices. """ ################################################################################################### # Spectral Parameterization for studying neurodevelopment # ---------------------...
9ff53ca4d57db1cc2fdc0ae55ae40fff5a679691dd9abf0385035f336f4efac0
Python
27,800
609
"""State contracts and captured execution contexts.""" from __future__ import annotations import sys from collections.abc import Mapping from contextlib import contextmanager, nullcontext from functools import lru_cache from typing import TYPE_CHECKING, Any, cast import torch from ._io._torch_symbols import torch_a...
925d7ca960d8b657018846c2c0718cc934f3965314e2bc224eda7bae65534c97
Python
27,803
684
from unittest import mock import numpy as np import pytest from absl.testing import parameterized from keras.src import backend from keras.src import dtype_policies from keras.src import layers from keras.src import models from keras.src import ops from keras.src import testing from keras.src.backend.common import Au...
d0fcb6abd53dfc84bf3e88a4beab3cb976a833197bc7a59299514d16c8eb1450
Python
27,822
762
"""StudioGAN: A library implementing many GAN variants with common training infrastructure. Kang et al., "StudioGAN: A Taxonomy and Benchmark of GANs for Image Synthesis", IEEE TPAMI 2023. arXiv:2206.09479. Source: https://github.com/POSTECH-CVLab/StudioGAN Each entry here shows the SIGNATURE OP of a distinct GAN var...
4ec1dbfdd6cc9a871e16500f5d36c1369382ee0717f97f9a05ea26d7ba9f0a11
Python
27,835
777
import hashlib import numpy as np import pandas as pd import copy from mirp._images.generic_image import GenericImage from mirp._masks.base_mask import BaseMask from mirp.utilities.utilities import zero_if_close class Data3DMesh(object): def __init__(self): # Mesh faces self.mesh_faces: np.nda...
cc75e7c1e743b9e24507c04dd01566089d5f303b41d6835374519875bc07ceaf
Python
27,859
556
#!/usr/bin/env python import normalize_plot_and_summarize as nps from flattener import write_tab_for_all import argparse import csv import datetime import errno import os import subprocess import tables import logging import sys import abc import collections import numpy from time import time from os.path import ...
4ad556c747bd4f4351198c9b23a163975717794c1b288546fe47253a44154ae1
Python
27,883
1,050
from __future__ import annotations import contextlib import sys import types import pytest import env from pybind11_tests import detailed_error_messages_enabled from pybind11_tests import pytypes as m def test_obj_class_name(): assert m.obj_class_name(None) == "NoneType" assert m.obj_class_name(list) == "l...
6ba6bb134d3ef006dd80195e7ac877660e7fe01c2896374b2b042fc9e442fe96
Python
27,885
709
import random import numpy as np import ot import torch from anndata import AnnData try: from typing import Any, Dict, List, Literal, Optional, Tuple, Union except ImportError: from typing_extensions import Literal from typing import List, Optional, Tuple, Union import pandas as pd from spateo.logging impo...
c0e92462764831abd9b98db353ee16fa576770670bb2f0c59071d6d5faaf3a0b
Python
27,905
591
"""Input structure, literal, and metadata witness helpers.""" from __future__ import annotations import struct from typing import TYPE_CHECKING, Any import torch from . import _state from ._runnable_state import ( RunResourceCeiling, _guarded_defensive_materialize, ) from .errors import ( PathDivergence...
4c4555ff71c5ae16c8cd153d240d2db952de92d35ebf8dede6408de5c0d5f4ad
Python
27,908
697
from __future__ import print_function, division, absolute_import import torch import torch.nn as nn from torch.autograd import Variable from functools import reduce class LambdaBase(nn.Sequential): def __init__(self, *args): super(LambdaBase, self).__init__(*args) def forward_prepare(self, input): ...