sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
dfd2900956303a80702b4cb27d7a473311e484086d9cedc1bdebfd0a07f03a4e | Python | 22,367 | 463 | #!/usr/bin/env python
#
# Extract metrics within spinal labels as defined by the white matter atlas and the template
# The folder atlas should have a .txt file that lists all tract files with labels.
#
# Copyright (c) 2014 Polytechnique Montreal <www.neuro.polymtl.ca>
# License: see the file LICENSE
# TODO: fetch vert... |
7de91ccc7667b614cdb65fb9830cd789c9aab59180929aa02c50b4c34c69762c | Python | 22,374 | 692 | import plotly.colors as clrs
from plotly.graph_objs import graph_objs as go
from plotly import exceptions
from plotly import optional_imports
from skimage import measure
np = optional_imports.get_module("numpy")
scipy_interp = optional_imports.get_module("scipy.interpolate")
# -------------------------- Layout -----... |
91d5e288beeb3ac1a24442a0256cc7bef4999d4447bd23b6a7190d9a24595c2e | Python | 22,375 | 467 | """r-b4 R26-2: structural gate -- private torch API touches stay inside `_torch_compat`.
The CLAUDE.md rule ("every fragile torch-private-API probe routes through
``torchlens/utils/_torch_compat.py`` and flips a named ``HAS_*`` flag") was
unenforced: probes kept escaping the boundary (the fail-open census probe, the
u... |
be7e258c15f1a2d9ca5bf9c29637ea33725e466a36db259ff929f6678fe894d2 | Python | 22,379 | 596 | """
Device API Module
Handles all device-related endpoints including device discovery, management,
control, and information retrieval.
"""
import json
import os
import shutil
import tempfile
import bottle
from .base import BaseAPI, error_decorator, warning_decorator
class DeviceAPI(BaseAPI):
"""API endpoints ... |
89f687a0cefa38b6e07dc403bb049987f33d435fdc54923940d7c4d403cc9ad3 | Python | 22,390 | 633 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
ecf06ccbba78b09a6fb812d513eca0091dccc5bfcfa0690cd64fde133d534b75 | Python | 22,412 | 654 | """
Tables
"""
from __future__ import annotations
from typing import Any, Dict, List, Optional, Sequence, Tuple
import numpy as np
import pandas as pd
import param
from ... import ROOT_DIR
from .. import plot, reg, util, funcs
__all__: list[str] = [
"modelConfTable",
"mpl_table",
"conf_table",
"mdif... |
6ad520ad71f9ae0544965e1eda39c8787c0822594cdd59e8dd36dc4c7754102e | Python | 22,426 | 502 | import numpy as np
from brian2 import ms, second, Hz, mV
import pickle
import avalan_props as avaln
import figure_properties as fp
import matplotlib.pyplot as plt
from matplotlib import gridspec, colors
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from mpl_toolkits.axes_grid1.anchored_artists import A... |
2958d909df11ba03fa6f516af5de6a029438f22ed350a7688d0578e8ae7e1816 | Python | 22,428 | 618 | import random
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scanpy as sc
import seaborn as sns
import torch
from scipy.sparse import csr_matrix
from scipy.sparse import csr_matrix as csr
from sklearn.metrics import (
confusion_matrix,
pairwise_distances,
pairwise_distances_c... |
175da47e720fb00431d37e594812bb8d1543421623338db6d316bc87eea153a8 | Python | 22,430 | 671 | # License: GPL
# Copyright: Alexey Brazhe, 2010-2013
import numpy as np
import pylab as pl
from functools import reduce
from . import renishaw as rshaw
from scipy.interpolate import splrep, splev
#from scipy.optimize import leastsq
def unique_tag(tags, max_tries = 1e4):
n = 0
while n < max_tries:
ta... |
cebecd5c89beda6b44ca74e9d424b47db14623632a769e35758e007c3585e844 | Python | 22,443 | 800 | # Copyright (c) 2022, Tri Dao.
# Adapted from https://github.com/NVIDIA/apex/blob/master/apex/contrib/layer_norm/layer_norm.py
import dropout_layer_norm
import torch
from torch.nn import init
def maybe_align(x, alignment_in_bytes=16):
"""Assume that x already has last dim divisible by alignment_in_bytes"""
#... |
115dc60003010369be21f31f0c18a55d5bb27d557c219f713fb2b636aac3de6a | Python | 22,457 | 604 | #!/usr/bin/env python3
"""
NEURON 3D RxD (CYLINDER): Ca diffusion
Last updated: 6.8.2026
Authors:c Laura Keto and Saana Seppälä
### Description
This script performs three-dimensional calcium diffusion simulations in
an idealized cylindrical geometry using the NEURON reaction-diffusion
(RxD) framework. The intracell... |
54ae67377990e7d8708088283e90e2ec134953f72ad797ba2fa485abfbdcfefe | Python | 22,461 | 578 | # --- 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 = "quiver"
_path_str = ... |
b668156b94d3318c30581ad4722d766d57791c49045c39859bea5942ccaf2a79 | Python | 22,467 | 687 | import datetime
import logging
import os
import pickle
# streaming socket
import socket
import struct
import tempfile
import threading
import time
import traceback
from collections import OrderedDict
# from cv2 import VideoWriter, VideoWriter_fourcc, imwrite
import cv2
from ethoscope.control.tracking import ControlT... |
f956b27bdb73240fb73b13e8d7cd5a44c726300d3c42c2c3cc06aa8e21ad551c | Python | 22,468 | 634 | # SOURCE: vendored from EmilienDupont/coinpp @ master (coinpp/models.py)
# SOURCE: vendored from richzhang/colorization @ master (colorizers/eccv16.py, base_color.py)
# SOURCE: vendored from erichson/koopmanAE @ master (model.py)
# SOURCE: vendored from ycq091044/ContraWR @ main (src/model.py)
from __future__ import an... |
02f5332c5026f23e8baa3c56ddbad535f11d28684577420a82fed4584906ae95 | Python | 22,475 | 508 | """Transforms for RCNN series."""
# pylint: disable=not-callable
from __future__ import absolute_import
import copy
from random import randint
import mxnet as mx
from .. import bbox as tbbox
from .. import image as timage
from .. import mask as tmask
__all__ = ['transform_test', 'load_test',
'FasterRCNND... |
b91ba1292c3f214547b45c1e079885c5c60acedcf874c554cead9ce5842a7f3f | Python | 22,480 | 441 | # -*- coding: utf-8 -*-
"""
Created on 19/09/2022 12:45 PM
@author: Kaan Karas
"""
import time
import PySimpleGUI as sg
import io
import os
from PIL import Image
from sys import platform
class GUI_Image:
def __init__(self):
super(GUI_Image,self).__init__()
self.main_page_button=... |
e01e9c299a07e6c7a2be361f376b53dfdb86b8725a826db83b91ad2faed45258 | Python | 22,480 | 470 | #!/usr/bin/env python3
import sys,os,argparse,pickle,re,numpy
import functools
from lefsebiom.ConstantsBreadCrumbs import *
from lefsebiom.AbundanceTable import *
#***************************************************************************************************************
#* Log of change ... |
3bfb2dda04db13bfa5f36b0ae26a1c53bcf6a718fa31c397bd8320bce2075869 | Python | 22,488 | 517 | #!/usr/bin/env python3
"""
File: plot_ieqtl_with_two_cell_fractions.py
Created: 2020/11/24
Last Changed: 2022/02/10
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 directo... |
a1037a5bf2f8f4a8d3afd0fb4b5271d0dc9f3272c016dca8471a7061b80be1a1 | Python | 22,499 | 680 | """Tests of jitted core functions for `pynapple` package."""
import warnings
import numpy as np
import pandas as pd
import pytest
import pynapple as nap
def get_example_dataset(n=100):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
starts = np.sort(np.random.uniform(0, 1000, n)... |
45efd0957b26f4a6c4b8df7f49272f71f60c45058fb03a89e1915708e87e8600 | Python | 22,511 | 486 | # This file is now part of the Galaxy Project, but due to historical reasons
# reflecting time developed outside of the Galaxy Project, this file is under
# the MIT license.
#
# The MIT License (MIT)
# Copyright (c) 2012,2013,2014,2015,2016 Peter Cock
# Copyright (c) 2012 Edward Kirton
# Copyright (c) 2013 Nicola Soran... |
1a05e7f48cacf9d1317f47ff214826fa2463abf1b7f9314f728a4912744f9f9d | Python | 22,525 | 511 | import math
import os
import time
import torch
import torch.nn as nn
import numpy as np;
from torch.autograd import Variable
import scipy
import matplotlib.pyplot as plt
import scipy.io as sio
from sklearn.preprocessing import normalize
from sklearn.cluster import KMeans
from sklearn.metrics import normalized_mutual_in... |
2885d806d4a4f8abbd8d69af927bd7e18bd170a417c69b3aaab7044c7054bda4 | Python | 22,527 | 748 | """Golden parity gates protecting torch before backend substrate work.
Governance adjudication (b10 R78 round-3): these goldens are ENVIRONMENT-
INDEPENDENT semantic projections and deliberately NOT routed through the
``tests/_oracle_env.py`` env-fingerprint resolver. Every projected value is
metadata TorchLens owns (... |
77a5cb3adffa11155e879366796d171ecdc4a5398dcfddecf0f1297923076e07 | Python | 22,527 | 711 | # %%
import warnings
warnings.filterwarnings("ignore", category=FutureWarning)
warnings.filterwarnings("ignore", category=UserWarning)
import os, glob
import numpy as np
import nibabel as nib
from matplotlib.colors import ListedColormap
from nilearn.image import math_img
from irnlm.utils import check_folder
from fmri... |
39df20d08861ed7922948e501475173bc13882258288e6593959af2c21aa8423 | Python | 22,528 | 593 | """W051-BIND fix wave: AUD-CODE 2.3a-d / 3.7a-d regression pins for the live-surgery stack.
Each test re-runs the audit's reproducer shape against the fixed tree:
in-place injected ops attest (2.3a), module-boundary firings anchor and
persist under the spec rule id (2.3b), re-anchored/forged provenance refuses
at load... |
1084a8b4e3b536cb81706feae3bfa9a35a7fca9ed1674f7f39d8d6c4d6270e78 | Python | 22,532 | 512 | import math
import os
import time
import torch
import torch.nn as nn
import numpy as np;
from torch.autograd import Variable
import scipy
import matplotlib.pyplot as plt
import scipy.io as sio
from sklearn.preprocessing import normalize
from sklearn.cluster import KMeans
from sklearn.metrics import normalized_mutual_in... |
ab112d2bb4fa35c5340a81e96778ed206686cd5ad4f8049114b0d53b3e1e5488 | Python | 22,539 | 577 | # %%
'''
A collection of python functions to help perform GLM analyses in the OCD baseline project.
Designed to interact with a nipype workflow
'''
import numpy as np
import pandas as pd
import nibabel as nib
def get_firstlevel_design(event_file, design):
'''
Generates a pandas df containing onsets, duration... |
ec31b364edaa5105fcb2c1a898888dac35b8790eeaa7d8d1f58323917aff7532 | Python | 22,546 | 691 | """Compact dependency-free classics for CX long-tail dependency-gated models.
Sources checked for architectural primitives:
MoViNet: Kondratyuk et al. 2021, arXiv:2103.11511.
AASIST: Jung et al. 2021/2022, arXiv:2110.01200 and clovaai/aasist.
BigVGAN: Lee et al. 2022/2023, arXiv:2206.04658 and NVIDIA/BigVGAN.
Bonito:... |
12476f3e46ed3124eefbefbfaf9dcdd9376a962dfe56daf0a6a468b92926a970 | Python | 22,549 | 647 | """
Tools
A module for converting from mpl language to plotly language.
"""
import math
import warnings
import matplotlib.dates
from _plotly_utils.colors import hex_to_rgb
from plotly.matplotlylib.mplexporter.utils import export_color
def check_bar_match(old_bar, new_bar):
"""Check if two bars belong in the... |
155c9eecb1711fbf82a46648a935db62e9a0b348e1e06ee2d802815a325ee11b | Python | 22,559 | 568 | """Functions for use when labeling individual nuclei/cells, after obtaining a
mask.
"""
import math
from typing import Dict, Optional, Tuple
import cv2
import numpy as np
from anndata import AnnData
from joblib import Parallel, delayed
from numba import njit
from skimage import feature, filters, measure, segmentation
... |
1ed039307efb0ce33bb25e95ecddb89bc626565d745c06891ad6f087d933a14b | Python | 22,562 | 504 | """
Galaxy FilesSource implementation for openBIS [1].
openBIS is an ELN-LIMS (Electronic Lab Notebook + Laboratory Information Management System) developed by
ETH Zurich. This plugin exposes the Collection-based part of openBIS's entity model as a virtual hierarchy
rather than a plain file tree (Experiment and Sample... |
6b14caa35d04a034f396bdb252c719f61dfbca3599d35a3d0378b5f9a836252b | Python | 22,565 | 586 | """Galaxy job runners to use Amazon AWS native compute resources, such as AWS Batch."""
import bisect
import hashlib
import json
import logging
import os
import re
from typing import (
Any,
TYPE_CHECKING,
)
from galaxy import model
from galaxy.job_execution.output_collect import default_exit_code_file
from ga... |
cadf4cf886a92ca2174fc5bf63ed965ec5add477032198ae1272eaa379692f1b | Python | 22,581 | 613 | import json
import logging
import optparse
import os
import re
import signal
import sys
import threading
import time
from contextlib import contextmanager
import bottle
from ethoscope_node.backup.helpers import GenericBackupWrapper
from ethoscope_node.backup.mysql import get_backup_path_from_database
from ethoscope_n... |
0f266cc472cfe09a984ddaa07af47e01ef681476b25a293be9e4931809324548 | Python | 22,595 | 527 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import os
import random
import numpy as np
import pandas
import slowfast.utils.logging as logging
import torch
import torch.utils.data
from slowfast.utils.env import pathmgr
from torchvision import transforms
from . import... |
4713d1d0190a3881b6d42645fb74cae17cf4693ff6cdf8adca0c432bc030d9fb | Python | 22,595 | 550 | """Deferred activation-payload clones (clone-on-write) behavior contract.
Eligible plain captures save payload ALIASES instead of eager clones; the
torch wrapper materializes a pending alias onto exclusive fresh storage
before any wrapped call writes its storage. These tests pin the contract:
* saved payload bytes/... |
00f9d5861e496330dca74ee605a7904648870736669f22ce1d675cfb00460cd0 | Python | 22,599 | 688 | """
Generic editor for any stored configuration type.
Builds a form from the conftype's own parameter definitions, so that a new
configuration type becomes editable without a bespoke widget.
"""
from __future__ import annotations
from typing import Any
import panel as pn
import param
from larvaworld import CONFTYP... |
3af26a759030f5d9e703198c050c86bae93d43c52fd169274c0b27f59a2b4655 | Python | 22,613 | 664 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
6885998b7289fac4d14628eaa289a36eefcb46d12e52305b36fbc5c37fdf6068 | Python | 22,615 | 479 | import pylustrator
pylustrator.start()
import os
from copy import deepcopy
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import tensorflow.keras as keras
import tensorflow_addons as tfa
from tf_spiking import DenseLIF, DenseLIFNoSpike, IntensityToPoissonSpiking
from tf_spiking.helper impor... |
97b00379d73607ea1bcbe229e00859e0f1951c021432c74ba1fe393ba8976864 | Python | 22,636 | 461 | import time, itertools
from dataset import ImageFolder
from torchvision import transforms
from torch.utils.data import DataLoader
from networks import *
from utils import *
from glob import glob
# import torch.utils.tensorboard as tensorboardX
from thop import profile
from thop import clever_format
class NICE(object) ... |
90227afe9d74e825e602ab5565c53a018eb91793ef6e3221e7c1208e12dd1876 | Python | 22,638 | 633 | from decimal import Decimal
from unittest.mock import ANY, MagicMock, Mock, call, patch, sentinel
import pytest
from celery import states, uuid
from celery.backends import dynamodb as module
from celery.backends.dynamodb import DynamoDBBackend
from celery.exceptions import ImproperlyConfigured
pytest.importorskip('b... |
1196c42bcaf59f84af5f367c72a2131be031aee875fb3578e85bd0d40982830d | Python | 22,645 | 446 | '''Analysis and plotting functions.'''
# © Thomas Akam, 2023, released under the GPLv3 licence.
#%% Imports
import os
import json
import pickle
import numpy as np
import pandas as pd
import pylab as plt
import seaborn as sns
import tensorflow as tf
import statsmodels.formula.api as smf
from scipy.special import log... |
d2e7664369679a5176467544087b5de55f0536e86635a486302d97702df6bcc3 | Python | 22,652 | 573 | #!/usr/bin/env python3
"""
File: plot_n_ieqtls_in_simulations.py
Created: 2023/07/15
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... |
baa29f5e04e6b077bbf5e8c6e4ebd19a4753c3bebb2686848aa6cc9695d2da01 | Python | 22,677 | 555 | from collections.abc import Mapping, MutableMapping
from copy import copy
from unittest.mock import Mock
import pytest
from celery.app.defaults import Option
from celery.app.utils import Settings, bugreport, filter_hidden_settings, sanitize_url
class test_Settings:
@pytest.mark.parametrize('copy_fun', [lambda ... |
f5d841830139ebf01ea79751d1aa34d62a161b3fda7392b0be7bc964bdd0c62b | Python | 22,680 | 573 | """Fixwave-2 FW2-POLISH pins for R19 visualization-honesty fixes.
R19-1 (b6, HIGH): the run-fold "+N more <Class>" ellipsis claims the hidden
members are interchangeable, but the uniformity fingerprint was 4 integers
(layer/param counts) — a kwargs-different conv (dilation 2) and a
tanh-for-relu block both folded unde... |
9f32ee473b25dd1ee2cfd7303fc9e5e18c68dcabfee070fa3b56f2168b7644cc | Python | 22,690 | 647 | # _*_coding:utf-8 _*_
# @Time : 2021/8/26 10:43
# @Author : XCH
# @FileName: 3_lstm_test.py
# @Software: PyCharm
import os
import torch
import glob2
import random
from torch import nn
from math import sqrt
from tqdm import tqdm
from torch.autograd import Variable
from scipy.interpolate import inter... |
6a0c2bf2bb5697ec39c5710e7a986478d8bf462f87e3ec8d19cb1fd4ceb78b8c | Python | 22,691 | 737 | """Create tables from data-objects"""
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from itertools import zip_longest
from operator import itemgetter
import re
from typing import Callable, Sequence, Union
from warnings import warn
import numpy as np
from . import fmtxt
from ._celltable import Celltable
fro... |
12a7eb7f6d34232ba24bcc52a132077f36aa2d215847cab1b62eea69251fccaa | Python | 22,704 | 519 | from __future__ import print_function
import argparse
from mxnet.image import image
from mxnet.gluon.data.vision import transforms,CIFAR10,ImageFolderDataset
from mxnet.gluon.data import DataLoader
from mxnet.gluon import Trainer,nn
from mxnet.base import numeric_types
from mxnet.initializer import *
from mxnet import ... |
010f69852dd1026d56482126ec01f32128641e3f6caa4623fddbc722c3b92315 | Python | 22,705 | 597 | import math
import ml_dtypes
import numpy as np
from keras.src import backend
from keras.src import ops
from keras.src.api_export import keras_export
from keras.src.backend.common import standardize_dtype
from keras.src.backend.common.backend_utils import standardize_axis_for_numpy
@keras_export(["keras.Quantizer",... |
3786f7c9682193ff3c2e4ae79b7880df53fd9309f3b6a92dec11e577d887e4bd | Python | 22,706 | 444 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
71c789761d860379be75a661c840a51eb239b226e3f6ebf02ed62d43a8d9fe78 | Python | 22,709 | 741 | """
Spatial parameter types: positions, orientations and extents.
Defines the point, oriented point, vector and area parameters that place
objects in the arena, together with the mobility mixins that let them move and
rotate.
"""
from __future__ import annotations
from typing import Any, Optional, Sequence, Tuple
im... |
8dcb7f970d7e13f2816a36c89355d0b2957464778dd61babaf784b648db1cd58 | Python | 22,715 | 563 | import multiprocessing
import sys
from functools import partial
from typing import List, Optional, Tuple, Union
import dynamo as dyn
import numpy as np
import ot
import pandas as pd
import scipy
import scipy.stats
from anndata import AnnData
from dynamo.tools.sampling import sample
from scipy.sparse import csr_matrix,... |
c25edbb29f1e541a1ac034b2884e8ead190a25de550322d74b823759a9444d57 | Python | 22,724 | 393 | #!/usr/bin/env python3
"""Журнал протокола A2 (13 октября 2026): два новых контроля на входах 8-9 и
шок-проба. Читает runs/a2/controls.jsonl и runs/a2/shock.jsonl, пишет
docs/a2.json и docs/a2.html.
Правило чтения из PREREGISTRATION_A2: чтение одно, на объявленном числе seed'ов.
Пока не все seed'ы 1..N посчитаны во вс... |
318e383dd5c2e186ee2202105443f63220e2da45b25bf0f017f347869820eebf | Python | 22,725 | 655 | """
Branch coverage tests for sim_conf.py configurations.
Tests simulation configuration validation and branch coverage.
Focuses on contract tests and validation logic.
"""
import pytest
import numpy as np
from larvaworld.lib.reg.stored_confs import sim_conf
@pytest.mark.fast
class TestSimConfBranches:
"""Test ... |
2b7b12d2316cd69d26774aa3e56abc38d2bc87ceb9e2593953403093730b0182 | Python | 22,727 | 561 | """W051 (AUD-CODE 2.16 / 2.18): foreign-thread touches settle against the owner's joins.
The FLAKEHUNT split routed every pure read made by a PRE-EXISTING thread into a
session-only disclosure so a benign background flusher could no longer ceiling an
honest capture. It over-corrected: host nondeterminism fed to the fo... |
fbe6dd03b7f920b37411fccc9f4fb21937945b23955697db381600713d883efd | Python | 22,727 | 393 | #!/usr/bin/env python3
"""Журнал протокола A2 (13 октября 2026): два новых контроля на входах 8-9 и
шок-проба. Читает runs/a2/controls.jsonl и runs/a2/shock.jsonl, пишет
docs/a2.json и docs/a2.html.
Правило чтения из PREREGISTRATION_A2: чтение одно, на объявленном числе seed'ов.
Пока не все seed'ы 1..N посчитаны во вс... |
8760bb180a4db79689284122579ce16cb67bc84db132a7b31f949d6a1b113873 | Python | 22,733 | 606 | """
Implements tracking CPU power consumption on Windows using the built-in
Energy Meter Interface (EMI).
Since Windows 11, the OS kernel exposes the CPU RAPL energy counters
(the same MSR-based counters read from /sys/class/powercap on Linux)
through a standard device interface, for both Intel and AMD CPUs.
No third-... |
83bd85307e1302c308635b300ecabc4a6fd2ef235b517592270509c46df8f40d | Python | 22,749 | 550 | import numpy as np
from cvnn.layers import ComplexDense, ComplexFlatten, ComplexInput, ComplexConv2D, ComplexMaxPooling2D, \
ComplexAvgPooling2D, ComplexConv2DTranspose, ComplexUnPooling2D, ComplexMaxPooling2DWithArgmax, \
ComplexUpSampling2D, ComplexBatchNormalization, ComplexAvgPooling1D, ComplexPolarAvgPooli... |
276afc815fe9d1aee650c5f8c4a86ccdef187265d1273643656b1d5eda3c5750 | Python | 22,759 | 559 | from __future__ import absolute_import, division, print_function
import os
import sys
import shutil
import copy
from tqdm import tqdm
import numpy as np
import json
import mxnet as mx
from mxnet import gluon, autograd
from gluoncv.data import KITTIRAWDataset, KITTIOdomDataset
from gluoncv.data.kitti.kitti_utils imp... |
dd9d39a75a09945ec30b7ac33066b7a4ca91d1fe6652ffdf4820096f517c078f | Python | 22,764 | 544 | """Automated multi-step continuations and codimension-2 searches.
These helpers wrap :class:`ODESystem.run` with bookkeeping for two common
patterns:
* ``continue_period_doubling_bf``: chase a period-doubling cascade in two
parameters, recursing on every new PD point encountered.
* ``codim2_search``: 2-parameter co... |
71c710e045e9db5e9a2d5707a3271264ac3dc8fd4e07f11d233176cca029bb68 | Python | 22,806 | 671 | """Define data objects."""
from warnings import warn
from functools import wraps
import numpy as np
from specparam.sim.gen import gen_freqs
from specparam.data import SpectrumMetaData, ModelChecks
from specparam.utils.array import unlog
from specparam.utils.spectral import trim_spectrum
from specparam.utils.checks i... |
861822f17d226a6741d9cc86c3a46eeec3ef1076f35ed94ecf104edd51939f9b | Python | 22,807 | 476 | #!/usr/bin/env python3
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import glob, re, argparse, sys, os
import sklearn.metrics
import scipy.stats
import seaborn as sns
import seaborn.utils, seaborn.palettes
from seaborn.palettes import blend_palette
from inspect import sign... |
c3603136cb07061b244af909c41402c7a524c293b1c69cac44c38ec47878069d | Python | 22,824 | 515 | import argparse
import csv
import os
import pathlib
import time
from argparse import RawTextHelpFormatter
from collections import defaultdict
import cv2
import numpy as np
from termcolor import colored
from tifffile import imwrite
from ultralytics import YOLO
#
# Input arguments
#
parser = argparse.ArgumentParser(
... |
9b57b5c58d3e67c46f0ae97420dd036079a25d76ecf25f23e4474a07570dfbe8 | Python | 22,828 | 533 | import sys
sys.path.append('../TM2_segmentation')
import os
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
import logging
import SimpleITK as sitk
from scipy.signal import medfilt
import numpy as np
import nibabel as nib
import scipy
import skimage
import functools
from skimage.transform import resize
import subprocess
im... |
a811b7bab9b849bc8f68452142173de0739f932e14a91ec308b3c18ad48e7592 | Python | 22,838 | 556 | """Read/write enforcement over the postprocess axes matrix (design §8.2).
Enforcement ships THIS phase: every axis of the recording matrix runs with
the combined audit in ENFORCE mode — observed writes must be a subset of
declared writes, observed reads a subset of declared reads + probes, and
row-clone reads only on ... |
14fb4815d9b06a436e938ee5006e351da2d7a2c96935d058eec199cfee766150 | Python | 22,846 | 612 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
6202498f017ca4c533e31533c9b3ac9613892169fa40a12721d7f936fda9d919 | Python | 22,868 | 575 | """Written by @Jinerhal, adapted by @Xiaojieqiu.
"""
import math
from typing import List, Optional, Tuple, Union
import cv2
import numpy as np
from anndata import AnnData
from skimage import morphology
from ..configuration import SKM
from ..logging import logger_manager as lm
@SKM.check_adata_is_type(SKM.ADATA_UMI... |
d2c99b374405d3ea90ba73b9389266ee176b4fe5e630ee8d539dcfc779c9da69 | Python | 22,891 | 616 | import os
from tqdm import tqdm
import numpy as np
import pandas as pd
import torch
from torch_geometric.data import Data, InMemoryDataset, Dataset
import torch_geometric.transforms as T
from rdkit import Chem, RDConfig
from rdkit.Chem import ChemicalFeatures, MolFromSmiles, AllChem
from collections import defaultdict
... |
031b330fcff920467034df9bcd8677f98b42aeee39210d0069ee273e7139ed2a | Python | 22,892 | 532 | """
Adapted from https://github.com/pytorch/pytorch/tree/8fa328f88e12d55a216e3274a013767a6a7626f6
Multiheadattention with the one modification being not taking the mean of the attention matrices
"""
from typing import Optional, Tuple
import warnings
import torch
import torch.nn as nn
from torch import Tensor
from to... |
467e19b61767247547ceb47d50fc8e1aca0bcd8149c5e30392ce958db432e4e5 | Python | 22,892 | 707 | """Reading and Writing"""
import json
import logging as logg
from collections.abc import Iterator
from os import PathLike
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scanpy
from anndata import AnnData
from h5py import File
from matplotlib.image import imread
... |
fa9e707d76a2e8a5044de38563bb5d02f3029509a0bebbe2aac08fdd7889fb37 | Python | 22,909 | 401 | # Copyright 2018 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 ... |
7662567a645cfd59a6c0bf5448ae7fb31f95536dca37549004d387cf316d57c8 | Python | 22,915 | 672 | from __future__ import annotations
import pytest
import env # noqa: F401
from pybind11_tests import numpy_array as m
np = pytest.importorskip("numpy")
def test_dtypes():
# See issue #1328.
# - Platform-dependent sizes.
for size_check in m.get_platform_dtype_size_checks():
print(size_check)
... |
4749c6c291b5dcdf63454a797e1b51c25bf4c7039a80b1231323368e2a8e234d | Python | 22,921 | 681 | """Phase 7 rerun engine and atomic swap tests."""
from __future__ import annotations
import importlib
import warnings
from typing import Any
import pytest
import torch
from example_models import TinyReluAdd as ReluAdd
import torchlens as tl
from torchlens._capture_state_helpers import reset_compiled_model_unwrap_wa... |
8186f78652e2e56e73437330aeadd867bdb2011c65ba115b7b6d386d28d5bacc | Python | 22,924 | 530 | import pandas as pd
import numpy as np
import wget
from zipfile import ZipFile
# from utils_deeppurpose import *
import json
import os
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
'''
Acknowledgement:
The BindingDB dataset is hosted in https://www.bindingdb.org/bind/index.jsp.
The Da... |
51108fc1ff1d5f7af00accba19d4079f424b533357289e8e5bad223223b20e06 | Python | 22,926 | 733 | """
Useful widgets for the UI - combines tkinter UI widgets with variables
for simpler value setting and retrieval.
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 m... |
6c8916147e51b73d424018544d5fd9f4d0e120206b945ebabd2b0e5b5342e4e4 | Python | 22,927 | 532 | ## implement the spectral temporal functions from sam norman-haignere's code (based on the NSL toolbox from shamma lab.
## jfeather 3/23/17
import numpy as np
import matplotlib.pyplot as plt
def filt_temp_mod(fc_Hz, N, sr_Hz, LOWPASS=False, HIGHPASS=False, show_plots=False, zero_pad=False):
"""
Make temporal... |
dd44c5ea4318b2b31c3f57c220f2f58f852c541d2501073081feab73e8a33ab7 | Python | 22,929 | 588 | import logging
import os
import sqlite3
import time
import traceback
from .base import BaseAsyncSQLWriter, BaseResultWriter
from .helpers import Null
class AsyncSQLiteWriter(BaseAsyncSQLWriter):
"""
Asynchronous SQLite database writer running in a separate process.
Similar to AsyncMySQLWriter but for SQ... |
c809bdc34f29bb0a83d246b8da5d368de33b42f7ade5701d72fc2ee1dc318ff1 | Python | 22,931 | 642 | """Every capture entry point hands the model back exactly as it went in.
Regression pins for two model-state leaks:
* After any ``tl.trace`` or ``tl.record``, every non-root submodule kept an
instance-level TorchLens ``forward`` wrapper that closed over the ORIGINAL
module and its bound forward. ``copy.deepcopy``... |
4f0fa5a56ad33b848360e4b45eb73c828aedc588de1a1bd0c566b073165bd4ba | Python | 22,953 | 615 | """One-backward reads: the typed refusal surface (F04, teaching refusals).
Every refusal branches on ``exc.fields["code"]`` (never message text) and
carries a non-empty remedy. Covers the liveness gate, target normalizer
teaching (memo test 10's TypeError kill), option vocabularies, the explicit
population contract (D... |
e4b36a7cf0d7bdbe2ce611317dfdc1b12088706ed6348ddfee782af1557fcf82 | Python | 22,957 | 601 | import errno
import os
import signal
import sys
from unittest.mock import Mock, call, patch
import pytest
import t.skip
from celery.apps.multi import Cluster, MultiParser, NamespacedOptionParser, Node, format_opt
from celery.platforms import Pidfile
from celery.utils.nodenames import node_format
class test_function... |
c415f5862c02a0cf9c582b1d35b80c0d8c4f84cd79457f62100c8bdd9b23e1f5 | Python | 22,968 | 602 | # --- 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 = "barpolar"
_path_str ... |
3037666c2c4066d9231365d879e48dcd831e98917d04a06b5f98f88986363876 | Python | 22,971 | 546 | import os
import os.path
import copy
from itertools import chain
from mirp._data_import.utilities import supported_file_types, dir_structure_contains_directory, match_file_name, \
isolate_sample_name, lookup_modality
from mirp._data_import.generic_file import ImageFile, MaskFile
from mirp._data_import.generic_file... |
090d2bd696756f7c952c9c2eee32cab74d103995eacb2ab3f808c1da7918d1ec | Python | 22,985 | 652 | # -*- coding: utf-8 -*-
import argparse
import os
import sys
import time
import brainpy as bp
import brainpy.math as bm
import jax
import jax.numpy as jnp
import numpy as np
import torch.utils.data as data
import torchvision.datasets as datasets
import torchvision.transforms as transforms
import tqdm
from torchtoolb... |
4d958ce4d2fcc58eb14271d04cc92e7a91e66795a5b7b04a771d10a6f05db290 | Python | 22,987 | 592 | """grind-p3 T5.1: a model IMPLEMENTATION change must invalidate the capture cache.
The capture-cache key fingerprinted only tensor content (``state_dict`` values,
training flags, non-persistent buffers) plus the call configuration. Two models
with identical parameters but DIFFERENT forward code therefore collided on t... |
d5abd724352987e4d90c4d5799427236cb9e0796f40d671c80ce2bb6b3d1d10b | Python | 22,994 | 472 | import pickle
import torch
import numpy as np
import src.helpers as helpers
import src.generate_data_von_mises as dg
from sklearn.model_selection import StratifiedKFold
def get_delay_timepoints(constants):
"""
Extracts the endpoints of the delay intervals.
:param module constants: A Python module containi... |
7d822d38461e0d4da2985f8301e134dd68ce5b7741b8a6bbfb2b673e303634d4 | Python | 22,998 | 629 | from collections.abc import Iterator
from dataclasses import dataclass, fields
from functools import reduce
from itertools import product
from operator import mul
from typing import List, Sequence, Union
import numpy as np
import scipy.signal
from scipy.linalg import norm
from .. import _info
from .._data_obj import ... |
8dfaa1ec4e3ab3155f4a8671fb1e437f510ed917a7bff631d6cd2f558c5daed8 | Python | 23,002 | 360 | '''LDDMM image registration: LDDMM (2D to 2D) and LDDMM_3D_to_slice (3D atlas to a 2D slice).'''
import warnings
import torch
try:
from ._lddmm_common import SIGMA_DISP, prepare_problem, resolve_defaults, run_lddmm
except ImportError:
from _lddmm_common import SIGMA_DISP, prepare_problem, resolve_defaults, ru... |
52c48965ce22031aa81dcc97e1cb4d15958044a03da990d4deb8febe02475e8c | Python | 23,005 | 687 | import logging
import os
import threading
import traceback
from concurrent.futures import ThreadPoolExecutor, as_completed
from optparse import OptionParser
import bottle
from helpers import (
WrongMachineID,
assert_node,
generate_new_device_map,
get_commit_version,
record_device_intervention,
... |
8ea67a68517d33215fa2526e56e7891569b48f91500a65fd6420bbe09010f253 | Python | 23,006 | 512 | import argparse
import logging
import pathlib
import numpy as np
import torch
from neural_net import StructureDataset, NeuralNetwork
from plots import Plots
from sklearn.metrics import classification_report, cohen_kappa_score
from torch import nn
from torch.utils.data import DataLoader
from constants import A... |
ec6de433c8b879e0103415f5d5f89cfcba5ed0619ad91c7ffb9f74d74d139934 | Python | 23,008 | 481 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import json
import re
import types
from functools import lru_cache
from pathlib import Path
import cv2
import numpy as np
import torch
from ultralytics.utils import ASSETS, IS_JETSON, LOGGER, TORCH_VERSION, Thread... |
b2b3e9a4c6f70602ff70b808528c7573ed664780dfdefd52bfec8d4b52000411 | Python | 23,020 | 568 | # encoding: utf8
"""
PyTorch implementation of the HMAX model of human vision. For more information
about HMAX, check:
http://maxlab.neuro.georgetown.edu/hmax.html
The S and C units of the HMAX model can almost be mapped directly onto
TorchVision's Conv2d and MaxPool2d layers, where channels are used to store the... |
27780065a5fb0638b7136c689af54437ac04c53e5a6c75a9b16e423fcd36657f | Python | 23,031 | 472 | #!/usr/bin/env python
#
# Copyright 2006, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
eb8ef8b28c4cb840ba2fcd97c73719a8c70f192c2102511fe551e73a7a6315f9 | Python | 23,034 | 552 | # 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... |
641b5418e1a1364550bac7aab5dbaa2604c6a05eaa2eae563635920834e8b428 | Python | 23,036 | 670 | # Python
import os
import math
# 3rd party
import torch
# NITorch
from nitorch.spatial import (affine_matrix_classic, affine_basis,
affine_grid, grid_pull, voxel_size, max_bb)
from nitorch.tools.preproc import (atlas_crop, affine_align,
atlas_align, reset_... |
2b54bd42252ae91602ae8d6d40846db3e26426b75066b6999cd3bdcc181171d7 | Python | 23,046 | 446 | """SSD Estimator."""
# pylint: disable=logging-format-interpolation,abstract-method,arguments-differ,logging-not-lazy
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 nd
from mxnet import gluon
from mxnet import autograd... |
324d20ed68269c6dfbbc95984eaf3e25a59887aeb863c0e7efb2dfee14577789 | Python | 23,053 | 610 | from pathlib import Path
import numpy as np
import pandas as pd
import matplotlib.pylab as plt
import argparse
import os
import pickle
from plotting_specs import *
from scipy.stats import pearsonr, spearmanr
import matplotlib.patches as mpatches
import itertools
import datetime
import getpass
import sys
from os.path im... |
a9ac69caf27029cf0d5caaf585a8416a1f0c58bef0cc12260216f7b478e0aff8 | Python | 23,075 | 742 | #!/usr/bin/env python
"""
Test fixtures and mock data for notification system tests.
"""
import datetime
import json
import time
from unittest.mock import MagicMock, Mock
import pytest
@pytest.fixture
def sample_ethoscope_config():
"""Sample configuration for ethoscope system."""
return {
"smtp": {... |
d6649595bb7229aec2d752b0d0c7e7c15e782aa333bcd5b236bc22a970affa52 | Python | 23,098 | 449 | """YOLO Estimator."""
# pylint: disable=logging-format-interpolation,abstract-method,arguments-differ,logging-not-lazy
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 mxnet import autograd
from mxnet.contrib ... |
dec1bddb7dc301068969ecc851f54fa1dd136deb43eb0704b662b2ad562aba87 | Python | 23,099 | 637 | #! /usr/bin/env python
from tensorqtl import trans, genotypeio
import tensorqtl
from sqlalchemy import create_engine
from sqlalchemy.pool import NullPool
import os
import sys
import pandas as pd
import numpy as np
import psycopg2
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
import time
import multiproces... |
438e29f9cfabd7d9905ceabedecfe0328d70757534ddd4cc24cb5b80ebc99f8d | Python | 23,101 | 602 | import copy
import os
from pathlib import Path
import networkx as nx
from networkx.utils import arbitrary_element
from networkx.algorithms import isolate
import pandas as pd
import dgl
import dgl.data
import numpy as np
import torch
from torch._C import Graph
from torch_geometric.data.data import Data
from sklearn.prep... |
7db17bf08badb559051c1e25fd9f0bb8b6105c30068965899ee9370fb4c73bdf | Python | 23,112 | 547 | """GTN Training Agent - searches Galaxy Training Network tutorials and FAQs."""
import json
import logging
import re
from pathlib import Path
from typing import (
Any,
)
from pydantic import (
BaseModel,
Field,
)
from pydantic_ai import (
Agent,
RunContext,
)
from galaxy.gtn import GTNSearchDB
fr... |
0a07bae0c0f6aac0a24e298f6cf116bdf34aa266e6dc80ca5479a3ca5f8bb82f | Python | 23,127 | 495 | # -*- coding: utf-8 -*-
""" Deeplabv3+ model for Keras.
This file is based on this repo by Emil Zakirov and others:
https://github.com/bonlime/keras-deeplab-v3-plus
This model is based on TF repo:
https://github.com/tensorflow/models/tree/master/research/deeplab
On Pascal VOC, original model gets to 84.56% mIOU
Mobile... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.