sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
f9f86d8dc54d4defb447c30afd087cb3658625300c38f750973d3b29ca19be18 | Python | 29,154 | 829 | # pylint: disable=missing-docstring,arguments-differ,line-too-long
"""Extended image transformations to video transformations.
Code adapted from:
https://github.com/bryanyzhu/two-stream-pytorch
https://github.com/facebookresearch/SlowFast
"""
from __future__ import division
import random
import math
import numbers
impo... |
3d44709484f6c7f41e9bf0a0913debf7f0cf38e8352c339f001e2b165cab9e3f | Python | 29,169 | 591 | """Faster RCNN Model."""
# pylint: disable=not-callable
from __future__ import absolute_import
import os
import mxnet as mx
from mxnet import autograd
from mxnet.gluon import nn
from mxnet.gluon.contrib.nn import SyncBatchNorm
from .rcnn_target import RCNNTargetSampler, RCNNTargetGenerator
from ..rcnn import custom_... |
82e889cc91e3ad2664265ba71b194ecca563c49fb845f0445ae9ab8223308f8e | Python | 29,193 | 648 | """
The GROVER models for pretraining, finetuning and fingerprint generating.
"""
from argparse import Namespace
from typing import List, Dict, Callable
import numpy as np
import math
import torch
from torch import nn as nn
from operator import itemgetter
import time
from BatmanNet.data.molgraph import get_atom_fdim, ... |
0ef892eda57b6763b7a4f28273a15b2b8b878e531f20daaae96f18996fda906f | Python | 29,197 | 768 | """
Unit tests for batch_run.py module.
This module tests the batch run functionality including:
- OptimizationOps class
- BatchRun class
- space_search_sample function
Tests use mocks to isolate units and avoid heavy dependencies.
"""
import pytest
from unittest.mock import Mock, patch, MagicMock
import numpy as np... |
5beda8c57ac506fce5c47b844d292eecbbb240f53ef25a983390ae38814e54d1 | Python | 29,211 | 816 | from __future__ import annotations
import pytest
from pybind11_tests import ConstructorStats
np = pytest.importorskip("numpy")
m = pytest.importorskip("pybind11_tests.eigen_matrix")
ref = np.array(
[
[0.0, 3, 0, 0, 0, 11],
[22, 0, 0, 0, 17, 11],
[7, 5, 0, 1, 0, 11],
[0, 0, 0, 0,... |
ef803f573be559bf973be17fcfd2180c02d3bd20869da388f96b45e5f18d42e5 | Python | 29,228 | 764 | """Module-held plain tensors read in ``forward`` are captured as buffer sources.
timm's EfficientViT (MSRA) keeps an eval-mode attention-bias cache: a plain tensor
in a dict attribute (``attention_bias_cache["cpu"]``), filled by the first forward
and indexed by ``getitem`` on every later one. On a warmed model the cac... |
811a23927aab993fcc70e57ac189fdff5b373b27ddf3dd4301990e75f7b52f6d | Python | 29,242 | 629 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import os
from pathlib import Path
from typing import Any
import numpy as np
import torch
import torch.distributed as dist
from ultralytics.data import build_dataloader, build_yolo_dataset, converter
from ultralyt... |
1f8526a7fa75b41c56144ea279584f3b3d669dfefa11ba939c136d9e9c715af6 | Python | 29,246 | 792 | # 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... |
fae9dbe42cffefa813201e766e627229d90d15d6b6940576bb942a6f925b7d2d | Python | 29,247 | 641 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 30 11:47:15 2020
@author: Audrey Mazancieux
This script performes group-level "event-related" analyses. Prior steps are:
- extraction of time series from the LC in native space using the
extract_timeSerie_singleSubj script
- extracti... |
a6fd39237eedfb2986aa515e6f98a82cb5a388d49414d7a288dab56e44f47b13 | Python | 29,257 | 6 |
"""
This is fileids comes from online query and download the python script then
"""
file_ids = [32770,34785,35269,36069,36082,36086,36090,36372,36373,37093,37266,37272,37274,37275,37276,37278,37280,37282,37283,37284,37285,37287,37288,37289,37322,37323,37384,37506,37620,37622,37627,37743,37744,37745,37750,37841,37865... |
c82e82489013ed7fc0c2e960c730a6c6e9f79f06a4b5a03bd129593e1163f7b1 | Python | 29,261 | 1,018 | color_palette = [
'#FFFFFF', # White 0
'#000000', # Black
'#FF0000', # Red 1
'#000080', # Navy Blue 11
'#008000', # Dark Green 3
'#FFA500', # Orange 5
'#8A2BE2', # BlueViolet 6
'#808000', # Olive 7
'#00FFFF', # Cyan 8
'#FF00FF', # Magenta 9
'#0000FF', # Blue 4
'#00FF00', # Green 1... |
98a439b546fb4e3e62801ab20b96ee65fd7c9234b5df9f0b5e305675a48ae6d1 | Python | 29,266 | 802 | # Copyright (c) 2021 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... |
a1f5e7837c0b271725c2dcb651a4bc5cc13248201a8f72638bb4ab3eca2da796 | Python | 29,291 | 774 | #!/usr/bin/env python
"""
"""
import argparse
import numpy as np
from scipy import stats
def columns_to_values(args, line):
# here you go over every list
samples = []
for i in args:
cols = line.split("\t")
sample_list = []
for row in i:
sample_list.append(cols[row - ... |
229de45a0b964e402ba41db82c3cf3c71d22b6c447cb7aeab80f6d96b6806668 | Python | 29,294 | 746 | import pkg_resources
import logging
import numpy as np
import matplotlib
from matplotlib.colors import Normalize
from mpl_toolkits.mplot3d.axes3d import Axes3D
import warnings
import time
from PyQt6 import QtWidgets, uic, QtCore
from PyQt6.QtCore import QObject, QTimer, QThread, pyqtSignal, QCoreApplication
import mu... |
21e06e26c1b27835a24085ae67d404da5538c2119f93afefc4623860336b7b32 | Python | 29,314 | 711 | """Phase 7 public captured-run type regression tests."""
from __future__ import annotations
import time
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.validation.invariants import (
_check_special_layer_lists,
_check_trace_self_consistency,
check_metadata_invariant... |
5e4a9bbac0807ce251f83a6304ea8af8d3346973c5376f8da5db62b385603c39 | Python | 29,315 | 709 | """
gen_analys.py
This script runs ROI and running trace analyses using a Session object with
data generated by the Allen Institute OpenScope experiments for the Credit
Assignment Project.
Authors: Colleen Gillon
Date: October, 2018
Note: this code uses python 3.7.
"""
import copy
import logging
import numpy a... |
395fab123d9bfd88e5620a00f785274e2a45e8320b79ef7d49d6b3fed95e6467 | Python | 29,352 | 718 | from keras.src import activations
from keras.src import backend
from keras.src import constraints
from keras.src import initializers
from keras.src import ops
from keras.src import regularizers
from keras.src import tree
from keras.src.api_export import keras_export
from keras.src.layers.input_spec import InputSpec
fro... |
3284a373b7f0b0e63c29768c0d4a068f86e93ef64bb075d06afae025d105e451 | Python | 29,358 | 717 | import os, sys
import numpy as np
import pandas as pd
import networkx as nx
import itertools as it
import subprocess
from scipy.stats import mannwhitneyu
from sklearn.svm import SVC
from sklearn.metrics import accuracy_score
from sklearn.ensemble import RandomForestClassifier
from sklearn.feature_selection import Sel... |
178975281f23df5659f2653f12bbe762e2631d8bc51920a04e148b7e6ad9ec16 | Python | 29,374 | 642 | """Coverage gate for decorated torch argument extraction specs."""
from __future__ import annotations
import pytest
import torch
from torchlens.capture.arg_positions import (
FUNC_ARG_SPECS,
ArgSpec,
_cache_dynamic_spec,
_normalize_func_name,
extract_tensors_and_params,
)
from torchlens.constants... |
a31414e1599a750b2a51c5d414414c7b659d0315ae469755ef8f994e5ef04485 | Python | 29,378 | 704 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Line(_BaseTraceHierarchyType):
_parent_path_str = "parcats"
_path_str = "... |
9197e708ba06ab2bb6db8b28d664e96e48081973bf0e967bc92409d2bb304493 | Python | 29,379 | 684 | """
This module mainly defines the Fiber Class.
Most of the function are tied to the class in order to take advantage of attributes to set default values.
However, important functions such as the ``fiber.normalize_signal`` and ``fiber.detect_peaks`` are defined outside
the class as they can be useful on their own."""
... |
0a214bb5343d31a73156afabbdc5172387b792160388d519840d5228b156a06e | Python | 29,392 | 821 | import fcntl
import json
import logging
import socket
import struct
import time
import urllib.error
import urllib.request
from dataclasses import dataclass
from functools import wraps
from threading import RLock, Thread
from typing import Any
import netifaces
from zeroconf import IPVersion, ServiceBrowser, Zeroconf
#... |
fa06ad00547d4a1d19666b660081ea0a70a36d8b217b9a18ae9746ee3e9dbcb3 | Python | 29,417 | 784 | """
Tests for pcmci.py, including tests for run_pc_stable, run_mci, and run_pcmci.
"""
from __future__ import print_function
from collections import Counter, defaultdict
import itertools
import numpy as np
# from nose.tools import assert_equal
from numpy.testing import assert_equal
import pytest
from tigramite.pcmci i... |
8072ceda7a72df403cc5f4dc0a54efeb232b3a05146b3c58ca896ad5593ea4d8 | Python | 29,458 | 548 | # 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 a... |
8e02dd3862f143e0e36f0068c4c22ad58eac0a06229c958477f91f7da895af0d | Python | 29,500 | 677 | # coding: utf-8
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License... |
a94c19de5265498d0dbaff1bd817fb267ca7827319fec6a3f7bffd0dcd413048 | Python | 29,515 | 750 | """FCOS object detector"""
# pylint: disable=all
import logging
import math
from typing import List, Dict
import torch
from torch import nn
from torch.nn import functional as F
from ...nn.shape_spec import ShapeSpec
from ...nn.deform_conv import DeformConvWithChangeableStride
from ...nn.group_norm import NaiveGroupNor... |
a42452bac5f643c5ef2c209871820d6b994bf298b0c2d65b9f37fda00ae26ef4 | Python | 29,535 | 749 | import math
import os
import numpy as np
import pytest
from absl.testing import parameterized
from keras.src import backend
from keras.src import layers
from keras.src import models
from keras.src import ops
from keras.src import saving
from keras.src import testing
from keras.src.backend.common import get_keras_mask... |
b3e247d8b373772aa31df845ff98384e907a64073b974d210fc2090b43d57ccc | Python | 29,550 | 766 | import numpy as np
from pyrosm.config import Conf
from pyrosm.pbfreader import parse_osm_data
from pyrosm._arrays import concatenate_dicts_of_arrays
from pyrosm.geometry import create_node_coordinates_lookup
from pyrosm.frames import create_nodes_gdf
from pyrosm.utils import validate_custom_filter, validate_osm_keys, \... |
03d956d846de523d6a1b804656044728600026c2ba46559dabd9ca768313e444 | Python | 29,554 | 902 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""Meters."""
import datetime
import os
from collections import defaultdict, deque
import numpy as np
import slowfast.datasets.ava_helper as ava_helper
import slowfast.utils.logging as logging
import slowfast.utils.metrics... |
07900411a35525754415bd5730911a76140f2a535642b1c0eb8f443aee7d4191 | Python | 29,556 | 763 | """ Wrapper function for performing CCI analysis, varrying the analysis based on
the inputted data / state of the anndata object.
"""
import os
import numba
from numba import types
from numba.typed import List
import numpy as np
import pandas as pd
from typing import Union
from anndata import AnnData
from tqdm imp... |
15f2b7e41cc618eae798c4dbc0fdf7ab1d78ec449069a0304a43f729d39fd463 | Python | 29,568 | 654 | import torch
from torch.nn.modules import utils
from torch import Tensor
from utils._overrides import has_torch_function, handle_torch_function
from torch.nn.functional import *
"""
from torch._C import _infer_size, _add_docstr
#from torch import _reduction as _Reduction
from torch.nn.modules import utils
from torch.... |
1fa4f184ac1bb60011156ac056a567115d9b28407992f78b6ad3c68df998c7c0 | Python | 29,598 | 783 | """Wrapper function for performing CCI analysis, varrying the analysis based on
the inputted data / state of the anndata object.
"""
import os
from importlib.resources import files
import numba
import numpy as np
import numpy.typing as npt
import pandas as pd
from anndata import AnnData
from statsmodels.stats.multite... |
4dd5a0672e4db30327cc31f6336da04f9fccaa40548c6dca7e1481bfb4a807bd | Python | 29,637 | 671 | """
Tool recommendation agent for suggesting appropriate Galaxy tools.
Despite the historical name, this agent recommends both atomic Galaxy tools
and end-to-end IWC workflows. Atomic asks ("which tool sorts a BAM?") still
get a tool back; analysis-shaped asks ("RNA-seq from FASTQ to differential
expression") get a wo... |
d403d59aa64bbe422a29a257bc4a67c0cef0377cfb96ea480691b255520ca598 | Python | 29,641 | 535 | # ------------------------------------------------------------------------------
# Based on:
# apex
# Copyright (c) NVIDIA
# Licence under The BSD 3-Clause "New" or "Revised" License
# https://github.com/NVIDIA/apex
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modificati... |
0f3fdd49993898a43cdb9889a0d1fe1cdf6ed452db61edc18aec14a285249a8e | Python | 29,654 | 793 | """
Unit tests for io/base.py.
Tests BaseResultWriter, BaseAsyncSQLWriter, dbAppender,
and resilience features (retry, buffer, restart).
"""
import os
import sqlite3
import tempfile
import time
import unittest
from collections import deque
from multiprocessing import Queue
from unittest.mock import MagicMock, Mock, P... |
c4c23aa2cd3a1672f510d68b79050b86f218d5ded661eb30a2ea6b689857ee47 | Python | 29,654 | 857 | # SPDX-License-Identifier: LGPL-2.1-or-later
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import os
import time
import sys
from collections import OrderedDict
import numpy as np
# NamedDict class was originally written by Zbyszek Jędrzejewski-Szmek
# and Avrama Blackwell for moose_nerp https://github.com/neurord/moos... |
85d99c6a1996d66afecf7c849fec99ee871a37fe024f407822cbb6fda6a91d8f | Python | 29,657 | 637 | """
mmcif writer for online inference.
"""
import collections
import copy
import os
import itertools
import shutil
import numpy as np
import pandas as pd
from helixfold.common import residue_constants
from infer_scripts.rdkit_utils import RdkitConstants
required_keys_for_saving = [
'all_ccd_ids', 'all_atom_ids... |
4e761efb6f61f9ceffd5692826912ea43e7c4dc28e1cb008de71dc54973521bc | Python | 29,667 | 862 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Imaginaryaxis(_BaseLayoutHierarchyType):
_parent_path_str = "layout.smith"
... |
8dd90c049100ac98364b25466f323c00e2b3d1e1d4eaa309a10f1d5df4580443 | Python | 29,683 | 783 | #!/usr/bin/env python
import datetime
import smtplib
import time
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.utils import formatdate
from typing import Any
from .base import NotificationAnalyzer
class EmailNotifica... |
47ecfa9538a0fe96632f22e6a488af515b5c85f4d1c94b8694964d86c633c220 | Python | 29,684 | 770 | """
Manager and Serializer for HDAs.
HistoryDatasetAssociations (HDAs) are datasets contained or created in a
history.
"""
import gettext
import logging
import os
from typing import (
Any,
TYPE_CHECKING,
)
from urllib.parse import quote_plus
from sqlalchemy import (
and_,
asc,
desc,
exists,
... |
663e0ed64f88688deb627117a13ca5c34e829612c1014b949e336c264be4f95e | Python | 29,693 | 667 | import argparse
import functools
import multiprocessing
import os
import textwrap
from hashlib import sha256
from multiprocessing import Manager, Pool
import pandas as pd
import plotly.express as px
import streamlit as st
from datasets import get_dataset_infos
from datasets.info import DatasetInfosDict
from pygments i... |
cbf1265dfdbc3cb58ae3c3fb51b7847fcc174d7553162d4c0e8f97742c495566 | Python | 29,696 | 609 | #!/usr/bin/env python3
"""
File: simulate_expression.py
Created: 2023/06/07
Last Changed: 2023/07/13
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 sour... |
cdc34393f7893d0d009a96bc32dc117b130ef78d359da9d52e44bfec89b3b905 | Python | 29,719 | 861 | import gc
import logging
import os
import socket
import sys
import threading
import time
from collections import deque
from unittest.mock import Mock, patch
import pytest
from vine import promise
from celery import chain, group, states
from celery.backends.asynchronous import E_CELERY_RESTART_REQUIRED, BaseResultCons... |
ebb47974dedd33d570880b6d09e52e46e0f597aa22f6c3f20c16a27dac4593e5 | Python | 29,719 | 947 | """Custom maps, sets, sequences, and other data structures."""
import time
from collections import OrderedDict as _OrderedDict
from collections import deque
from collections.abc import Callable, Mapping, MutableMapping, MutableSet, Sequence
from heapq import heapify, heappop, heappush
from itertools import chain, count... |
11eb3f4fff02f67a0ba017225441057e5cd5a078ba3f927eda9347543027ef38 | Python | 29,723 | 608 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
"""
Run prediction on images, videos, directories, globs, YouTube, webcam, streams, etc.
Usage - sources:
$ yolo predict model=yolo26n.pt source=0 # webcam
img.jpg ... |
90262124fbcaa76d02b28627aa5c297c8017e72a9f7fd94f20720cfe539c7158 | Python | 29,761 | 790 | """Worker Remote Control Client.
Client for worker remote control commands.
Server implementation is in :mod:`celery.worker.control`.
There are two types of remote control commands:
* Inspect commands: Does not have side effects, will usually just return some value
found in the worker, like the list of currently re... |
cf68d9b2f2297fd222c7b391c25c6f304b209c921cc056400b06cf740efc35c8 | Python | 29,802 | 817 | __credits__ = ["Andrea PIERRÉ"]
import math
import warnings
from typing import TYPE_CHECKING, Optional
import numpy as np
import gym
from gym import error, spaces
from gym.error import DependencyNotInstalled
from gym.utils import EzPickle, colorize
from gym.utils.step_api_compatibility import step_api_compatibility
... |
825e016afa53dc6f3a8ea645d97e1885f8db5b5295eda49c22a32b1d70d1cf81 | Python | 29,811 | 545 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
export_docx.py — 由 manuscript_en.md 生成投稿用 .docx
================================================================================
为什么是脚本而不是手工排版:
手稿仍会变(共同作者、CRediT、AI 措辞、Zenodo DOI 回填),手工排出来的
.docx 会在下一次改动后立刻过期,且无法复现。本仓的纪律是"每个产物都能从
脚本重出",所以 .docx 也走脚本。
依赖:
本机 edi... |
22d23e38f76ae02715336afe3e8dfc9074bca71f8e9044fca7aaa3cf173044ab | Python | 29,826 | 609 | import h5py
import numpy as np
from matplotlib import pyplot as plt
import scipy.ndimage
import os
import pandas as pd
import imageio
from skimage import io
from skimage.segmentation import clear_border
from skimage.measure import label, regionprops
from skimage import morphology
from skimage.filters import threshold_o... |
e79a2f498032c2a5778f606a27423391d2d3a8872096d32a35adbae1159307b6 | Python | 29,870 | 742 | # Author: Proloy Das <proloy@umd.edu>
"""2d projections of an ROI/mask image visualization via nilearn.plotting.glassbrain
Contains code from nilearn governed by the following license (3-Clause BSD):
Copyright (c) 2007 - 2015 The nilearn developers.
All rights reserved.
Redistribution and use in source and binary f... |
8cb35ae4704e735c2d09fecf3297e4614540a25dde52befc9a514329fb16f88d | Python | 29,896 | 653 | # pylint: disable=missing-function-docstring, line-too-long, unused-argument
"""
SlowFast Networks for Video Recognition
ICCV 2019, https://arxiv.org/abs/1812.03982
Code adapted from https://github.com/r1ch88/SlowFastNetworks
"""
import torch
import torch.nn as nn
from torch.nn import BatchNorm3d
__all__ = ['SlowFast... |
e71be59316999e57ad22a2f00c3fcf2ab101bcd8e1f01462ebf77f91ede746b5 | Python | 29,931 | 591 | from abc import ABC, abstractmethod
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Flatten, Dense, InputLayer, Layer
from tensorflow.python.keras import backend as K
from tensorflow.keras import initializers
import tensorflow_probability as tfp
from tensorflow import TensorShape, Tensor
... |
9e593aa6e23af23f69d0b6dad02d21e00e10a4211e65f090caf4fe37a257de58 | Python | 29,942 | 950 | """
Unit tests for plot.base module - BasePlot, AutoBasePlot, GridPlot classes.
Tests REAL behavior based on ACTUAL code, not assumptions.
All tests validate actual API signatures, return values, and side effects.
"""
import pytest
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from larv... |
8eb66c989e8ab4beaee5a38458ec7862309e1a6feb34f762e1bd327dc399a73c | Python | 29,952 | 1,029 | """Compact renderable replacements for previously non-model menagerie rows.
These are small, random-init, pure-PyTorch cores for architecture atlas rendering.
They preserve the load-bearing computation pattern of each family while avoiding
external runtimes, pretrained weights, training loops, and heavyweight pipeline... |
ef7ec73686270352f204a86db78c4216410eb97097cae04d68cb91ce3eb28cd3 | Python | 29,957 | 837 | #!/usr/bin/env python3
import multiprocessing
import regex as re
import logging
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
from MarkovModels import common
from MarkovModels.BeattieModel import BeattieModel
from MarkovModels.WangModel import WangModel
from MarkovModels.... |
2b3c6d4ea579f57d78bdf641d210ccb4ec7a9679d7731b20a568dfdedf6098c5 | Python | 29,992 | 765 | from __future__ import annotations
from types import MethodType
from typing import Literal, cast, overload
import numpy as np
from numpy.typing import NDArray
from .._numba import (
_pack_codon_index,
gufunc_complement_bytes,
ufunc_comp_dna,
)
from .._utils import SeqType, StrSeqType, cast_seqs, check_ax... |
968df9c7f4dfe2a67219185f32cee202b0b318037dc0b67a85619ef01d86a34e | Python | 30,000 | 670 | #!/usr/bin/env python3
"""把版本化归档包投进 Zotero 库:一个条目 + 一个文件附件。
为什么是脚本
------------
手稿的 *Code availability* 必须指着一个**读者打得开的**地址。手抄一个 key 进手稿,
就又是一处「上游变了下游不知道」。所以地址由脚本产生、由脚本回读核对。
循环,以及打破它的次序
----------------------
条目 key 是服务器分配的,包又是从这个 tag 打的 —— 于是出现一个真循环:
包要含手稿、手稿要含 URL、URL 来自条目、条目要在打 tag 之前存在。Zotero 没有
Zenodo 那种 `prerese... |
3f5781d41857d8863b0fd57ffa1189a79005a7705fbbb6649de65347e684b188 | Python | 30,005 | 706 | # -*- coding: utf-8 -*-
"""
lights.py — Light-schedule experiment with optional free food and passive
song recording.
Running without any of the optional blocks in config.json
-----------------------------------------------------------
Behaviour is identical to the original Lights class: the state machine
cycles idle ... |
7f842f99ff301e6f28c3cd83d12119440923a80c9dfe6a0ed51b72e5acac3ad1 | Python | 30,020 | 751 | # -*- coding: utf-8 -*-
from contextlib import nullcontext
import itertools
import logging
import multiprocessing
import os
import sys
from tempfile import TemporaryDirectory
import traceback
from typing import Union
from tqdm import tqdm
import numpy as np
from dipy.data import get_sphere
from dipy.io.stateful_tracto... |
893438b182bf885503a6d0336d92eede271fe901bf441e91e05b1c811dd4ff6f | Python | 30,039 | 571 | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 7 20:28:33 2021
@author: MikeSha
"""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import Dataset
from torch.nn.functional import normalize
from torch.nn import KLDivLoss
from torc... |
edad40399db3d207fd794493fbdf1b8e3a3c8a4718ddcdc972b7138c1aa74225 | Python | 30,066 | 808 | #!/usr/bin/env python3
"""CLC benchmark for dense, varlen, and block-sparse FA4 sweeps.
Run with benchmark against the yaml sweep:
python benchmarks/clc_bench.py --config benchmarks/configs/clc.yaml
Useful overrides:
--workers 64 # compile parallelism
--case_filter q16_kv4 ... |
f239ee56c305be14c09c9374bafaaef4909645c294e247b6b78363e5183e4cd0 | Python | 30,068 | 786 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
neuron_3drxd_cam_rd_cylinder_export.py
Last updated: 18.9.2026
Authors: Laura Keto and Saana Seppälä
NEURON 3D RxD (CYLINDER): Ca + CaM reaction-diffusion timecourses
### Description
This script performs three-dimensional reaction-diffusion simulations of
calcium... |
e289576f7cf53a1f9bf9630b9abfc01bf458453d4cf8d4595741ae734900700c | Python | 30,098 | 773 | #!/usr/bin/env python
import sys
import csv
import shlex
import os.path
import xlsxwriter
from collections import defaultdict
PYVER = sys.version_info.major
# Utils
def CSVreader(stream):
return csv.reader(stream, delimiter='\t')
def Next(reader):
if PYVER == 2:
return reader.next()
else:
... |
1c16e32e193ec8fcd29aa96fa785c1717d37a4a83f44454d5f99ab0d085fee2b | Python | 30,104 | 607 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import sys
from collections import deque
from functools import wraps
from typing import Any
import numpy as np
import torch
from ultralytics.utils.metrics import bbox_ioa
from ..utils import LOGGER
from .basetrac... |
193bbb3296ff8fe540424b275c3c3f467a8f1dd73db71fc11501e5f7d3470a0f | Python | 30,122 | 767 | from importlib import resources
import logging
import numpy as np
import matplotlib
from matplotlib.colors import Normalize
from mpl_toolkits.mplot3d.axes3d import Axes3D
import warnings
import time
from PyQt6 import QtWidgets, uic, QtCore
from PyQt6.QtCore import QObject, QTimer, QThread, pyqtSignal, QCoreApplicatio... |
a2fa6550f5e9ceb71c3c3abd140ae63e13d153c25165aa5f4a6e75513f3dfa19 | Python | 30,147 | 782 | """
Dataproviders that use either:
- the file contents and/or metadata from a Galaxy DatasetInstance as
their source.
- or provide data in some way relevant to bioinformatic data
(e.g. parsing genomic regions from their source)
"""
import logging
import sys
from bx import (
seq as bx_seq,
... |
d73a363604dbb59f9ae9537507396156aad75add1db4a959256aeef42b69a738 | Python | 30,159 | 722 | #!/usr/bin/env python3
"""
File: afr_pic_replication.py
Created: 2022/04/14
Last Changed: 2022/07/21
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 sour... |
ffc33ddeecdac64a0bdd9cb166201fb7185390b8b17697620f1ca232b2885d71 | Python | 30,178 | 858 | # FAITHFUL PORT of https://github.com/atomistic-machine-learning/SchNOrb @ 38cb268ea431b46e3b2088dda48bcd1983462ff (original framework: PyTorch, but pinned to the pre-1.0 "legacy" SchNetPack API)
#
# SchNOrb predicts a molecule's electronic Hamiltonian and overlap matrices from
# atomic geometry, built on top of SchNet... |
99944e5ee56bb9a46c9248e02539212cd675d809b83e1e3901190017db56fef5 | Python | 30,190 | 927 | from __future__ import division
import pandas as pd
import numpy as np
import time
from datetime import datetime
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.ticker import MaxNLocator
import scipy.stats as sstat
import scipy.signal as ssig
#import h5py
from mpl_toolkits.mplot3d import Axes3D... |
64c0326591b53b3b67ade943c69b794699cc13eacd355f3e144839a39eb94ab4 | Python | 30,199 | 584 | import logging
from abc import ABC
from typing import List
import matplotlib.pyplot as plt
import pytorch_lightning as pl
import seaborn as sn
import torch
import torchmetrics
import torchvision
from losses import get_loss
from models.basic import DeepLearningModel
from utils.metrics import Dice, DiceSampleWise, Haus... |
89a0db163cd8425aa7f9aa47162b08ece1e84a5d4de5c4dfa02a518f7f5270e8 | Python | 30,209 | 825 | import warnings
import numpy as np
import pandas as pd
import copy
from typing import Any, Self, Generator
from pathlib import Path
from mirp._images.generic_image import GenericImage
from mirp._images.mask_image import MaskImage
from mirp.settings.generic import SettingsClass
class BaseMask:
def __init__(
... |
ce65dfd5d98225e8c66fe054698e2c455ea5ba46d6be2f3cc7700b4fa7412ad8 | Python | 30,221 | 897 | # a/b will always return float
import numpy as np
from scipy import ndimage
from scipy.interpolate import splev, splprep
from matplotlib import pyplot as plt
from matplotlib import widgets as mw
import matplotlib as mpl
from .. import core
from .. import track
from ..core import coords
from ..core import ifnot, re... |
ab87811f0001e9ff39835aec7e32cf645bb3b5bf9629ee52a9fe0e8493269a1d | Python | 30,227 | 860 | """Decision-matrix coverage for forward-pre-hook input provenance."""
from __future__ import annotations
import pickle
from collections.abc import Callable
from pathlib import Path
from typing import Any
import pytest
import torch
import torch.nn.modules.module as torch_module
from torch import nn
import torchlens ... |
b4ff8c9c18395e975f579cd1e3ac32898052d201b7e283094d5accce9924ae85 | Python | 30,267 | 576 | # -*- coding: utf-8 -*-
"""
Code for computing surface Dice
copy from http://medicaldecathlon.com/files/Surface_distance_based_measures.ipynb
"""
import numpy as np
import scipy.ndimage
# neighbour_code_to_normals is a lookup table.
# For every binary neighbour code
# (2x2x2 neighbourhood = 8 neighbours ... |
fb4119988a3da1bb2a6156e118f59a8a23bfffe7299a5b4fa2ac3f214bf6a67b | Python | 30,310 | 714 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Pramod Bharadwaj Chandrashekar
@email: pchandrashe3@wisc.edu
"""
import argparse
import pandas as pd
import os
import time
import random
from collections import Counter
import torch
from torch import nn
from torch.utils.data import TensorDataset, DataLoader
i... |
fcdacaed112ec0b6f75c7883185cde5a9dc581f5c6d1b3817b3dbc0c88a478f1 | Python | 30,313 | 840 | from pyrosm.graph_export import (
_create_igraph,
_create_nxgraph,
_create_pdgraph,
_create_pandarm_graph,
directed_rows,
generate_directed_edges,
)
from pyrosm.graph_connectivity import get_connected_edges, largest_component
from pyrosm.graph_simplify import (
EDGE_ATTRS_DIFFER,
_TableE... |
e6596aa5e84283eb713c4aa2f964b1d2a509abd4b078459edea1e4da8bfe9856 | Python | 30,388 | 646 | from __future__ import print_function, division, absolute_import
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
from torch.autograd import Variable
pretrained_settings = {
'nasnetalarge': {
'imagenet': {
'url': 'http://data.lip6.fr/c... |
7f39bfbb03c608629fa26dbf7e437a5810e76899cd8059b32fbf3738b3d16e02 | Python | 30,391 | 830 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import tensorflow as tf
import pandas as pd
import argparse
import os
import time
import sys
import pdb
import csv
import re
import copy
import pickle
... |
602b309cce8f56d94345227d111e41b9fb4745fc74fa4991ec738adb21385b9a | Python | 30,399 | 801 | #! /usr/bin/python
'''pysam --- a Python package for reading, manipulating, and writing
genomic data sets.
pysam is a lightweight wrapper of the HTSlib API and provides facilities
to read and write SAM/BAM/CRAM/VCF/BCF/BED/GFF/GTF/FASTA/FASTQ files
as well as access to the command-line functionality of samtools and b... |
54863b3b9b862d8850c2ca0bc9882f73b913e557b2fdce2f465e642d9a2e8571 | Python | 30,426 | 582 | #!/usr/bin/env python
from __future__ import division
from os import sys, path
from itertools import izip
import bamliquidator_batch as blb
import normalize_plot_and_summarize as nps
import os
import shutil
import subprocess
import tables
import tempfile
import unittest
# one full read for each chromosome
def crea... |
f387bae3dfdee039325bc040f9cb9bbaf8be2bec95077a438d3762b26c84b4eb | Python | 30,428 | 692 | #!/usr/bin/env python3
"""
File: visualise_PICALO_double_interaction_eqtl.py
Created: 2022/07/22
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 d... |
20e1090bc571f243060ba2ba68ae406bb5886f80454e77d072a33e06689dd4bf | Python | 30,439 | 782 | #!/usr/bin/env python
import sys
import csv
import shlex
import os.path
import xlsxwriter
from collections import defaultdict
PYVER = sys.version_info.major
# Utils
def CSVreader(stream):
return csv.reader(stream, delimiter='\t')
def Next(reader):
if PYVER == 2:
return reader.next()
else:
... |
1ce9847ec8adc788c0f1c0bf72bbf982fd26b54edd745e9e9a36a360ffc12d5e | Python | 30,440 | 751 | import multiprocessing as mp
from concurrent.futures import FIRST_EXCEPTION, ProcessPoolExecutor, as_completed, wait
from multiprocessing import Lock, Pool
mp.set_start_method("spawn", True) # ! must be at top for VScode debugging
import argparse
import glob
import json
import logging
import math
import os
import pa... |
42bed53047d765f93e151b33d5043c6838c1f05d12d5b9cbeed21bcd2f219af5 | Python | 30,456 | 813 | """F2 tripwire tightening: legacy index/mask/``*_like`` exemption blankets.
The pre-sprint blankets (``STRUCTURAL_ARG_POSITIONS`` entries for
``embedding``/``gather``/``index_select``/``scatter*``/``cross_entropy``
index-class args, the ``masked_fill`` mask entries, and the posthoc
``*_like`` structural-template excus... |
8ce1e5b811b6d3ee9e6c81507bcb66a92c8fea26df40f5203ba6e9d1a34a5d79 | Python | 30,480 | 798 | """Injected-op persistence codec (``log_injections`` stage 2, lane F44).
Persistence rides the C07-declared tlspec v9 entry-dark slot
``Op.injection_provenance`` -- NO schema bump: each recorded
:class:`~torchlens.intervention.injection.InjectedOp` is written into the
artifact as one synthesized op ROW carrying the sl... |
faa2e8574b383d20529e5f5e1973876b54b24bcad3bf90f75680931ba20531c9 | Python | 30,534 | 794 | # SPDX-License-Identifier: LGPL-2.1-or-later
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import os
import glob
import sys
from pyEcoHAB import data_path
if sys.version_info < (3, 0):
from ConfigParser import RawConfigParser, DuplicateSectionError
else:
from configparser import RawConfigParser, DuplicateSecti... |
22728c3c20a0334b38d7422d038db00f4ea0c4f23853ca768c8fad004c0343eb | Python | 30,537 | 751 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
232d404073cd7f29b07a39d8988a4cd5dfe3c702aad0dbe84272bf06092b227e | Python | 30,552 | 807 | #!/usr/bin/env python
"""
Provides wrappers and utilities for working with MAF files and alignments.
"""
# Dan Blankenberg
import functools
import logging
import os
import resource
import sys
import tempfile
from copy import deepcopy
from errno import EMFILE
import bx.align.maf
import bx.interval_index_file
import b... |
673952e4de28b61c7c80b08daa8f34feef15f55687f4545714261207e825abbe | Python | 30,574 | 862 | # Copyright 2023 Blue Brain Project, EPFL.
# See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: Apache-2.0
"""Define basic classes used from parser
Node is used to represent a node parsed from every rule
in language definition file. Each member variable of Node
is represented by ChildNode.
"""
... |
574a7062f60b29e779556c7292ae338b8a7666cea3fc132ea8dbdbc8e2495dcf | Python | 30,593 | 805 | from __future__ import absolute_import, division
from tqdm.auto import tqdm
import torch
from torch.autograd import Variable, grad
from torch.nn import Parameter
import torch.nn.functional as F
import numpy as np
import pandas as pd
import sys
import random
import os
import math
def reset(nn):
def _reset(item):
... |
2954d9c08326b9dfd3217495ac92286048d89530decedd8ac34c58ba14b9b034 | Python | 30,620 | 863 | from __future__ import annotations
import sys
from pathlib import Path
import pytest
from PySide6 import QtCore
from PySide6 import QtGui
from PySide6 import QtWidgets
from PySide6.QtCore import Qt
from pytestqt.qtbot import QtBot
from labelme._app import MainWindow
from labelme._config import _writer
from labelme._... |
e327ab87c91c10c3457c8aee705d81253b95b1e5e202c82eb717d2a3f625f16c | Python | 30,620 | 843 | """
Larvaworld parameter class and associated methods
"""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
import random
import typing
import numpy as np
import param
from .. import reg, util
from ..param.custom import List, StringRobust, Unit, resolve_param_class
from ..param.nest... |
d6578d2b5f06d227482e4110f8b750d04c8d94c9525c8857f9183f727ee2858b | Python | 30,633 | 800 | from __future__ import annotations
import importlib.util
import os
import pathlib
import sys
import typing as t
from collections import defaultdict
from functools import update_wrapper
from jinja2 import BaseLoader
from jinja2 import FileSystemLoader
from werkzeug.exceptions import default_exceptions
from werkzeug.ex... |
35d7ea14686925039f675f576508691c49e47d6f4a1c53f109803abda627087f | Python | 30,635 | 638 | import inspect
from textwrap import TextWrapper
try:
getfullargspec = inspect.getfullargspec
except AttributeError: # python 2
getfullargspec = inspect.getargspec
colref_type = "str or int or Series or array-like"
colref_desc = "Either a name of a column in `data_frame`, or a pandas Series or array_like obj... |
cef58e43b37804052dbd879364f08124d96cc7459038bbee1792132278cc1901 | Python | 30,637 | 523 | # -*- coding: utf-8 -*-
"""
Created on Wed May 13 08:41:56 2020
@author: Caterina Brighi
"""
#%% Import functions
import matplotlib.pyplot as plt
import matplotlib as mpl
import SimpleITK as sitk
import numpy as np
import pandas as pd
import datetime
import os
import glob
import gzip
import shutil... |
2b9a2e02418ef7a95ee73867824fe14a8edecac0febcc45832a9a45a711a2057 | Python | 30,639 | 958 | from __future__ import absolute_import
import contextlib
import errno
import io
import locale
# we have a submodule named 'logging' which would shadow this if we used the
# regular name:
import logging as std_logging
import os
import posixpath
import re
import shutil
import stat
import subprocess
import sys
import tar... |
c0ad32ab9ea6ac51003e1a2fee017fda463b9e22e42f48ca253d39bdba9a1144 | Python | 30,640 | 797 | """TorchLens - extract outs and metadata from PyTorch models.
Importing torchlens has **no side effects** on the torch namespace -- and no
torch import at all until first use (agent memo 3.11: tier-0 CLI verbs and
manifest preflights stay torch-free). Torch functions are wrapped lazily on
the first call to ``trace()``... |
977fd28d8830fcebc582f80e7bc9ca3d79f76a38bdbeae8a1a63c08e603d4d2e | Python | 30,690 | 975 | """PATH E per-module-output gradient oracle tests."""
from __future__ import annotations
import dataclasses
import subprocess
from collections.abc import Callable
from pathlib import Path
from types import SimpleNamespace
from typing import Any
from unittest.mock import patch
import pytest
import torch
from torch im... |
f4854fbe47ff8656ecc425a0102500d37dbddea1f15f35831424c039da9b015a | Python | 30,694 | 740 | # Copyright (c) 2023, Tri Dao.
# Adapted from https://github.com/NVIDIA/Megatron-LM/blob/0bb597b42c53355a567aba2a1357cc34b9d99ddd/megatron/text_generation/forward_step.py#L31
import gc
import time
from collections import namedtuple
from dataclasses import dataclass, field
from functools import partial
from typing impor... |
024a96a7b58edaba59b5dfa3028a15a293d42eb0e32ea790462aaa30fa411142 | Python | 30,708 | 950 | """Tests for the semantic facets registry and view surface."""
from __future__ import annotations
from collections import namedtuple
from dataclasses import dataclass, replace
from typing import Any
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.intervention.errors import Site... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.