sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
6ccbe2062b39d288b2339dba4fe976c53a8cdbef54a57bed1854eee29c2569dd | Python | 10,409 | 259 | """Structural Similarity Index (SSIM) functional."""
from typing import Literal, cast
import torch
from mrpro.operators.Operator import Operator
from mrpro.utils.sliding_window import sliding_window
def ssim3d(
target: torch.Tensor,
prediction: torch.Tensor,
*,
data_range: torch.Tensor | None = Non... |
3411fa02576f31c129c45881d9c3f5cfb202c336718bb0b3c78debaa391aa8cf | Python | 10,412 | 308 | import functools
import os
import numpy as np
import pandas as pd
import torch
from pymatgen.core.composition import Composition
from torch.utils.data import Dataset
from matminer.featurizers.base import MultipleFeaturizer
from matminer.featurizers import composition as cf
from matminer.featurizers.conversions import... |
4bafd82cd4c044be4b5cf815ed1a175f8f133ff3a759b5e3952bcd906f7e5272 | Python | 10,416 | 318 | # Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# 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... |
0cde0412e388d9fc7049e3beadd2d6bf8e3c80a6d2704287228b3c01ee9ec689 | Python | 10,419 | 269 | # Copyright 2025 Xanadu Quantum Technologies Inc.
# 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 agre... |
60b60304197a0dbf46b31036dbc9b36f3b692c65a4ea5533ee78bae6bfc1bf65 | Python | 10,420 | 217 | #!/usr/bin/env python3
"""Description:
Setup script for MACS -- Model Based Analysis for ChIP-Seq data
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file LICENSE included with
the distribution).
"""
import sys
import os
import re
from setuptools impo... |
4356184f4608ef079d9cfe931f9dd5c621c19ec03fd08d4a0b47129189ff9422 | Python | 10,428 | 323 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
def test_group_shift_with_null_key():
# This test is designed to replicate the segfault in issue #13813.
n_rows = 1200
# Generate a moderately large dataframe with occasional missing
# values in column `B`, and then gr... |
15e662562acee0dc5b99d578abf4db3f6899bb140a3d977bad60f95a906d2e50 | Python | 10,433 | 347 | # -*- coding: utf-8 -*-
"""
These are some useful functions used in CSD methods,
They include CSD source profiles to be used as ground truths,
placement of electrodes in 1D, 2D and 3D., etc
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files ... |
e9dd8afa90eb9bc203e8e577267227066351773174eac7a38332318cf66f4c3b | Python | 10,443 | 359 | #!/usr/bin/env python
# coding: utf-8
# <a href="https://colab.research.google.com/github/Cyberbullying-Detection/Cyberbullying-Detection-on-Social-Media-using-Deep-Learning-and-Conventional-Machine-learning/blob/main/TFIDF.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt... |
35fbec1628a7d5c4c156fff1d6da2a1759436bcfdb4707a77dd552a63c1f673e | Python | 10,449 | 223 | """Public execution policy contracts and resource detection at OS boundaries."""
from dataclasses import FrozenInstanceError, replace
import os
from pathlib import Path
from types import SimpleNamespace
import pytest
from MACS3.Utilities import Execution
@pytest.fixture
def cpu_host(monkeypatch):
"""Independen... |
497df94453a1e2044a17287eb95be21e806b4e0755e4f64ce4485208bd2fea86 | Python | 10,450 | 230 | """Target-interpreter probes for benchmark_performance.py.
Executed from a temporary working directory. Does not add the checkout to
sys.path: the selected interpreter/PYTHONPATH determines the installation.
"""
import gc
import hashlib
import importlib
import importlib.metadata
import importlib.util
import json
impo... |
d810863be77ddb7d64b808d0f456719e69979be5eb454dc6a25ed42d9f43d74d | Python | 10,452 | 256 | """
Contains the transpiler transform.
"""
from functools import partial
import pennylane as qp
from pennylane.core.qscript import QuantumScript, QuantumScriptBatch
from pennylane.core.queuing import QueuingManager
from pennylane.decomposition import gate_sets
from pennylane.ops import LinearCombination
from pennylan... |
64db741eb239a4f0522106a7b254aad5c77a114c229e29513b82b26cc7587796 | Python | 10,458 | 275 | from copy import deepcopy
from typing import Optional, Tuple
import pandas as pd
from sktime.forecasting.base import BaseForecaster
from sktime.forecasting.compose import ForecastingPipeline
from sktime.transformations.compose import TransformerPipeline
from sktime.transformations.series.impute import Imputer
def _a... |
8ac13222d9c9b8f0eb2cac72fbeb50f07d345989b0fc62d9b7e528a1b30d7cb9 | Python | 10,460 | 221 | import numpy as np
import os
import sys
import ntpath
import time
from . import util, html
from subprocess import Popen, PIPE
if sys.version_info[0] == 2:
VisdomExceptionBase = Exception
else:
VisdomExceptionBase = ConnectionError
def save_images(webpage, visuals, image_path, aspect_ratio=1.0, width=256):
... |
013cfee8f69997c57b661498d218e9fc4d6b8abafd16ffe7bc47214ffa386f35 | Python | 10,462 | 304 | from typing import Iterable, List, Literal, Optional, Sequence, Tuple, Union
import numpy as np
import pandas as pd
import seaborn as sns
from anndata import AnnData
from matplotlib import pyplot as plt
from scipy.sparse import lil_matrix
from tqdm import tqdm
def GWAS_adata_sc(
adata: AnnData,
number: int =... |
ea69e62b4a00154a3a37866a9ebee40469502a8271603e67bcc05e00cc5cf568 | Python | 10,466 | 301 | """
@author: mkowalska
"""
import os
import numpy as np
from figure_properties import *
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import targeted_basis as tb
__abs_file__ = os.path.abspath(__file__)
def set_axis(ax, letter=None):
"""
Formats the plot's caption.
Parameters
... |
81d4808f3764b5035b6d472489baaa8b57b2c7deec0b1720e7accdeb4a459d4c | Python | 10,473 | 214 |
'''
This script creates json files which can be used to render QQ plots.
'''
# TODO: share the `VariantFileReader` with `manhattan.py`.
# TODO: make gc_lambda for maf strata, and show them if they're >1.1?
# TODO: copy some changes from <https://github.com/statgen/encore/blob/master/plot-epacts-output/make_qq_json.py... |
1ff4be212e7ef7a842a76165ca0957ab6713b779ec64565ae94fac43a6b69dcb | Python | 10,480 | 237 | # Copyright 2018-2022 Xanadu Quantum Technologies Inc.
# 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... |
bf4e32dce11fda46934bb9e7562585897ed9f98a8c1c02063be6fd9ab085e840 | Python | 10,482 | 256 | """Daily issue/PR maintenance, plus the PR stale engine.
Two commands:
* ``sweep`` (the ``schedule`` trigger) — (1) sweep open assigned issues and
unassign any non-maintainer assignees that are inactive (no open linked PR by
an assignee, no assignee comment or fresh assignment within
``STALE_ASSIGNEE_DAYS``); (... |
61857ab4c07fa19d7f3ba4f28c4c61e5cef23c8f1bf468fa8c0db8e6db869b16 | Python | 10,485 | 295 | # Copyright 2023 Xanadu Quantum Technologies Inc.
# 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 agre... |
c09c4ed248b61349b3fc2dbe0170620ca6f44419c3a6a49f0c0b8332a6e9f0a7 | Python | 10,487 | 297 | # Original Paper: The global Graph Multiset Transformer pooling operator from the "Accurate Learning
# of Graph Representations with Graph Multiset Pooling" <https://arxiv.org/abs/2102.11533>`.
# Code adapted from PyTorch Geometric:
# https://pytorch-geometric.readthedocs.io/en/2.0.3/_modules/torch_geometric/nn/glo... |
0b91762df3b9b8e8636daf152309b252a86046eb917fe46af40e9c2a410b1170 | Python | 10,490 | 260 | """Session 27 — god-class drain: ``ensemble_model`` / ``blend_models`` /
``stack_models`` / ``calibrate_model`` / ``finalize_model``.
The five remaining supervised model-combination verbs no longer delegate
to ``self._legacy.*``. They wrap sklearn meta-estimators (``BaggingClassifier``
/ ``AdaBoostClassifier`` / ``Vot... |
3c5906e50cf17c6a32b2f7d9732684a9e2711f25b38e19b2756b2ded4b92509a | Python | 10,492 | 305 | import torch
import numpy
import matplotlib.pyplot as plt
import time
import bionetwork
import plotting
import copy
import saveSimulations
import pandas
batchSize = 10
#Load network
networkList, nodeNames, modeOfAction = bionetwork.loadNetwork("data/pipeNet.txt")
bionetParams = bionetwork.trainingParameters(iterations... |
30774ae745edf1f9a347bd7949bd8342214528c7a1bd41f406c2fd7491fcb9cb | Python | 10,506 | 248 | import numpy as np
import pysam
class SimpleVariant:
# # Variant types: DEL, INS, INV, tDUP, itDUP, dDUP, idDUP, SNP
def __init__(self, chrom, start, end, type, alt_bases, supp_reads, supp_cigar):
self.ref_chrom = chrom
self.ref_start = start
self.ref_end = end
self.type = ty... |
e46b0896528d3bb03df46245f4f0e66ca983a93656a49e2e3b578c5813b27c3d | Python | 10,509 | 212 | #! /usr/bin/env python
##############################################################################
## DendroPy Phylogenetic Computing Library.
##
## Copyright 2010-2015 Jeet Sukumaran and Mark T. Holder.
## All rights reserved.
##
## See "LICENSE.rst" for terms and conditions of usage.
##
## If you use this wo... |
9f549f21a1784d942271c6d37f444662112bef812708fca5787fcc4617e84afc | Python | 10,512 | 297 | from treeshrink._vendor.dendropy.datamodel.treemodel import Tree
from math import sqrt
try:
from queue import Queue # python 3
except:
from Queue import Queue # python 2
from copy import deepcopy
from sys import stdout
from treeshrink.Tree_extend import Centroid_Tree, MPR_Tree
class TreeInduced:
def __ini... |
be8337cb3c180382adcb7565f3ded11547fd8b38f034f984c1c8a04081701315 | Python | 10,513 | 330 | """Command-line interfaces for common workflows."""
import argparse
import os.path as op
from nimare.io import convert_neurosynth_to_json, convert_sleuth_to_json
from nimare.workflows.ale import ale_sleuth_workflow
from nimare.workflows.conperm import conperm_workflow
from nimare.workflows.macm import macm_workflow
fr... |
8eb94ec5119f4bb17626fb1d025ed6018c663031aae2f6a23f162f2b0e18fae8 | Python | 10,514 | 281 | import os, datetime, argparse
import numpy as np
from Bio import pairwise2
from model import *
# Set these paths to your own paths
# Note that in UR90, 'uniref90' (last of the variable) is the prefix of the built database files in the database folder. Same does HHDB.
UR90 = "/bigdat1/pub/yuanqm/uniref90_2018_06... |
3d76c842f7ff9944b4a4d73bca7e0e8e38074f3a357093bad5098a6834434969 | Python | 10,515 | 269 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Data-feeding entry point for the BASALT pipeline (CheckM-based branch).
This module integrates external bin sets into an existing BASALT run,
re-runs dereplication and outlier removal, and updates the final
binset and CheckM summary after data feeding.
"""
import tim... |
5764b390853e76c38a76863a5cf897c72f99507426dbc27abf44df83107b1a06 | Python | 10,515 | 504 | # MOFTransformer version 2.0.0
import os
from sacred import Experiment
from moftransformer import __root_dir__
from moftransformer.utils.download import DEFAULT_PRETRAIN_MODEL_PATH
ex = Experiment("pretrained_mof", save_git_info=False)
def _loss_names(d):
ret = {
"ggm": 0, # graph grid matchi... |
84d4648efa00b5cdc38526521bb34388c29374e995f1e14b37e1d0f29b36b843 | Python | 10,515 | 272 | import ast
import pickle
import re
import shutil
from collections import Counter
from pathlib import Path
import tensorflow.keras.backend as K
import tensorflow as tf
import pandas as pd
import numpy as np
from distributed_computing.api import WorkerInterface
from common.logic import probabilistic_proofreading, build_... |
0b4ebbfec0bd5a480dfb0c7afc9e1e246b07913cb08a85b953a84fed6da111bc | Python | 10,524 | 261 | """Per-invocation CPU budgets, independent of third-party thread pools.
Resolve at the API/command boundary and pass the immutable policy to consumers.
Resource discovery is a snapshot; it never changes affinity or environment.
"""
from dataclasses import dataclass
import multiprocessing
import os
from pathlib import... |
4469b034c7aa80fc770098893e429f187c600857276f57b95d978a5b25365033 | Python | 10,538 | 330 | import ast
import functools
import json
import os
import re
from itertools import groupby
import numpy as np
import pandas as pd
import torch
from torch.utils.data import Dataset
from roost.wren.utils import mult_dict, relab_dict
class WyckoffData(Dataset):
"""
The WrenData dataset is a wrapper for a datase... |
a75b32ffcc4d175cc3e8815424ad9fdc7f3e193fb947ee16b70033955262f034 | Python | 10,545 | 254 | import torch
from math import sqrt
from torch.nn import functional as f
import numpy as np
def trace_method(matrix):
device = matrix.device
m = matrix.transpose(0,1) # This method assumes row-vector and postmultiplication of that vector
if m[2, 2] < 0:
if m[0, 0] > m[1, 1]:
t ... |
9216e84006664a8086f091d354109088658c9ed13db969e458cc91c2928f9229 | Python | 10,549 | 335 | import sys
import numpy as np
from pandas import (
DataFrame,
Index,
Series,
concat,
date_range,
json_normalize,
read_json,
timedelta_range,
)
from ..pandas_vb_common import BaseIO
class ReadJSON(BaseIO):
fname = "__test__.json"
params = (["split", "index", "records"], ["int... |
ffeec7daef7d3c73b29c428d9a815fd4cc60a5eda6ae84e79d093cdeefda6420 | Python | 10,551 | 282 | """pickle compat"""
from __future__ import annotations
import pickle
from typing import (
TYPE_CHECKING,
Any,
)
import warnings
from pandas.compat import pickle_compat
from pandas.errors import Pandas4Warning
from pandas.util._decorators import set_module
from pandas.util._exceptions import find_stack_level
... |
3bd4056a7591e39477c4047b45dd454f2bac734688cbd2783a880f8ff118a52c | Python | 10,554 | 235 | # Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# 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... |
72b76d85ece37ef93bbae29663928cf2926a535b3c8855830fde8263a93866d5 | Python | 10,555 | 282 | import numpy
from sklearn import metrics
from spycon.spycon_inference import SpikeConnectivityInference
from spycon.spycon_result import SpikeConnectivityResult
import pandas
import networkx as nx
import itertools
from matplotlib import pyplot
import pickle
class ConnectivityTest(object):
"""
Object that help... |
b3ecb629fa05eae2483c2f41c0f561a89e1c0c654a2d2db0749d940bb8d84632 | Python | 10,559 | 300 | # MOFTransformer version 2.1.1
import sys
import os
import copy
import warnings
from pathlib import Path
import re
import csv
import pytorch_lightning as pl
from moftransformer.config import ex
from moftransformer.config import config as _config
from moftransformer.datamodules.datamodule import Datamodul... |
125db4659827a71009dca0995703bf3edc0bdc91e987c8e3049fbdedde1c4c0d | Python | 10,560 | 230 | # Copyright 2018-2025 Xanadu Quantum Technologies Inc.
# 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... |
5578dcb44149216cf0325a26bffd3a6ea23c08b68c86574555f72f5ca5ada8d7 | Python | 10,564 | 159 | #!/usr/bin/env python3
"""
Description:
This module performs pre-filtering of the input transcripts. The protocol implemented in this modules follows closely the filtering criteria defined in DRIMSeq (Nowicka M. et al, 2016) and involves filtering by Counts Per Million (CPM), Sample Count, Isoform Fraction (IF), T... |
e262219288a83f372b16b103a6bdbe24d9848fe4ba90074f726a4adc33cb51b8 | Python | 10,564 | 215 | """
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.
"""
import logging
import torch
import torch.nn as nn
from torch_geometric.nn import radius_graph
from ocpmodels.common.utils import (
comp... |
99143a824272ace9657b41a7de0456f78d237398725202d17e794c459fe0ccda | Python | 10,576 | 351 | import sys, re, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'resource-gcg', 'scripts'))
import tree
ops = {}
ops['a'] = ['bwd', 'A']
ops['b'] = ['fwd', 'A']
ops['g'] = ['bwd', 'N']
ops['h'] = ['fwd', 'N']
ops['c'] = ['bwd', 'C']
ops['d'] = ['fwd', 'C']
casts = {}
casts['N'] = [... |
e609985f3bebff60933e33aab1b20d36efa78e09c1a93b54d3e7f91ad109a6dc | Python | 10,581 | 241 | '''
Contains functions for generating stimuli
'''
import os
import random
from warnings import warn
from shutil import rmtree
import numpy as np
from PIL import Image
from character_mod import Character
from Clutter_mod import Clutter
from utils_mod import shlex_cmd, DIGITS
from io_mod import name_files
import math
i... |
029a435a4ac35e253cb41ee5c1c85cf0f244bcb83e7ff27d2c343f5ad5345f53 | Python | 10,583 | 321 | import numpy as np
import ctypes
import copy
import twixtools.mdh_def as mdh_def
from twixtools.seqdata import SeqData
class Mdb_base(object):
def __init__(self, version_is_ve=True):
self.version_is_ve = version_is_ve
if self.version_is_ve:
self.mdh = mdh_def.Scan_header()
... |
34e4058812ce67498923c205e301ed6238d106530d17b99778f1e76fec48af14 | Python | 10,584 | 341 | # Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# 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... |
c082cb7145692ce0a05791d70d7d9937247db3a65829e95cd5892bb300a95e40 | Python | 10,590 | 288 | # Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# 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... |
79a697929c4c1366c77be8c708fdad5c468d1adc616cc8d42f443741ae45da93 | Python | 10,591 | 313 | # Copyright 2026 Xanadu Quantum Technologies Inc.
# 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 agre... |
399005b2c9a046a97c3094ce48de030694d5316b1b006cf2798be6e16bd9abcc | Python | 10,593 | 277 | """Session 45 — phase 5d: strip ``legacy.setup()`` from
``_native_setup_timeseries``.
Phase 5a (s39) brought TS into the native dispatcher but the soft drain
still called ``legacy.setup()`` underneath. Phases 5b/5c (s40-s44)
drained every callable TS verb. This session takes the final step:
``_native_setup_timeseries`... |
59333aba3ca89f90a8677646f54f96a1c8af3fd7026826361bc0e0e652408958 | Python | 10,594 | 295 | from datetime import datetime
import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
from pandas.core.algorithms import safe_sort
def equal_contents(arr1, arr2) -> bool:
"""
Checks if the set of unique elements of arr1 and arr2 are equival... |
6bf6bfbcb89f71258f2722dc604ed19d8916dddd05508b1b0bfa55ad5b3bec5d | Python | 10,597 | 337 | """
Functions for implementing 'astype' methods according to pandas conventions,
particularly ones that differ from numpy.
"""
from __future__ import annotations
import inspect
from typing import (
TYPE_CHECKING,
overload,
)
import warnings
import numpy as np
from pandas._libs import lib
from pandas.errors ... |
70cb66a02f5dae8a29fc9d102f2314d6fc9cc4629bd73300b806e5a3ee5c2ad6 | Python | 10,601 | 288 | # Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# 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... |
21f5b3e271a0e0a257106d756f1e37f5f9f8de03f974f745b94901587b606f6f | Python | 10,606 | 281 | # Copyright 2018-2025 Xanadu Quantum Technologies Inc.
# 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... |
bf386fd8dbd1835c321ad4a7206e33da555e1cdcf1c1c2b11e4e6ef8eda4bec5 | Python | 10,606 | 211 | """CLI interface for the moseq2-lda package."""
import click
import os
import numpy as np
from moseq2_lda.data import load_representations
from moseq2_lda.model import create_lda_pipeline, run_cross_validation, train_lda_model, train_lda_pipeline
from moseq2_lda.util import click_monkey_patch_option_show_defaults
fro... |
9aba47a72c074db722e6c6c42b251e0dd85c45d407f95776e8e3d5394d9ab229 | Python | 10,609 | 243 | """Workflow for running an ALE meta-analysis from a Sleuth text file."""
import logging
import os
import pathlib
from shutil import copyfile
import numpy as np
from nimare.correct import FWECorrector
from nimare.diagnostics import FocusCounter
from nimare.io import convert_sleuth_to_dataset
from nimare.meta import AL... |
cd8ce16ebde9dacf459476b50a2d6a499aa01473458dfbba69b326080b30657e | Python | 10,610 | 275 | import gc
import platform
from typing import Union, Tuple
from sklearn.ensemble import VotingRegressor
from sklearn.utils.validation import check_is_fitted
from sklearn.base import BaseEstimator, RegressorMixin
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import te... |
ebfc9125edf1f6f73695a501e8971c652a6081336b5d77dfad0d5fd074eff47e | Python | 10,610 | 366 | import random
import tempfile
from collections import Counter
from concurrent.futures import ProcessPoolExecutor, as_completed
from itertools import product
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pystan
from tqdm import tqdm
from .. import config, estimation
from ..preprocessing... |
c9180ab2552e34e5a4b2084625523968bf74a842aa35baa177840a868062287b | Python | 10,612 | 242 | # Copyright 2026 Xanadu Quantum Technologies Inc.
# 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 agre... |
f07044c91d1bf63abefb173ff5893ec886969ffd05516bfb043b21419c37b272 | Python | 10,613 | 289 | """
Reads an hhsuite hhm file (containing one or more profiles) or a list of hhm files and runs hhblits of all of the profiles against a formatted hhsuite database.
"""
from esmologs import __version__
from typing import List
from collections.abc import Iterable
import subprocess
import argparse
import sys
import r... |
afadabda51ae5718057444dce38a86c0457dab90a2c0d3fc0cdd41a6d99c51a0 | Python | 10,616 | 344 | # Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# 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... |
1c8660a46bea4c64d608be86c69a6065fbfcd039c941423656b54962251e33be | Python | 10,620 | 326 | #! /usr/bin/env python
##############################################################################
## DendroPy Phylogenetic Computing Library.
##
## Copyright 2010-2015 Jeet Sukumaran and Mark T. Holder.
## All rights reserved.
##
## See "LICENSE.rst" for terms and conditions of usage.
##
## If you use this wo... |
46abbab5c68f76eea5ccff4fab09ffd3d33ff163f7ccc3a8b500e71981ab74dd | Python | 10,620 | 308 | """Session 47 — Track A · plot module: classification + regression diagnostics.
The legacy ``plot_model`` was deleted in s46. This session begins the
Plotly-native rewrite: every function in ``pycaret.plots.<task>``
returns a ``plotly.graph_objects.Figure`` that the React dashboard
consumes via ``react-plotly.js`` and... |
69d0dc0d5de660735ddedd03562fc8b7a8be51cf7c6713e3872d32f2de523645 | Python | 10,627 | 182 | # Copyright 2019 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
ce64da671a4cf73be699c617e9f58ed2a4ee102510bb90d169d11c59bd77ae94 | Python | 10,631 | 296 | # MOFTransformer version 2.2.0
import sys
import os
import copy
import warnings
from pathlib import Path
import shutil
import pytorch_lightning as pl
from moftransformer.config import ex
from moftransformer.config import config as _config
from moftransformer.datamodules.datamodule import Datamodule
from ... |
56c8b4332efe1d09b028b62d8337d4b795d127b6c05f6d4b9c65520cd84a8150 | Python | 10,636 | 306 | import torch
import torch.utils.data as data
import torch.nn as nn
import scipy.io as io
import numpy as np
import nibabel as nib
import os, sys
class VolumeDataset(data.Dataset):
def __init__(self,
rimg_in=None,
cimg_in=None,
bmsk_in=None,
transform=None,
debug=True
... |
1eea870ea5f4dd6bec7b37e98f9ed4274e7f3641f6bf40332ba61c82a758ac68 | Python | 10,641 | 317 | import ast
import functools
import os
from itertools import groupby
import numpy as np
import pandas as pd
import torch
from pymatgen.core.structure import Structure
from torch.utils.data import Dataset
from roost.core import Featurizer
class CrystalGraphData(Dataset):
def __init__(
self,
data_p... |
abb9448bbc46ad89715599115c50627bcd9f5b2adbb576d6fab216e26ad854c8 | Python | 10,641 | 236 | #!/usr/bin/env python
import os, re, sys
from collections import defaultdict
from csv import DictReader, DictWriter
from Bio import SeqIO
from cupcake.io.GFF import collapseGFFReader
from cupcake.io.GFF import GTF
fusion_pbid = re.compile('PBfusion.(\d+).(\d+)')
"""
Run after fusion_finder.py + SQANTI3 classification... |
fed52cf92da652e3ffa5aececc94ab6e61d7c04c7b6e783645ff26c64b5cd69d | Python | 10,644 | 341 | import numpy as np
from kcsd import KCSD2D
from pathlib import Path
from openpyxl import load_workbook
import DemoReadSGLXData.readSGLX as readSGLX
# from DemoReadSGLXData.readSGLX import readMeta, SampRate, makeMemMapRaw,
# GainCorrectIM, GainCorrectNI, ExtractDigital
import matplotlib.pyplot as plt
import matplotlib... |
ec2822cd671cdb695a3816c00e0983898ace4b75393e0bd1f0fc69ea9d84cec7 | Python | 10,653 | 152 | """Cumulative exposure and matched-window external health contrasts.
No local epidemiological model is fitted. RR(exp(weighted delta)) is a
representative contrast, never an aggregate rate ratio or attributable burden.
"""
from pathlib import Path
import os,json,sys
os.environ.pop('PROJ_LIB',None);os.environ.pop('PROJ... |
b4a8cf72a55106f6d4b1d05ad77ed4d223229bca33acedc51940792a3e55d838 | Python | 10,654 | 283 | import torch
import torch.nn as nn
from onmt.utils.misc import aeq
from onmt.utils.loss import CommonLossCompute
def collapse_copy_scores(scores, batch, tgt_vocab, src_vocabs=None,
batch_dim=1, batch_offset=None):
"""
Given scores from an expanded dictionary
corresponeding to a b... |
6ec4912013e2dede458f89bb97fb5642dc0b526fab17efc202b6581c4b6f1a72 | Python | 10,662 | 361 | from __future__ import annotations
from typing import Final
magic: Final = (
b"\x00\x00\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\xc2\xea\x81\x60"
b"\xb3\x14\x11\xcf\xbd\x92\x08\x00"
b"\x09\xc7\x31\x8c\x18\x1f\x10\x11"
)
align_1_checker_value: Final = b"3"
align_1_offset: Final = 32
align_1_length:... |
2450d936855f0d436bf472a32a6f3a8eb4f3812ea9de136abdb50b115357d831 | Python | 10,673 | 206 | """Reader-selection dispatch: turns a backend name (or ``None``) into a built dataloader.
Single entry point: :func:`build_video_reader`. Resolves which backend to use --
either the caller's explicit choice, validated against this machine/video, or an
auto-select fallback chain (pynvvc -> dali -> opencv, richest/faste... |
3f9a04c194d880a245061e54ba39c19303c2d0866727be532c4106c21ec96d99 | Python | 10,677 | 256 | """Tests for KTrajectory class."""
import pytest
import torch
from einops import rearrange
from mrpro.data import KTrajectory
from mrpro.data.enums import TrajType
from mrpro.data.KData import has_n_coils
from tests.conftest import COMMON_MR_TRAJECTORIES, create_traj
def test_trajectory_repeat_detection_tol(cartesi... |
2db16cb0aed25a734d05ddd19baa08982a97359bf7be1fc776364a9e06ff83bc | Python | 10,680 | 302 | # Copyright 2026 Xanadu Quantum Technologies Inc.
# 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 agre... |
e29e3336787187cfd82c19844e4134c854695090dec2ef84b73d9db6f23246f3 | Python | 10,684 | 276 | import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays.categorical import CategoricalAccessor
from pandas.core.indexes.accessors import Properties
class TestCatAccessor:
@pytest.mark.parametrize(
"method",
... |
184ac7475e14aa993c98d7a94bd1f761da9a3b11b07867c0dbf2cc78ba10ab72 | Python | 10,694 | 289 | """Models for Gradec."""
import os.path as op
import numpy as np
import pandas as pd
from nimare.annotate.text import generate_counts
from nimare.base import NiMAREBase
from nimare.utils import _check_ncores, get_resource_path
from sklearn.decomposition import LatentDirichletAllocation
from sklearn.feature_extraction.... |
4d606e30c0e665635511afeef4a94454b4a3ef44c7bfc3eff7005a9f1e80bfcc | Python | 10,695 | 290 | """Models for Gradec."""
import os.path as op
import numpy as np
import pandas as pd
from nimare.annotate.text import generate_counts
from nimare.base import NiMAREBase
from nimare.utils import _check_ncores, get_resource_path
from sklearn.decomposition import LatentDirichletAllocation
from sklearn.feature_extraction... |
17bd654cbe034de51e5dfc1eeffc11dd583db619c776d24083c5c723eb21bfa8 | Python | 10,698 | 294 | import torch
import numpy
import matplotlib.pyplot as plt
import bionetwork
import plotting
import pandas as pd
import seaborn as sns
import time
import copy
from scipy.stats import pearsonr
import pandas
def getSample(filePath, sampleName):
file = open(filePath + 'name.txt', mode='r')
curSample = file.read()
... |
0aa05acbd6982c55e4ce79f690a0273684630c6daee04d661da0607a143b1aab | Python | 10,699 | 261 | import os
from typing import overload
from math import ceil
import matplotlib.pyplot as plt
import matplotlib.image as img
import pandas as pd
import numpy as np
import seaborn as sns
from matplotlib.colors import ListedColormap
from PIL import Image
from utils import Observer, get_continuous_cmap
class ResultPlott... |
82c9ab522d60267d02d844363090757400a63d9bdbbc2a4f2b7c9acf76035b82 | Python | 10,710 | 325 | from sys import path as sys_path
sys_path.append('..')
sys_path.append('../base')
import numpy as np
#import curves
from base.curves import Curve, remesh
from base import loggingUtils
from base.kernelFunctions import Kernel
from base.curveMatching import CurveMatchingParam, CurveMatching
import matplotlib
matplotlib.us... |
dd658b6a05c183f14f51be2076a0809c1a0e5e38907a5321d595ac5c8e9a33a7 | Python | 10,710 | 296 | from datetime import datetime
import numpy as np
import pytest
from pandas._libs.tslibs.offsets import MonthEnd
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
from pandas.tseries import offsets
class TestAsFreq:
def test_asfreq2(self, frame_or_series):
ts = f... |
ec6480ad6c25a9124acc225472d1e206d5b60c1bba3e941f514357302b6eb6b2 | Python | 10,713 | 227 | # Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# 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... |
217618a52c4edcc16ab9e7fbd9c9afbade4eab408ac5fbee7d29555adb88ccec | Python | 10,717 | 296 | # Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# 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... |
be16d9e9a1972786c645b5bfa908829c5bf51008fbd9cd663d2282039ffe2ddc | Python | 10,717 | 257 | # Copyright 2025 Xanadu Quantum Technologies Inc.
# 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 ag... |
d5accfde1dea362698aa43058baecf0f23f03387a60d06fe870d2089afc623ba | Python | 10,717 | 275 | # %% [markdown]
# # Total-variation (TV)-minimization reconstruction
# %% [markdown]
# ### Image reconstruction
# Here, we use the Primal Dual Hybrid Gradient (PDHG) algorithm to reconstruct an image from 2D radial k-space data.
#
# Let $y$ denote the k-space data of the image $x_{\mathrm{true}}$ sampled with an acqui... |
6f94e52ffa9fde509d4d07c149ce0e9335b5d0a5eb994b25fcd804d631c3e291 | Python | 10,725 | 427 | from datetime import datetime
import numpy as np
from pandas import (
NA,
Index,
NaT,
Series,
date_range,
)
class SeriesConstructor:
def setup(self):
self.idx = date_range(
start=datetime(2015, 10, 26), end=datetime(2016, 1, 1), freq="50s"
)
self.data = di... |
1176cd830b8bc1c465df46102b0c523b63bb9f12463912955a3fc464bfb9a767 | Python | 10,727 | 420 | import argparse
import os
import sys
import torch
from sklearn.model_selection import train_test_split as split
from roost.roost.data_pretrain import CompositionData, collate_batch
from roost.roost.model_pretrain import Roost
from roost.utils_pretrain import train_ensemble
def main(
data_path,
fea_path,
... |
7b8ed8ee0ed7195057154266150008ee0a29b456ad5daae7861a00cbc3007da8 | Python | 10,728 | 359 | from itertools import product
import string
import numpy as np
import pandas as pd
from pandas import (
DataFrame,
MultiIndex,
date_range,
melt,
wide_to_long,
)
from pandas.api.types import CategoricalDtype
class Melt:
params = ["float64", "Float64"]
param_names = ["dtype"]
def setu... |
8282ee3bdacd9dc3eae2bf71fa28c6fe28e232e633330156a20ff9d8c47171f9 | Python | 10,729 | 363 |
import torch
import torch.nn as nn
from torch.autograd import Variable
from functools import reduce
class LambdaBase(nn.Sequential):
def __init__(self, fn, *args):
super(LambdaBase, self).__init__(*args)
self.lambda_func = fn
def forward_prepare(self, input):
output = []
for m... |
e11ce7d546c8f74d66fcb6cf8067722fa4d80ad41a167c7e0bc10a840af78167 | Python | 10,729 | 289 | """ "
Test module for testing ``pandas._testing.assert_produces_warning``.
"""
import warnings
import pytest
from pandas.errors import (
DtypeWarning,
PerformanceWarning,
)
import pandas._testing as tm
@pytest.fixture(
params=[
(RuntimeWarning, UserWarning),
(UserWarning, FutureWarning... |
a8e335c59c7d106e7a59518d46821faaf742c8de8e8b56f29ffdf82961b707e4 | Python | 10,735 | 339 | import re
import csv
import os
import time
from operator import and_
from functools import reduce
import matplotlib.pyplot as plt
import numpy as np
from nibabel import load as load_nii
from skimage.measure import label as bwlabeln
import torch
from torch.utils.data import DataLoader
from datasets import LesionCropping... |
32235a582020800274f6eec9089be70ee41af6d44960778e4dc045fa4804460f | Python | 10,736 | 388 | import numpy as np
import pytest
from pandas._libs import join as libjoin
from pandas._libs.join import (
inner_join,
left_outer_join,
)
import pandas._testing as tm
class TestIndexer:
@pytest.mark.parametrize(
"dtype", ["int32", "int64", "float32", "float64", "object"]
)
def test_outer_... |
5612dfe04234afb43154c677647d29347ac2d80c949ec72ae9ce44c9583ad056 | Python | 10,743 | 278 | # Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# 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... |
c5fbd2f2aa599caa0351c41eddbed5ece2f0dc1f7d0e2d141202864acf1bd174 | Python | 10,744 | 301 | """Various statistical helper functions."""
import logging
import warnings
import numpy as np
from . import utils
LGR = logging.getLogger(__name__)
def one_way(data, n):
"""One-way chi-square test of independence.
Takes a 1D array as input and compares activation at each voxel to
proportion expected u... |
82b787f6603474d57e6aea1c16899074ea0bb67b11209bdf3b7354b789429caf | Python | 10,746 | 317 | import os, sys
import torch
import torch.nn as nn
import torch.nn.functional as F
from sequence_models.trRosetta_utils import *
from sequence_models.constants import WEIGHTS_DIR
from sequence_models.layers import MaskedInstanceNorm2d
def pad_size(d, k, s):
return int(((139 * s) - 140 + k + ((k - 1) * (d - 1))) /... |
7611dd255aed618ebd8a960c8e348d2742065e9206ef1d4b2198e057275c3ca7 | Python | 10,752 | 305 | # Copyright 2024 Xanadu Quantum Technologies Inc.
# 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 agre... |
50e3cc22f1ee233bf2b85d0d476a40c4e00bef31231f58cdfd51284900696d9f | Python | 10,756 | 282 | # Copyright 2018-2025 Xanadu Quantum Technologies Inc.
# 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... |
fd055e735421c5d76335b64c7217d7ff7e253af8cd27a83e65a42051a7e4e7a7 | Python | 10,759 | 328 | import pickle
import matplotlib.pyplot as plt
import mlflow
import numpy as np
import pandas as pd
import sklearn
import torch
import torch.nn as nn
import torchinfo
from sklearn.decomposition import PCA
from sklearn.metrics import precision_recall_curve, roc_curve
from sklearn.model_selection import KFold, train_test... |
2948d5b407c46f19fd8f259b425371bff463a9c1614569983692f1da2f6b1aa8 | Python | 10,762 | 320 | # Copyright 2018-2025 Xanadu Quantum Technologies Inc.
# 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... |
3def69ec6fb633beaf119c68aee44224d6a4d0b81e9c692d712b57a5cd188102 | Python | 10,770 | 242 | import numpy as np
from .kernelFunctions_util import applyK1K2, applyDiffK1K2T
def varifoldNorm0(fv1, KparDist, KparIm, imKernel = None):
c2 = fv1.centers
a2 = fv1.weights * fv1.volumes
if imKernel is None:
A1 = fv1.image
else:
A1 = np.dot(fv1.image, imKernel)
return ((applyK1K2(... |
3ef46b43b693470a2f581f622d4b11ae43c443da42310f4505b26262788aa02e | Python | 10,778 | 284 | import torch
import torch.nn as nn
from tqdm import tqdm
import numpy as np
import os
from torch.utils.data import DataLoader
import matplotlib.pyplot as plt
from AYN_Package.Task.ObjectDetection.D2.YOLO.V5 import *
from AYN_Package.Optimizer.WarmUp import WarmUpOptimizer, WarmUpCosineAnnealOptimizer
from yolo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.