sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
96068f16f3f397d8c9389168b2b35a14f933aa53db10451286b15a253e0a3165 | Python | 19,279 | 466 | import pandas as pd
import torch
import numpy as np
from pandas import read_csv
import os
from tqdm import tqdm
import torch.utils.data as dat
import xlrd
import csv
class NiLoader:
"""
step 1: 整理好数据,一定要先让三个文件夹的记录对应起来
step 2: run body_information
step 3: run clean(), 我把数据加载写好了,你把之前清理数据那部分放过来就行
""... |
a9d4f538b444643a66ed9375de256239727a0dcbde60bd413dc2e8eccda770b5 | Python | 19,286 | 479 | import os
import re
import numpy as np
import torch
import torch.nn as nn
import torchmetrics
import matplotlib.pyplot as plt
from ont_fast5_api.multi_fast5 import MultiFast5File
from torch.utils.data import dataset
from torch.utils.data import dataloader
from sklearn.metrics import roc_curve, auc
from tqdm import tqdm... |
d267c0cb50d92a3bf876d197da39c72853d37a6e52514c6a7acc54a0ff6ebef4 | Python | 19,290 | 386 | import logging
import os
import signal
import tempfile
import time, gzip, pickle
import re
import math
import json
import fcntl
from collections import OrderedDict
import numpy as np
from helixfold.data.tools import jackhmmer
from helixfold.common import residue_constants
from helixfold.data import parsers
logging.b... |
b3833cad079be759237c6ebe6f29204ad5faed1ccd17ab9fd32f25ae5883e20f | Python | 19,294 | 353 | import sys
import os
import gc
sys.path.append('../TM2_segmentation')
import SimpleITK as sitk
import numpy as np
import pandas as pd
import nibabel as nib
from skimage.transform import resize, rescale
from scipy.ndimage import rotate
from scipy import ndimage
import matplotlib.pyplot as plt
from numpy import median
i... |
27905a06e1e98ce820f3698199d975f6e17c193fc340ef74c5a918ac37cabacd | Python | 19,315 | 651 | # Copyright 2023 DeepMind Technologies Limited
#
# 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 agree... |
54b9b8765f1fbd0cd3f8a563663ea24671078d3e38e1b321c9c9a667bc54cae9 | Python | 19,317 | 488 | import heapq
import itertools
from scipy.spatial import cKDTree
import numpy as np
import mdtraj as md
import torch
from scipy.spatial.transform import Rotation as R
def pbc(trajectory: md.Trajectory, box_length: float) -> md.Trajectory:
"""Centers an mdtraj Trajectory around the centre of a cubic box with the gi... |
b0a4f96502ec9a13524337a33eca246d5ad769a32685a168326918b54ed24764 | Python | 19,318 | 438 | # MIT License
# Copyright (c) 2018 Adrian Wolny (https://github.com/wolny/pytorch-3dunet)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation t... |
78b4f215f95bf026f850d943f99e9f6ab4c7727e48409b2ddec52164a4c70fcc | Python | 19,323 | 589 | """
Provides utilities for working with GFF files.
"""
import copy
from bx.intervals.io import (
GenomicInterval,
GenomicIntervalReader,
MissingFieldError,
NiceReaderWrapper,
ParseError,
)
from bx.tabular.io import (
Comment,
Header,
)
from galaxy.util import unicodify
FASTA_DIRECTIVE = ... |
e4cb1b55e575489d4484520a3f799d28f0493b91c45bdfbe329a7297aaeb897b | Python | 19,330 | 540 | """Benchmark varlen tile schedulers against each other across length distributions.
Compares the dynamic persistent scheduler, the static single-tile scheduler, CLC
(where supported), and — on constant-seqlen workloads — the non-varlen
`flash_attn_func` baseline.
Examples:
python benchmarks/benchmark_varlen_sched.p... |
1ee9f5df61f14cbaed158d7cb4ab2f5e328d516eccc10350328a1cc5fc9a17f3 | Python | 19,340 | 566 | """
Entry point serving the portal.
Builds the Panel application, mounts every app under its route and starts the
server.
"""
from __future__ import annotations
import base64
import os
import signal
import sys
import threading
import time
import traceback
from functools import lru_cache
from importlib import import_... |
c6a017335a10aa239a431fe84c66098d109e4cb2510cc43d1ea428373a7daf68 | Python | 19,341 | 547 | # 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... |
33e011bb61433dfb005f9c53599ef7eb9fb8032549e349fd85d9e95ad114d224 | Python | 19,345 | 465 | """Load-boundary structural validators for the op graph, edge carriers, and annotations.
AUD-CODE 3.0 (a)/(b)/(d) (W051-IO): three claim families the portable loader
never checked before -- the retained op family's label/pass/relation
coherence (``artifact_graph_structure_invalid``), the L6 tier-(ii) edge/param
substi... |
72cc163d52b7e86df084defe3ebaa86c5ca0933181ae06002f8037b728193e2f | Python | 19,354 | 502 | import os
import sys
import numpy as np
import pytest
import tensorflow as tf
import torch
from absl.testing import parameterized
from torch.distributed.tensor import DTensor
from torch.distributed.tensor import Replicate
from torch.distributed.tensor import Shard
from keras.src import layers
from keras.src import mo... |
11ca76bc4487f7e466c670cfa28a57d5305f84afea361e81191145df013814fa | Python | 19,357 | 511 | # -*- coding: utf-8 -*-
import os
import yaml
import glob
import h5py
import json
import inspect
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import nibabel as nib
from sklearn.linear_model import Ridge, LinearRegression
from nilearn.masking import compute_epi_mask, ... |
7cd30aa6a6184610b2462672504b3c1b4061759bd4a68ecff747262012e36331 | Python | 19,357 | 586 | """Theano/Lasagne/DyNet-era landmark architectures, 2014-2016.
Paper: Compact faithful reimplementations of notable Theano/Lasagne/DyNet-era
architectures that are less often available as modern PyTorch atlas models.
Included entries:
- Spatial Transformer Network (Jaderberg et al., NeurIPS 2015): Lasagne
recip... |
cfe3fa1dafc97afb6e407d0fcbfbd1f4fb84dcc579abeeaf3db091e7731ee96f | Python | 19,360 | 535 | """
module for custom functions used for creating and training the model
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchmetrics
import torchvision
import torchvision.models
import pytorch_lightning as pl
from time import time
import scipy
from pytorch_lightning.utilitie... |
0d1e3aadff4b90f1d266f805790f98afb1e048695ac1b25b43443289b33c31c7 | Python | 19,371 | 518 | """
Batch simulation runs over a parameter space.
Sweeps a set of parameters across many single runs, optionally optimizing
towards a target value, and collects the results into one batch dataset.
"""
from __future__ import annotations
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from .single_run impo... |
3aab8fa885858f2b41a9cd439bea96faaf63b3113472ded62e044615eaa15b68 | Python | 19,372 | 511 | import uuid
from pathlib import Path
import webbrowser
import hashlib
import base64
from _plotly_utils.optional_imports import get_module
from plotly.io._utils import validate_coerce_fig_to_dict, plotly_cdn_url
from plotly.offline.offline import _get_jconfig, get_plotlyjs
_json = get_module("json")
def _generate_sr... |
0f36c08762d1816767bc387dd1e363d3f09ccf9098aa64388cc51742feedd37c | Python | 19,376 | 435 | from typing import Any, Dict, Iterable, List, Optional, Tuple
import argparse
import collections
import os
import random
import torch
import transformers
from imodelsx.iprompt.autoprompt import AutoPrompt
from imodelsx.iprompt.hotflip import HotFlip
from imodelsx.iprompt.utils import device, PrefixLoss, PrefixModel,... |
41ff07229bdc5716e2c93ff0f2cbacd229a92d80aab9318839eefd2764fc7530 | Python | 19,384 | 448 |
# Copyright (c) 2020 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 appli... |
d3ce661910632d1bebcc0f7e86bd21576ac47de546950e6902fdc488b96ba8ae | Python | 19,385 | 472 | """
process_recording plugin - UI load and handling
Post-processing of electrophysiology recording, including baseline correction,
filtering, and trace-averaging
SimplyFire - Customizable analysis of electrophysiology data
Copyright (C) 2022 Megumi Mori
This program comes with ABSOLUTELY NO WARRANTY
This pro... |
16b3d18082e7026e4f940133d0f88e3505db078ff680b548351c0d7942437dfa | Python | 19,388 | 446 | from . import InvertibleModule
from warnings import warn
from typing import Iterable
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class IRevNetDownsampling(InvertibleModule):
'''The invertible spatial downsampling used in i-RevNet.
Each group of four neighboring pixe... |
fda4caf293a9eec23dcf98ef5c4165680611520a69201894d24f0cb893355290 | Python | 19,388 | 560 | """App utilities: Compat settings, bug-report tool, pickling apps."""
import os
import platform as _platform
import re
from collections import namedtuple
from collections.abc import Mapping
from copy import deepcopy
from types import ModuleType
from celery.exceptions import ImproperlyConfigured
from celery.platforms i... |
b624ddfb1845369f434f390cdcb49597f02803a782fa44bfbd314db303775a41 | Python | 19,394 | 478 | """Direct ``torch.ops.*`` calls inside forward are recorded with sources and validate.
A raw ``torch.ops.aten`` call, a ``torch.library.custom_op`` and an operator a C++
extension registered with ``TORCH_LIBRARY`` all reach the dispatcher through the
``torch._ops`` call classes, past every namespace wrapper. TorchLens... |
6ab6b783b6d87c5925532f93449ac409ebea75231bac2e6b5f2e10766d1cdd26 | Python | 19,398 | 518 | import numpy as np
import nibabel as nib
import pydicom
from os.path import join, exists, basename, split, isdir
from os import listdir, environ
try:
from skimage.draw import polygon
except ImportError:
print('Caught Import Error while importing some function from scipy or skimage. '
'Please use a new... |
ba5dc0b7db3564865dd9509ff5f6d6f7106d4fe0c54ae95deafbd50e4d1cdccf | Python | 19,402 | 548 | from pyControl.utility import *
import hardware_definition as hw
#-------------------------------------------------------------------------
# States and events.
#-------------------------------------------------------------------------
states= ['init_trial',
'choice_state',
'choose_left',
... |
c842795ed60e151f950177c1b92789e982b8712c3683947b4471e13c605ed059 | Python | 19,410 | 511 | """
This is the script containing all uility functions used for the implementation.
This code and data is released under the Creative Commons Attribution-NonCommercial 4.0 International license (CC BY-NC.) In a nutshell:
# The license is only for non-commercial use (commercial licenses can be obtained from Sta... |
46e8b5107896735132ec414daa88d04e2e1b2b33fbbaa3d52415af36d7718b52 | Python | 19,415 | 425 | import os.path
import pytest
# Find path to the test directory. This is because we need to read datafiles stored in subdirectories.
from mirp.data_import.import_mask import import_mask
from mirp._data_import.itk_file import MaskITKFile
from mirp._data_import.dicom_file_rtstruct import MaskDicomFileRTSTRUCT
from mirp.... |
1834b25e911415300bb9d4aab4bc363a22636bd5b932ac66bcf04b9ddd3c57d6 | Python | 19,416 | 403 | """
Read abf files and store as Recording class
Data format for recording data used in the SimplyFire software.
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/... |
5bdd03929fa9b4b7749161a4b47df34f822d5412e9a6cad7944184711fef1948 | Python | 19,419 | 425 | import math
import os
import sys
import time
import logging
import contextlib
import GPUtil
import numpy as np
import cupy as cp
from cupyx.scipy.signal import fftconvolve
logger = logging.getLogger(__name__)
logger.setLevel(logging.WARN)
handler = logging.StreamHandler()
handler.setStream(sys.stdout)
logger.addHand... |
f7812d300a40458948116747022c26cd6b28762faa6ffc20d763333b488e79f0 | Python | 19,420 | 507 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Test objects and function in the module ``tfep.potentials.psi4``.
"""
# ======================================... |
d9545a284c1864d22674ba7b14aeff772c4ba7da65eade4657df766405b5fd61 | Python | 19,425 | 495 | """Image alignment pipeline and video frame ingestion.
``Image_preparation_pipeline`` builds a clean reference image for registration
from a sequence of frames by downsampling, masking with a VQT spectrogram to
keep only low-spectral-variance (non-behavior) frames, and applying CLAHE.
Also provides SFTP / local video ... |
f0c46952dc2cb84e46739c65a93975beba7c6e25e39487bb35750ed50d1059a3 | Python | 19,440 | 556 | import os
import typing
import warnings
from types import ModuleType
from warnings import warn
import rpy2.rinterface as rinterface
from . import conversion
from rpy2.robjects.functions import (SignatureTranslatedFunction,
docstring_property,
Doc... |
e71f13ca5734c57f04a85103db11ca60858d4a2c3fd673f273d1e85f003f540e | Python | 19,443 | 585 | from __future__ import annotations
import json
from pathlib import Path
from types import SimpleNamespace
import pandas as pd
import pytest
from larvaworld.lib.sim.manifest import (
MANIFEST_FILENAME,
RunManifestSession,
attach_manifest_to_datasets,
canonical_sha256,
capture_registry_snapshots,
... |
19d5559c09d9f180223ce64e4b4dbe55502c5d09b5bae4cc3f51f3e273454b38 | Python | 19,450 | 473 | #!/usr/bin/python3
##########################################################################
## ##
## Copyright (c) 2019 Philipp Lösel. All rights reserved. ##
## ##
#... |
08bbfa2aedbb79a8d6f0c1403c139333893e4342e44d6a34c7e9b5df29efba71 | Python | 19,455 | 445 | import subprocess
import unittest
from textwrap import dedent
from unittest import mock
import numpy as np
from codecarbon.external.ram import RAM, RAM_SLOT_POWER_X86
# TODO: need help: test multiprocess case
class TestRAM(unittest.TestCase):
def test_ram_diff(self):
ram = RAM(tracking_mode="process")
... |
fb8660a926fbf593b1ba59842b17b88a56324c32353bbd7ad8064a2fb8e0f78d | Python | 19,455 | 507 | """The REFUSED -> COUPLED flip (lane F42's LAST commit).
The trace-verb verdict's item-7 test list, verbatim: interventions before,
inside, and after a stepped call; zero and multiple fires; changed output
and step count; same/new-input replay; ``forced_feed``; ``halt=``; selective
save; save/load; and failed or exoge... |
94bebac34de898fa9a9bc2bb8cb87702981ed9b608d60f2f0989c3fa395fa5f5 | Python | 19,460 | 394 | #!/usr/bin/env python3
"""
File: run_PICALO_simulations.py
Created: 2023/07/14
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 University Medical Center Groningen.
A copy of the BSD 3-Clause "New" or "Revised" License can be found in the
LICENSE file in the root directory of this source tree.... |
92bbb131249b5b6639ad1c1f5a55de9a47d62a4a021a66804c5ff7b7fa4f5714 | Python | 19,462 | 522 | import sys
import numpy as np
import torch
import scipy.sparse
from chemical import *
from scoring import *
def th_ang_v(ab,bc,eps:float=1e-8):
def th_norm(x,eps:float=1e-8):
return x.square().sum(-1,keepdim=True).add(eps).sqrt()
def th_N(x,alpha:float=0):
return x/th_norm(x).add(alpha)
... |
f7bae50d97f332ca2b212dfbbb9b70b3bfa9d7b512aca6c49698463047b42359 | Python | 19,462 | 514 | """
Unit tests for ROI Template API endpoints.
Tests ROI template management including listing, uploading, and deployment
to devices.
"""
import hashlib
import json
import os
import tempfile
import unittest
from unittest.mock import MagicMock, Mock, mock_open, patch
import bottle
from ethoscope_node.api.roi_templat... |
292cb8ea2da456051503153de2b977be5c6dbc4ca5c9821a58c14bb100bed566 | Python | 19,465 | 601 | '''
The setup functions for running the NMR Pretraining.
Do things improve when standardizing it by subtracting the mean and dividing by the standard deviation?
'''
import numpy as np
from rdkit import Chem
import os
from rdkit.Chem import ChemicalFeatures
from rdkit import RDConfig
import networkx as nx
from collect... |
a52041782014207dbb10202dfa544b7d869ab585156007de2e4793d2aec53578 | Python | 19,465 | 580 | """
Registry of the entries shown on the portal's landing page.
"""
from __future__ import annotations
from larvaworld.portal.registry_types import (
LaneSpec,
LandingItem,
LearnMore,
QuickStartModeSpec,
)
DOCS_ROOT = "https://larvaworld.readthedocs.io/en/latest/"
DOCS_TUTORIALS = f"{DOCS_ROOT}tutori... |
92500edc0c52d3fc68658ff72f0c118d3e136f1b5d23006b9a72c9be01bab062 | Python | 19,467 | 714 | """
shared options and groups
The principle here is to define options once, but *not* instantiate them
globally. One reason being that options with action='append' can carry state
between parses. pip parses general options twice internally, and shouldn't
pass on state. To be consistent, all options will follow this de... |
c0620a62c0fedb13288b302b9278c3d6aac76a99d113cd281041064d73536ec8 | Python | 19,473 | 545 | """model.py - Model and module class for EfficientNet.
They are built to mirror those in the official TensorFlow implementation.
"""
# Author: lukemelas (github username)
# Github repo: https://github.com/lukemelas/EfficientNet-PyTorch
# With adjustments and added comments by workingcoder (github username) and Alex... |
76407c1330137af7c9afec7e85636cef7464204f6239d26e154ff8f8862c2068 | Python | 19,477 | 460 | """Base class for SavedModel export archive."""
import contextlib
from keras.src import backend
from keras.src import layers
from keras.src import tree
from keras.src.export.export_utils import make_tf_tensor_spec
from keras.src.utils.module_utils import tensorflow as tf
class BaseSavedModelExportArchive:
"""Ba... |
b99684851258c2cc03495aa8ec76677d8c5e32eb363017a40f4eb248b8525785 | Python | 19,485 | 551 | #!/usr/bin/env python3
import numpy as np
import argparse
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import os
import scipy
import pints
from MarkovModels import common
from matplotlib.gridspec import GridSpec
from matplotlib import rc
rc('font', **{'family': 'serif', 'serif': ['Comput... |
6ec2a2f9b61ed06664fb1e761047dbe400f0add540d9938f5748a408d85ba4b1 | Python | 19,493 | 391 | """
Scripts for running the best layer analysis for the fMRI data and plotting it.
Moved here to clean up the notebook.
See fMRIBestLayerVsMetamerRecognition.ipynb for usage
"""
import numpy as np
import pickle
import os
import matplotlib.pylab as plt
from model_analysis_folders import all_model_info, color_model_... |
12b8fb2aae654dc33598ab447bc9871ec6af2c80c9debf14d567cd081ddec66b | Python | 19,494 | 437 | ''' Sampling and coordinate transforms of fitted STalign mappings, in 2D and 3D.
Implementation of STalign.interp, interp3D, v_to_phii(_3D), build_transform(3D),
transform_image_*, transform_points_* and analyze3Dalign (see their docstrings for the
parameters).
A mapping fitted by LDDMM or LDDMM_3D_to_slice is an aff... |
ef74f7595f432fab4965b1f6853a77cd32441a0c12384ef768547204be9e508d | Python | 19,495 | 470 | import json
import logging
import time
from typing import (
Any,
Optional,
)
from urllib.parse import quote
from galaxy import exceptions
from galaxy.files import (
ConfiguredFileSources,
FileSourcesUserContext,
)
from galaxy.files.models import (
FilesSourceOptions,
PartialFilesSourcePropertie... |
e32ecca315b0803358fed4982d2dca40f7b67cb9bc325f2dd965fb4ac16ecb65 | Python | 19,498 | 456 | """
Provides functionality to compute emissions for cloud & private infra
based on impact & energy Usage package
https://github.com/mlco2/impact
https://github.com/responsibleproblemsolving/energy-usage
"""
import re
from typing import TYPE_CHECKING, Dict, Optional
from codecarbon.core import electricitymaps_api
fro... |
257ec405ec7bee8304ab3c3c80d58fdc4e8cbba2adff33f3abf5113c6b1dc780 | Python | 19,504 | 444 | """Repo-wide tripwire: no removed spelling creeps back in as a taught spelling.
The 2026-08 shim-removal pass (RULINGS Batch-8: FULL deletion, clean v2)
deleted every runtime deprecation shim, warned alias, alias property, and
moved-name redirect. ``tests/test_deprecation_inventory.py`` pins the PACKAGE
deprecation-fr... |
4a1d2750b0ba920fe2103d356d9322cc48d156088250544666c0c2c42f301d4a | Python | 19,509 | 556 | #!/usr/bin/env python
"""
Deep Spatial Transcriptomics Model (DeepST)
Author: ChangXu
Created Time: Mon 23 Apr 2021 08:26:32 PM CST
Description: A deep learning model for spatial transcriptomics data analysis combining graph neural networks and autoencoders.
"""
import torch
import torch.nn as nn
import torc... |
91b07832171bae88ecc23b9bbf3698709229a64f0d7c8252135c88d0ccdefc1d | Python | 19,512 | 485 | import logging
import os
import torch
import transformers as tfs
import torch.nn.functional as F
import torch.nn as nn
from transformers.activations import ACT2FN
from src.layers.modeling_layers import TransformerEncoderWithPair
from src.layers.modeling_outputs import DownStreamModelOutput, BaseModelOutput, Pretraining... |
e860b498c731c690f7d13bd93a4c9f2e1b2314c17f1bc40484a489454c79bc72 | Python | 19,513 | 517 | #!/usr/bin/env python3
"""
Performance tests for the backup system file-based cache.
Tests the performance characteristics of the video file cache system
with realistic production-scale data (10,000+ files).
"""
import os
import shutil
import sys
import tempfile
import time
import unittest
from unittest.mock import M... |
ba8cebef637824bcffa60725f5bd218b46b6378a565c13082085a7dbe31355c0 | Python | 19,526 | 296 | #### Master Script 2b: Calculate TIL correlations and statistics of different study sub-samples ####
#
# Shubhayu Bhattacharyay
# University of Cambridge
# email address: sb2406@cam.ac.uk
#
### Contents:
# I. Initialisation
# II. Calculate correlation and statistics based on provided bootstrapping resample row index
#... |
5d82a42b216f8572c6cd3f765c70585e8448958f677a62c85f94f24b1a0122ed | Python | 19,536 | 494 | """Lane A11 extraction fails-open fixes (extract MEMO items 0 and 3).
Pins, per the trilab extract MEMO:
- ``load_extraction`` reads shards with ``mmap=True`` + ``weights_only=True``
(item 0; measured 13.4x on selective reads, retroactive on existing
artifacts) and returns byte-identical activations.
- ``stimulus... |
2037877b25a99dbeb9f516609d8dec7a8d616412e6ae8b8d49d5052e079e38c0 | Python | 19,539 | 486 | import pytest
from einops import rearrange, repeat
import torch
import flash_attn
import flash_attn_interface
import itertools
import math
import time
def construct_local_mask(
seqlen_q,
seqlen_k,
window_size=(-1, -1), # -1 means infinite window size
query_padding_mask=None,
key_padding_mask=None,... |
abaa925cb649ddbf031d36af8080edb9c60cf401407fb94d1f0b45cf3d92e6e3 | Python | 19,540 | 487 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from copy import deepcopy
import inspect
from typing import Optional
from .._exceptions import DefinitionError
from .._text import enumeration
from .definitions import Definition, typed_arg
def assemble_epochs(epoch_def, epoch_default):
epochs = {}
sec... |
eb9362af5eab81384e6ea4e7315f08e1559cdeb977a40b8c022da460edabd903 | Python | 19,544 | 344 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'score_window_ui.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
Mai... |
75949e992e42fa84b9f41fd07afd689387b186fef0679445e8ee6d5980c5dc7e | Python | 19,554 | 573 | """Stage 2b sparse runnable ``.tlspec`` producer tripwires."""
from __future__ import annotations
import gc
import json
import pickle
from pathlib import Path
from typing import Any
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens._io.runnable import (
assert_sparse_core_has... |
97a8046e8d6381f41ded81caab92a910c3b3b3cd2446cf95f9ec136221793ae7 | Python | 19,558 | 463 | from plot_utils_DIM import *
"""
Script for:
1. comparing regression/RSA consistency between datasets and among methods
Runs both layer-wise comparisons and model-wise comparisons
2. Compare best layer values between regression/RSA as used in Fig 5
For permuted plots, SpectroTemporal is excluded.
"""
### Director... |
dcc58f014a43f11e9647ca690ea744ecc0947998ab00bec5f7239ccb4fe39a35 | Python | 19,566 | 578 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
""" Utility functions for processing point clouds.
Author: Charles R. Qi and Or Litany
"""
import sys
# Point cloud IO
import numpy as np
... |
f9bbe02b766d8a601de8e5b1a2b9a6b5782e661ab47ae655764070029c1b2697 | Python | 19,570 | 626 | #!/usr/bin/python
import sys
import os
import re
import gzip
import pandas as pd
import numpy as np
import ConfigParser
import time
from bisect import bisect_left
import tabix
import csv
import subprocess
##### Return index of a1 which exists in a2 #####
def ArrayIn(a1, a2):
# results = [i for i, x in enumerate(a1) i... |
6a85f12973b97e9105472a3246cf7d39e611b6c04c12d1fc0735405f578aa18d | Python | 19,576 | 554 | """Functions related to the documentation.
docdict contains the standard documentation entries used across xcp_d.
source: Eric Larson and MNE-python team.
https://github.com/mne-tools/mne-python/blob/main/mne/utils/docs.py
"""
import sys
###################################
# Standard documentation entries
#
docdict... |
01922e7f79e9029e77f2b7ad50ee6f6484a48e731963b9ae921d71bb163e5d04 | Python | 19,580 | 507 | import numpy as np
import pandas as pd
import networkx as nx
import random
import pickle
import re
import string
from typing import Literal, List
# random.seed(2022)
global encode_dict
encode_dict = {l:i for i,l in enumerate(string.ascii_uppercase + " ", 1)}
'''
Parameters
----------
text : str
Returns
-------
tex... |
41300fea9c99f1388822af99cbd486d38aa77ef064e7aa4143739391cb4df5f5 | Python | 19,585 | 480 | import streamlit as st
import pandas as pd
import plotly.express as px
from scipy.stats import zscore
import altair as alt
import duckdb
import numpy as np
import plotly.express as px
@st.cache_resource
def load_data():
"""
Defines the database connection to the NOCICEPTRA duckdb database
"""
try:
... |
88aa55322f5690c3227c47655740d00066613382fec4165c342495b7a93e4d78 | Python | 19,593 | 526 | #!/usr/bin/env python3
import argparse
import os
import subprocess
import pysam
"""
Install deseq-clip
==================
conda install -c bioconda pysam
conda install -c bioconda htseq
pip install htseq-clip
Or directly by:
conda install -c bioconda htseq-clip
Test call
=========
python htsc_create_count_tabl... |
55b53dfc603086d5267f8d55490c37e99d4155000c6c9bfc381ab361f59286a3 | Python | 19,595 | 437 | from galaxy import model
from galaxy.exceptions import RequestParameterInvalidException
from galaxy.jobs.manager import JobManager
from galaxy.managers.context import ProvidesUserContext
from galaxy.managers.export_tracker import StoreExportTracker
from galaxy.managers.histories import HistoryManager
from galaxy.manage... |
0932f2bc8e6932e54f5ea02d4aae347c43d50193fb9f2c8892665554864337d3 | Python | 19,605 | 542 | import numpy as np
import torch
from ovseg.utils.torch_np_utils import check_type, stack
from torch.nn.functional import interpolate
from skimage.transform import resize, rescale
from scipy.ndimage import gaussian_filter
class GrayValueAugmentation(object):
'''
GrayValueAugmentation(p_noise=0.15, var_noise_mm... |
618db6cd09330194b38b639177ebe8e1206ad394e7d2153dcb14a778fd15c5e9 | Python | 19,613 | 516 | """Transforms substrate contract tests (transforms memo B1-B4 + P2; lane C04).
Covers the frozen :class:`TransformSpec` plan/apply protocol, canonical JSON
as the resume identity, the single ``coerce_transform`` door, the registry
(closed builtin set, versioned customs), declaration-based ctx dispatch (P2:
never ``ins... |
a8ccc937288ff601c1f3e931fc0637860446242f79931eb10553995b65aea7ea | Python | 19,616 | 559 | import os
import signal
import sys
import time
from pathlib import Path
from typing import Optional
import typer
from rich import print
from rich.prompt import Confirm
from typing_extensions import Annotated
from codecarbon import __app_name__, __version__
from codecarbon.cli.cli_utils import (
create_new_config_... |
bc411d2b2e2ee97c79e43905758fe9998c6ef318bc1df2c8d322820fa59e548d | Python | 19,620 | 467 | """Tigramite causal discovery for time series."""
# Authors: Elena Saggioro, Sagar Simha, Matthias Bruhns, Jakob Runge <jakob@jakob-runge.com>
#
# License: GNU General Public License v3.0
from copy import deepcopy
import numpy as np
import sklearn
from joblib import Parallel, delayed
from ortools.linear_solver import... |
697549477ecf79435a2d0446fd26e688e3377acad2ca3e57903d94e916c01f14 | Python | 19,622 | 486 | #!/usr/bin/env python
# coding: utf8
import numpy as np
import scipy.optimize as opt
import model,threshold
import sys
import pdb
__doc__ = """Functions to perform the monte carlo simulations for determining statistical significance
The central function of this module is mcsimulation, that takes two arguments that m... |
89791d1b1ee3beb467d6994a096991693341dc10c76d7fde62dce8583af96274 | Python | 19,623 | 452 | #!/usr/bin/python3
##########################################################################
## ##
## Copyright (c) 2019 Philipp Lösel. All rights reserved. ##
## ##
#... |
0fe54480a1f98d0ea9aab745a8724402d1f32161d32c31f44a9da688ec1d55ff | Python | 19,629 | 552 | import collections
import os
import time
from threading import Lock
import glfw
import imageio
import mujoco
import numpy as np
def _import_egl(width, height):
from mujoco.egl import GLContext
return GLContext(width, height)
def _import_glfw(width, height):
from mujoco.glfw import GLContext
retur... |
407d9b406917d337bc5b6be11fc10fcb7668b9c5b94c907f965d7ed02ba9b864 | Python | 19,634 | 426 | """Anti-recurrence schema-coverage tests for the FIELD_ORDER / to_pandas() desync class.
Two independent bug classes were found and fixed in the field-order-sync sprint
(cert3/cert4/cert5), and both must be gated so neither can silently reappear:
1. **FIELD_ORDER incompleteness** -- a field is genuinely set at constr... |
3b84b79c98d222784d6ca8852166b75b6cee3438d5b1542670d6fecb97102c81 | Python | 19,637 | 652 | import collections
import sys
import pytest
from kombu.utils.functional import lazy
from celery.utils.functional import (DummyContext, first, firstmethod, fun_accepts_kwargs, fun_takes_argument,
head_from_fun, is_numeric_value, lookahead, maybe_list, mlazy, padlist, regen,
... |
606ac9b83c9a0f8071440b28b417e61d49b2483735d179afd2376b2ae6cf4a2d | Python | 19,657 | 463 | """io durability + bounds hardening lane (fix/iodur, 2026-08-14).
Each test FAILS against the pre-fix behavior:
* MED1 -- the save path fsyncs every written file, the temp directory tree,
and the parent directory around the publish rename (no fsync existed
anywhere in ``torchlens/_io/`` before), so a power/OS cra... |
d15b0903a47738341495bf3ada8df5b8a51fd8db8a290858b5d1c3191ae3fc0a | Python | 19,665 | 449 | """Capture-cache content fingerprints and instance-attribute key fragments.
Split out of ``_capture_state_helpers.py`` under the R43 file-size ratchet:
the content-hash / code-digest / attribute-fragment family that feeds the
capture-cache key. The historical import surface
(``torchlens._capture_state_helpers``) re-ex... |
253e8fea66bc230707f7fbdca04854adafd53e26491a50583ef474712b7d0c49 | Python | 19,670 | 582 | from unittest.mock import Mock
import pytest
from celery import uuid
from celery.app import control
from celery.exceptions import DuplicateNodenameWarning, ImproperlyConfigured
from celery.utils.collections import LimitedSet
def _info_for_commandclass(type_):
from celery.worker.control import Panel
return [... |
df7c5960608457699ea81eaf69fc58fa11e6e00a326400ab56bc32ca520e5c0d | Python | 19,688 | 388 | """
Copyright (C) 2018 NVIDIA Corporation. All rights reserved.
Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
"""
# from torch.utils.serialization import load_lua
import torchfile
from torch.utils.data import DataLoader
from networks import Vgg16
from torch.a... |
9838029b69f92d8c82e8f17ea6aacf4307391e6767ac0f189eaaaee22298b5d3 | Python | 19,689 | 559 | """AWS DynamoDB result store backend."""
from collections import namedtuple
from ipaddress import ip_address
from time import sleep, time
from typing import Any, Dict
from kombu.utils.url import _parse_url as parse_url
from celery.exceptions import ImproperlyConfigured
from celery.utils.log import get_logger
from .b... |
22f3259d9a685fe7b501da7fa8647100afd5947c9f28db3f468ae27a8dc51e3c | Python | 19,691 | 581 | """Forward renders draw a source node for an in-place-mutated ``nn.Parameter``.
Capture records ``with torch.no_grad(): self.temp.clamp_(0.001, 0.5)`` (MIX-HIC) as an
op whose parameter input is ``temp``, and binds later reads of ``temp`` to that op. The
render adds one cylinder node per mutated Parameter, filled with... |
0ddec1087d44674aab11fc75c04ee8ed01470f50fd6f8518907096afe74f7818 | Python | 19,695 | 558 | import contextlib
import warnings
from typing import Any, NoReturn
import gymnasium as gym
import numpy as np
from neurogym.utils.ngym_random import trunc_exp
METADATA_DEF_KEYS = ["description", "paper_name", "paper_link", "timing", "tags"]
OBNOW = "ob_unknown_yet" # TODO: temporary hack to create constant placeho... |
35f829de4109431c93d341982033b7001b6ec6962dd28c470ea98458fd8ca726 | Python | 19,698 | 759 | import os
import glob
import time
import spacy
import numpy as np
import pandas as pd
import benepar
from tqdm import tqdm
from irnlm.utils import format_time, read_yaml
# Some formatting/abbreviation in LPP are not weel taken by the word list/freq dictionary and need to be corrected
correct = {
"ve": "have",
... |
dd348e0ed305c72c6964984a93a767600ab76214a525662216c0a85a9c89533d | Python | 19,706 | 504 | import numpy as np
import pytest
from absl.testing import parameterized
import keras
from keras.src import backend
from keras.src import ops
from keras.src import testing
from keras.src.backend.common import dtypes
from keras.src.backend.common import standardize_dtype
from keras.src.random import random
from keras.sr... |
499abb2f65775ec9da32584a8e9591756dd4685b45cb9ef95046ebb8541c647b | Python | 19,712 | 456 |
from PyQt5 import QtCore
from PyQt5 import QtWidgets
from PyQt5 import QtGui
import os
import sys
import traceback
import io
import pkg_resources
import tempfile
from score_behavior import GIT_VERSION
# noinspection PyUnresolvedReferences
from score_behavior.score_controller import VideoDeviceManager, CameraDeviceM... |
c3c75fee6b432506555926816033e48939ff598c34439d30b18b8ebcd70bc01a | Python | 19,712 | 571 | import argparse
import json
import subprocess
from pathlib import Path
from typing import Dict, List, Optional, Tuple
import cv2
import matplotlib.colors as mcolors
import numpy as np
from pycocotools import mask as mask_utils
def parse_arguments() -> argparse.Namespace:
parser = argparse.ArgumentParser(
... |
40cb4c9fb3b23cb8c91b58bae7dd341d174ff4626f55c67b8c0c4af361d8ee2d | Python | 19,714 | 313 | """
Functions for creating VCF file.
Copyright (C) 2021 Tham Cheng Yong
This file is part of NanoVar.
NanoVar 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)... |
0b6a3599c1f8ee000f011b717e6afe0b1d3bb860eee1b459b951c1cd07ad1942 | Python | 19,717 | 486 | # 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... |
e21d34a8a6e7814e40cb57b002595aac4d6bab304cf22d433e170ab8e49a5555 | Python | 19,730 | 376 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
b2158ddbccced2d890394172ce9cfad714efcff50b59ce6f5252dacef02470d3 | Python | 19,737 | 639 | def assign_microrna(file_ls, out_dir, cmf_dir, tf_ensm_dic, container_ls, mir_host):
import pandas as pd
for file in file_ls:
work_file = open('{}/{}'.format(cmf_dir, file))
map_file = open('{}/{}-w_mir.txt'.format(out_dir, file), 'w')
map_file.write(
'chr\tchip_i... |
fada12cbfa1edf2e4cdebf4a4782ad8e8040632e6ec0fe453aee3eba51a82b70 | Python | 19,737 | 650 | """Non-persistent analysis recipes for short Explore simulation previews."""
from __future__ import annotations
from dataclasses import dataclass, field
from io import BytesIO
from typing import Any, Mapping, Sequence
import numpy as np
__all__ = [
"PreviewAnalysisResult",
"PreviewFigure",
"PreviewMetri... |
bdbd6f325786006a458470f3e7bc277d19f6246d3cf8865f9e7fb38718afc786 | Python | 19,745 | 529 | """Geometry-focused tests: way/relation geometry creation, polygon-vs-line
typing, and polygon/multipolygon ring orientation (cross-checked against
osmium). Consolidated here so geometry-correctness tests live in one place."""
import pytest
from pyrosm import get_data
@pytest.fixture
def test_pbf():
return get_d... |
7d47de05b275567501444df9c7670c30a0ba359399c2960f358eac3b4a8dab3a | Python | 19,753 | 577 | #!/usr/bin/env python3
import argparse as ap
import os
import subprocess
import sys
import gplib
"""
TOOL DEPENDENCIES
=================
GraphProt 1.1.7
Best install via:
https://anaconda.org/bioconda/graphprot
Tested with: miniconda3, conda 4.7.12
OUTPUT FILES
============
data_id.model
data_id.params
... |
ba1802bea9cf839aceb668eeed79b12a83a091726b7f5c802cddecc2c87ab087 | Python | 19,756 | 571 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Workflows for extracting time series and computing functional connectivity."""
from nipype import logging
from nipype.interfaces import utility as niu
from nipype.pipeline import engine as pe
from niwor... |
dc174d00eb02ef26c2b5482f25e9893cd6a8007a87f7b26d37904fd371c51aa9 | Python | 19,758 | 443 | # Copyright 2017 The TensorFlow 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 applica... |
196b9898cea0a0bde0cff7ec4518266167e749354099fcd3e0aba041143c7440 | Python | 19,762 | 483 | #!/usr/bin/env python3
# Synthetic data study where we fix the maximal conductance parameter to the
# wrong value and fit the model. Make this parameter pertubation larger and larger
# and see what thisdoes to parameter spread, predictions, etc...
import multiprocessing
import regex as re
import logging
import matplo... |
bddd37c8a6e52fc161532a16559153e7dbbfe19268f8b279bf6d6e187015329f | Python | 19,762 | 500 | import torch as t
import torch.nn as nn
# Cell
def _divide_no_nan(a: float, b: float) -> float:
"""
Auxiliary funtion to handle divide by 0
"""
div = a / b
div[div != div] = 0.0
div[div == float('inf')] = 0.0
return div
# Cell
def MAELoss(y: t.Tensor, y_hat: t.Tensor, mask: t.Tensor =None)... |
7953d2990d81f88de2275ec064547575ca16e36eeb905cf4137c2d9a9f9989f5 | Python | 19,765 | 547 | import math
import random
import anndata as ad
import numba
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
from scipy.sparse import issparse
from sklearn.cluster import KMeans
from sklearn.decomposition import PCA
from ...logging import logger_manager as lm
def calculate_adj_matrix(x, y, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.