sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
515cd43fc8177c7ba0093c76ab29c8e55903fc1ce0e0cd8897f539b90a337876 | Python | 15,499 | 528 | import numpy as np
import pytest
from pandas.errors import InvalidIndexError
import pandas.util._test_decorators as td
from pandas.core.dtypes.common import is_integer
import pandas as pd
import pandas._testing as tm
@pytest.mark.parametrize("dtype", ["S1", "V1"])
@pytest.mark.parametrize(
"method,cond",
[... |
2ba037a495a4f19e069488b01f287b94d615ef2c48bfc546ca99556106acfa47 | Python | 15,504 | 332 | from pymatch import *
import functions as uf
class Matcher:
'''
Matcher Class -- Match data for an observational study.
Args:
test (pd.DataFrame): Data representing the test group
control (pd.DataFrame): Data representing the control group
formula (str): custom formula to use f... |
5cb410034954f556c6d834b2876fec280ea20f3ed17b37070547855dd9f6d222 | Python | 15,507 | 380 | # 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... |
95fe3d8cf20c23090a08c7e9feaf13fc8bca8e52570777a1400cc0be5c54d26c | Python | 15,510 | 440 | import torch
import torch.nn as nn
from onmt.models.stacked_rnn import StackedLSTM, StackedGRU
from onmt.modules import context_gate_factory, GlobalAttention
from onmt.utils.rnn_factory import rnn_factory
from onmt.utils.misc import aeq
class DecoderBase(nn.Module):
"""Abstract class for decoders.
Args:
... |
ddf201bdf8b89f82042e61c95e348e90451077f8e65c3bd8853f256aa297e356 | Python | 15,510 | 357 | # 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... |
e746b86c4f4446f93083a11cd8e38b544baa100a96e2a3e7e738c2bae0c4bbd5 | Python | 15,513 | 380 | import os.path as os_path
import pathlib
import traceback
import importlib.resources
import platform
from dclab.rtdc_dataset.fmt_dcor import access_token
from dclab.lme4 import rsetup
from PyQt6 import uic, QtCore, QtWidgets
from PyQt6.QtCore import QStandardPaths
from .widgets import show_wait_cursor
from ..extensi... |
3931be7148187f2fd62a47443c929249df271633d7574916ef04ba6462033d5d | Python | 15,516 | 389 | ''' This program will check sample IDs from a publishing database against sample IDs
from the publishedURL table (MongoDB neuronbridge). Any samples in the publishing
database but not neuronbridge will be reported, and files of these samples and
images requiring segmentations will be produced.
'''
__version... |
a4cd5d677e0dcdaedbe15d57951a4fa21183060ecb42a4a68d2e3b3d54c6c338 | Python | 15,517 | 379 | #!/usr/bin/env python
import os, sys
from Bio.Seq import Seq
from csv import DictReader, DictWriter
import pysam
import pdb
VALID_CIGAR_SYMBOL = ['I', 'D']
def iter_cigar_string(cigar_string):
# ex: 1=1X2=1X1=1D5=8D3=27I
num = cigar_string[0]
for s in cigar_string[1:]:
if str.isdigit(s):
... |
7bfd09a6fc7d20d39bbd2edc7652e69b7c3c5ccca8e8c05bd5abe53f54a89c8a | Python | 15,537 | 427 | # 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... |
eb40abf0c6824fa0ef7ef9abd4e0aaf805724c9f07d4191f8ffd5320e09ab75e | Python | 15,545 | 548 | # cython: language_level=3
# Time-stamp: <2024-10-22 14:47:22 Tao Liu>
"""Module for SAPPER BAMParser class
Copyright (c) 2017 Tao Liu <tliu4@buffalo.edu>
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file COPYING included
with the distribution).
@s... |
f8c768277577b6d9ddd26220f762fa6e5955647c2b935ff0502acdb79570d173 | Python | 15,547 | 429 | # 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... |
0a025d0e138ea578936d4fef655e9c631cd09c01c988730e52816c7d4a224356 | Python | 15,566 | 364 | import numpy as np
import pytest
from pandas.core.dtypes.concat import union_categoricals
import pandas as pd
import pandas._testing as tm
class TestUnionCategoricals:
@pytest.mark.parametrize(
"a, b, combined",
[
(list("abc"), list("abd"), list("abcabd")),
([0, 1, 2], [2... |
66c994b9c9e4de453c4194795279f82b8c36bdb7df275731770e9dfdf05a4412 | Python | 15,571 | 433 | """
Tests for the Index constructor conducting inference.
"""
from datetime import (
UTC,
datetime,
timedelta,
)
from decimal import Decimal
import numpy as np
import pytest
from pandas._libs.tslibs.timezones import maybe_get_tz
import pandas as pd
import pandas._testing as tm
class TestIndexConstruct... |
16d3e4dbb19c262f8cc4becc16c5fe679b060ff1dae0b9ea4655a96465632b11 | Python | 15,581 | 476 | # 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... |
392a3a42db952f385951af2f10396b6e0a2f715992c1d7f7391f0a4e6240cd28 | Python | 15,586 | 478 | """Plotly-native feature attribution plots — model-agnostic.
Built on sklearn primitives (``permutation_importance``,
``partial_dependence``) so they work with any fitted estimator without
requiring SHAP. SHAP-based plots will be added as an optional layer
(install via ``pip install pycaret[explain]``).
Functions:
-... |
163228189790cbd6a660bb12ca419cffd1959a0c683aa8792c316dac851e64d8 | Python | 15,589 | 282 | # Copyright (c) 2018-2023, NVIDIA Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of condit... |
3d0ca6410a2b7825d94f5020b1b5dbf59335044a4d54185cf6043252a7954ed0 | Python | 15,593 | 450 | # Copyright 2018-2020 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... |
c109196722323f6610a7c62fc013910f585e5b7dca502cd66bd63988d0c36354 | Python | 15,603 | 397 | # Copyright 2018-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... |
37a57dfcd61cbac73e0f6dd4775b4deec6f2c84d9ffbc2cb18970564b99eb161 | Python | 15,615 | 532 | # %%
import os
os.chdir("..")
print(os.getcwd())
# %%
from deepglyco.chem.common.elements import ElementCollection
elements = ElementCollection.load()
print(elements)
print(elements.parse_element_composition("C H(2) O"))
# {'C': 1, 'H': 2, 'O': 1}
print(elements.parse_element_composition("H(-1) N(-1) O"))
# {'H': ... |
da2e9201512fce69c3723b25d401190eecedfa415d1ad3082ad946a2d3cb5e58 | Python | 15,618 | 428 | #!/usr/bin/env python
"""Module Description: Test the RACollection class in
MACS3.Signal.RACollection, which holds the read alignments overlapping
one peak, rebuilds the peak reference sequence from their MD tags,
collects per-position allele information and runs the fermi-lite local
assembly.
Reads are ReadAlignment... |
4bc995ad20cbddf81a45907970f3f441fad80ca20e6832e120a1f8ef43f13b7f | Python | 15,621 | 415 | import anndata
import numpy as np
import pandas as pd
from sklearn.impute import KNNImputer, SimpleImputer
from ..utils._hf import download_hf_file
from ..utils._utils import progress
@progress("Impute missing values")
def impute_missing_values(adata: anndata.AnnData, strategy: str, logger, indent_level: int = 1) ->... |
1f4a5981cd67ae863454e5ac299b548842faf138fc222b2959fafd7fe008efe6 | Python | 15,630 | 393 | # Copyright 2018-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... |
f4e6323737ec78aa3e895ab77facad7068de0eea7720f914e636c35ae64ac048 | Python | 15,632 | 521 | # JN 2015-04-22
# JN 2021-12-01 adding type check for stored sign
# refactoring
"""
manages spikes and sorting, after concatenation
"""
import logging
logger = logging.getLogger(__name__)
import numpy as np
import tables
import os
from .. import SIGNS, TYPE_NAMES, TYPE_ART, GROUP_NOCLASS, GROUP_ART, NcsFile,\
TY... |
295ad4f1d3107d0880c87c5ee7847cd8ff0958111a51b2a06828e699174670bd | Python | 15,637 | 415 | # 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... |
4807ec0220e69964bfa84b2ce4d9c08abf416468eb9c4a050c0b5e55cb08ed79 | Python | 15,640 | 497 | from datetime import (
datetime,
timedelta,
)
from dateutil.tz.tz import tzlocal
import numpy as np
import pytest
from pandas._libs.tslibs import (
OutOfBoundsDatetime,
Timestamp,
)
from pandas.compat import (
IS64,
WASM,
is_platform_windows,
)
import pandas as pd
import pandas._testing a... |
76498feefbd2b5f9b01d408b086e91faf97d1f0a4edccb4374aa4c56813e9d46 | Python | 15,642 | 446 | from __future__ import annotations
import contextlib
import datetime as dt
from typing import (
TYPE_CHECKING,
Any,
Literal,
cast,
)
import warnings
import zoneinfo
import numpy as np
from pandas._config import using_string_dtype
from pandas._libs import lib
from pandas._libs.tslibs import timezones... |
10c33eac0ee4a84c1f21d99ebb378fb37080e1b713606d48dfab8eb57a83e7a4 | Python | 15,649 | 491 | # being a bit too dynamic
from __future__ import annotations
from math import ceil
from typing import TYPE_CHECKING
import warnings
import matplotlib as mpl
import numpy as np
from pandas.util._exceptions import find_stack_level
from pandas.core.dtypes.common import is_list_like
from pandas.core.dtypes.generic impo... |
e6d7d843b29db5586f069f8ada60af4477628aa606deb4945834e78b10f34e39 | Python | 15,651 | 368 | """
Some key layers used for constructing a the Capsule Network architecture.
Code credits to Xifeng Guo: `https://github.com/XifengGuo/CapsNet-Keras`
Updates specific to:
- PrimaryCap function: returning the Conv2D PrimaryCaps output in addition to the squashed PrimaryCaps
*NOTE*: some functions can be implemented ... |
3657165297d7f4f924769cb29c14c27013c62a2aeedccaa39f72dc1f624c6f3e | Python | 15,653 | 406 | """Predict command for the lightning-pose CLI."""
from __future__ import annotations
import argparse
import logging
import textwrap
from pathlib import Path
from pprint import pformat
from typing import TYPE_CHECKING, Any, get_args
from lightning_pose.cli import types
from lightning_pose.utils.inference_types import... |
7ca0349178c3cc58dbb3b1ae2228d4c6a04a8daf0e652811f6ccaf4ac43fe5db | Python | 15,659 | 275 | #! /usr/bin/env python
##############################################################################
## DendroPy Phylocoalescenttic 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 t... |
63493794363aca5f248fb70e806378420b0ec6fd3edf26bdcc5a086cb169b7c9 | Python | 15,661 | 456 | """
Tests encoding functionality during parsing
for all of the parsers defined in parsers.py
"""
from io import (
BytesIO,
StringIO,
TextIOWrapper,
)
import sys
import tempfile
import numpy as np
import pytest
from pandas.errors import (
EmptyDataError,
ParserWarning,
)
import pandas as pd
impor... |
8ae3f632e93a92a93c8ce6fed13cb97916e9f984b83c6b8b4b83cf9b46b13ffe | Python | 15,663 | 479 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 14 20:43:48 2021
@author: reisertm
"""
import sys
import os
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
import math
from tensorflow.keras import Model
from tensorflow.keras import layers
im... |
b2582bc101663d2200b0daded9c64ce6bb8c73f3daa932e4486b672566905cbc | Python | 15,681 | 450 | from tensorflow.keras.layers import Input, Conv1D, MaxPooling1D, Dropout, BatchNormalization, Activation, Add, Flatten, Dense
from tensorflow import keras
from tensorflow.keras.initializers import lecun_normal
import tensorflow as tf
from tensorflow.keras.callbacks import ModelCheckpoint, CSVLogger
import pandas as pd
... |
9345263a5029607578130867b108b504827e055fcd19682b1f6d2701876f23ff | Python | 15,682 | 386 | import os
import copy
import torch
from torch import nn
from torch.nn.utils import clip_grad_norm_
import torch.distributed as dist
from rl_games.algos_torch import torch_ext
from rl_games.algos_torch.running_mean_std import RunningMeanStd, RunningMeanStdObs
from rl_games.common import common_losses
from rl_games.commo... |
7532acabeca1c506593bd8c0ba7eef51d239a43fc8b608db73eb14e0566a4bd1 | Python | 15,684 | 390 | # 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... |
f1b9fd5c427b242d608da032e447442f17403366d0950cc8152c97253bd9f600 | Python | 15,696 | 533 | # -*- coding: utf-8 -*-
# @File name: metrics_model_Q10.py
# @Author: Alicia Garrido-Peña
# @Date: 2023-08-04 13:54:09
# @Contact: alicia.garrido@uam.es
# "Copyright (c) 2023 Alicia Garrido-Peña. All Rights Reserved."
# Use of this source code is govern by GPL-3.0 license that
# can be found in the LICENSE file
# ... |
9b590653b9dccc0acdf159f4b1d7e3b74721339dde6d524f646ae265ca16c84a | Python | 15,698 | 440 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import pretraining.tools as tools
from torchvision.models.resnet import conv3x3, resnet18, resnet50
class BasicBlockV2(nn.Module):
"""
Basic Residual Block of ResNet V2
"""
expansion = 1
def __init__(self, inpl... |
bf2247fd1722d3151fb30e4bb480b06a8de9c46d64ebb70fecd964b3d1512fea | Python | 15,701 | 438 | """Test the PCA module used in the PCA losses."""
import numpy as np
import pytest
import torch
from lightning_pose.utils.pca import (
ComponentChooser,
EmpiricalEpsilon,
KeypointPCA,
NaNPCA,
format_multiview_data_for_pca,
)
def check_lists_equal(list_0: list, list_1: list) -> bool:
return (... |
1c374839e5878f953b35e9fb0cc5c4fe059107c7aa286a79e8d470b2cb9efb38 | Python | 15,703 | 425 | # Copyright 2018-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... |
871b2d94aa08163b21292039d3dc69444720e311430e769c3bc6b656f324fe6f | Python | 15,707 | 340 | import numpy as np
import sys
sys.path.append ( '..' )
from prepare_data.create_drug_feat import get_atom_int_feature_dims,get_bond_feature_int_dims
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import GINEConv,GraphSizeNorm,global_mean_pool,global_add_pool,global_max_pool
... |
f865ae91dffb2b4834292ce05c876bf3d77f36417f70075a2b5259348b0c83a5 | Python | 15,767 | 465 | # -*- coding: utf-8 -*-
import os
from PIL import Image
import os.path
import time
import torch
import torchvision.datasets as dset
import torchvision.transforms as trn
import torch.utils.data as data
import numpy as np
from PIL import Image
# /////////////// Distortion Helpers ///////////////
import skimage as sk... |
2aa3da8d6c448f1fdd701aec375f2dd931ee24bfa7115c06131dc9d9c2e8820b | Python | 15,776 | 440 | __all__ = [
"GlycanFragmentTypeInfo",
"GlycanFragmentTypeCollection",
"reducing_end_fragments",
"reducing_end_fragment_graph",
"branch_fragments",
"branch_fragment_graph",
]
import functools
import itertools
import os
from dataclasses import dataclass
from typing import (
Dict,
Iterable... |
972fb958bbc5cdb82c74a61fd09c1684256ff424a9bc27d0b95e7d8dd87ab734 | Python | 15,777 | 423 | """Tests for the internal tAge cohort transform and its gene filter.
The numeric parity of each individual stage is covered by
``test_tage_transforms.py`` against the authors' R fixtures; what is checked
here is that ``_prepare_tage`` composes those stages in the reference order
(filter -> map -> RLE -> log -> scale -... |
1e5b79f18dc8b6a10313bc53f76345cbec760c04f44905940dfafae2f51de441 | Python | 15,780 | 421 | # 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... |
3cb17699802fa91fdcdee2f26ec265e7685e73ab17a31831d139451e4e46de46 | Python | 15,780 | 401 | # Copyright 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 agre... |
c70de6e3f529764ffbbb17dcc40f29ab3a9a1b118fddb55fd958caad57d5495e | Python | 15,781 | 381 | """MR image data header (IHeader) dataclass."""
import dataclasses
import datetime as dt
import re
from collections.abc import Callable, Sequence
from dataclasses import field
from datetime import datetime, time
from typing import cast
import numpy as np
import torch
from einops import rearrange
from pydicom.dataset ... |
30363f6b294ab13d706ee96e094c989710e0f2900b1edb5577445658e7e61edd | Python | 15,789 | 333 | from __future__ import print_function
import svgwrite
import os
import logging
import argparse
import pandas as pd
### 2017-October-11: Adapt plots to new output; inputs are managed using "argparse".
logger = logging.getLogger('root')
logger.propagate = False
boxWidth = 10
box_size = 15
v_spacing = 3
# colors ... |
423f299d372ecb6b8336c00c11dc84a0ec1b8187dc3f47d13a7008296b3738e1 | Python | 15,790 | 463 | import numpy as np
import pyproj
import csv
import h5py
import time
from pyulog.core import ULog
def quaternion_to_rotation_matrix(q):
'''
Convert a quaternion to a rotation matrix
Parameters
----------
q: np.array
Input quaternion
Returns
-------
R: np.array
Rot... |
8055b27e3296256fa9aed215f8a325adc5d4bc07ef5ad23fcf34c1b54fbebac2 | Python | 15,798 | 377 | # coding: utf-8
"""
Alignment module.
"""
from collections import namedtuple
from atropos.align._align import Aligner, MultiAligner, compare_prefixes, locate
from atropos.util import RandomMatchProbability, reverse_complement
# flags for global alignment
# The interpretation of the first flag is:
# An initial portion... |
f6f0e97fea5d860ec6e22190ddf33cc1badd60b5a6ef12e1eb1e824f5d88474a | Python | 15,801 | 331 | from datetime import datetime
from uuid import uuid4
import numpy as np
import pandas as pd
from scipy.spatial.distance import pdist, cdist
from evolutionary_experiment.config import config
from edlib import align
from evolutionary_experiment.logic.ribosomal_autoencoder import RibosomalAutoencoder
def levenshtei... |
ddd98467e9c7dcc4aa3a0ceb999fad200c2f29f299ea1928981a712b5714b604 | Python | 15,811 | 256 | #!/usr/bin/env python
"""
Module to convert DICOMs organised in the sourcefile directory of a BIDS database folder.
WIP: hs_pipeline functions need to be copied here, or reimplemented for users outside of SCAN to use this script
"""
import os
import argparse
import tempfile
from shutil import which, copyfile
import su... |
86fc237dcf7d88f8807cf653ac5497f8a893299710ae2c9efd26d8b5183078ab | Python | 15,823 | 423 | # 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... |
d737d2c0239e0693d992a26e1ee9e56f73dd07e5fa05ff6079e70d9c3677299e | Python | 15,837 | 530 | """
accessor.py contains base classes for implementing accessor properties
that can be mixed into or pinned onto other pandas classes.
"""
from __future__ import annotations
import functools
from typing import (
TYPE_CHECKING,
final,
)
import warnings
from pandas.errors import Pandas4Warning
from pandas.ut... |
7d08c1d6b059a86d8d3fd809831f054566a49cd48f42115e8285d2e76a9ddf79 | Python | 15,849 | 497 | """test get/set & misc"""
from datetime import timedelta
import re
import numpy as np
import pytest
from pandas.errors import IndexingError
import pandas as pd
import pandas._testing as tm
def test_basic_indexing():
s = pd.Series(
np.random.default_rng(2).standard_normal(5), index=["a", "b", "a", "a",... |
985b308ea29317214c8af8a01d377ef74c5087a249a281dd3b713369b54bdc12 | Python | 15,870 | 407 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gs
import matplotlib.ticker as mticker
import pandas as pd
import os
import scipy
from utils import update_plot_defaults, Volatile_Resistor
def generate_Figure2(show=False, save=False):
mm = 1 / 25.4 # millimeters in inches
fig... |
35501cddef0b819e07b52ed763af835e6c8a6e0c5dc0e7c549af24dd3e08cb7b | Python | 15,882 | 406 | import torch
from torchvision import datasets, transforms
from torchvision.transforms import transforms
import torchvision.transforms.functional as TF
from torch.distributions.multivariate_normal import MultivariateNormal
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
import random
imp... |
cd0c9ae1ed392ca0df93e49f0bcb13c0fc538b4dcfc776effb271f0842d3435e | Python | 15,901 | 330 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 9 12:30:56 2023
https://scenicplus.readthedocs.io/en/latest/Scenicplus_step_by_step-RTD.html#6.-Exploring-SCENIC+-results
@author: nrq2
"""
## open eGRNs
import dill
import scanpy
from scenicplus.utils import format_egrns
from scenicplus.eregulon_e... |
922df417b5f1e862b1165c59d2013f3f3465b891849137959566e5329353d349 | Python | 15,906 | 507 | import numpy as np
from mpl_toolkits.mplot3d import axes3d
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
from matplotlib import cm
from matplotlib.colors import Normalize
from scipy.interpolate import interpn
import scipy
import torch
from copy import copy
try:... |
120eab95b7921b3c609c21379183fb28991f6c9d5037e3b631953aa5efb09e58 | Python | 15,912 | 378 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gs
import os
import pickle
from utils import Volatile_Resistor, Memristor, poisson_spike_train, get_scaled_sigmoid, get_BTSP_function, update_plot_defaults
###############################################################################... |
0fdba95a9dbaf5d144bd2a22604da4906f4320d3e5c9c9023ecd8abf3cfdcd12 | Python | 15,917 | 394 | #! /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... |
3db972641af541eb205c10d09f76e51d11e9593fcbfcc25d123f479ff2f537e4 | Python | 15,934 | 368 | # 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... |
e53d8ff70b3cfe84f6579cf42630535bc3f3b858895de42bef703f9b77a6f466 | Python | 15,940 | 442 | # Copyright 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 agre... |
dbeda12c3042ceb024c95e6742206452711e2e2f9201491dff02a432af2ca99a | Python | 15,942 | 367 | # 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... |
460c3684db7c80c76d297d26a09685ddff1b7243bdc57570ac4c500240cd7b0a | Python | 15,948 | 400 | # Rerference 1. Chen, J. et al. The Allen Cell and Structure Segmenter: a new open source toolkit for segmenting 3D intracellular structures in fluorescence microscopy images.
# http://biorxiv.org/lookup/doi/10.1101/491035 (2018) doi:10.1101/491035.
from Environment import *
from scipy.ndimage import gaussian_filter
f... |
9be278ce0a81176fc7ee2abab55132dc88269c52a13094d790c63153efed5286 | Python | 15,960 | 419 | # Copyright 2018-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... |
b9390dfeabc28e796ab76b9ad02e9dbdcfa4f43c81e106aadec447815487bc1e | Python | 15,964 | 366 | # The following implementation is based on the techniques described in:
# "Object Landmark Discovery Through Unsupervised Adaptation" by Enrique Sanchez and Georgios Tzimiropoulos
# You can find the article here: http://papers.nips.cc/paper/9505-object-landmark-discovery-through-unsupervised-adaptation.pdf
#
# For more... |
fe9e41011f9dca1e5c8b468a01282ff94d8ac5c69d808f9a3a9df08d6fc37854 | Python | 15,975 | 525 | """
Wrappers for tools for 3D structure prediction
from evolutionary couplings
Authors:
Thomas A. Hopf
"""
from copy import deepcopy
import os
from os import path
from collections import defaultdict
import re
import pandas as pd
from evcouplings.utils.config import InvalidParameterError
from evcouplings.utils.syst... |
0bde83a31498529c6172ecd0633c5d50a3c2e39527a5d4a8aef3989288ea4727 | Python | 15,976 | 397 | import numpy as np, matplotlib.pyplot as plt, sys
import pumpprobe as pp, wormdatamodel as wormdm, wormbrain as wormb
from scipy import stats
# List of datasets
fname = "/projects/LEIFER/francesco/funatlas_list.txt"
#file = open(fname, "r")
#nr_of_datasets = sum(1 for line in file)
#file.close()
ds_tags = None
ds_ex... |
a47de3e63e9e58cdd704eb9dca79ae46c8d1048105073f03f9f7bb0a0305940e | Python | 15,991 | 515 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.api.indexers import (
BaseIndexer,
FixedForwardWindowIndexer,
)
from pandas.core.indexers.objects import (
ExpandingIndexer,
FixedWindowIndexer,
VariableOffsetWindowIndexer,
)
from pandas.tseries.offsets ... |
4da26e0b9b2dcf7ccc8a955d21a01202d3fc9695db14a5747c1d4faf04f80c4d | Python | 16,008 | 484 | import importlib
import locale
from textwrap import dedent
import numpy as np
import pytest
from pandas.errors import (
PyperclipException,
PyperclipWindowsException,
)
import pandas as pd
import pandas._testing as tm
from pandas.io.clipboard import (
CheckedCall,
_stringifyText,
init_qt_clipboa... |
0e993837588e8e20907ffc1be1115d05a443eb558052fa04da72be6ba7336389 | Python | 16,009 | 309 | # We begin by importing all necessary libraries.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as sts
from sklearn.linear_model import LogisticRegressionCV
from sklearn.model_selection import train_test_split, RepeatedStratifiedKFold
from sklearn.preproc... |
bd158cbd9dc2e01beab052605424d3873e28e50c9abf899a1e98c373e3738711 | Python | 16,020 | 336 | """Factory functions to build data pipeline components from a Hydra config.
Three public functions, typically called in order:
1. :func:`get_imgaug_transform` — builds an imgaug augmentation pipeline from
``cfg.training.imgaug``.
2. :func:`get_dataset` — wraps the labeled CSV data in the appropriate dataset class
... |
72556f3b9960cce97908042614b60dc7574191ec0d759a5a09116e17969fc376 | Python | 16,021 | 418 | # The following implementation is based on the techniques described in:
# "Object Landmark Discovery Through Unsupervised Adaptation" by Enrique Sanchez and Georgios Tzimiropoulos
# You can find the article here: http://papers.nips.cc/paper/9505-object-landmark-discovery-through-unsupervised-adaptation.pdf
#
# For more... |
d05acfb7d2aedf97bc8da484e77944942f2fb9626e6b52f611e7ec74db7faea3 | Python | 16,024 | 371 | import torch
from torch import Tensor
import torch.nn.functional as F
from torch.nn import Sequential, Linear, ReLU, BatchNorm1d
import torch_geometric
from torch_geometric.nn import (
Set2Set,
global_mean_pool,
global_add_pool,
global_max_pool,
MetaLayer,
)
from torch_scatter import scatter_mean, s... |
74b353435d170890f9f2aea75aab0dc52d932bc52b48b9f3d5de0097efadc4fa | Python | 16,025 | 426 | import re
import warnings
import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
class TestSetitemValidation:
def _check_setitem_invalid(self, arr, invalid):
msg = f"Invalid value '{invalid!s}'... |
27ed4b76cdb7e460aeb84f68fc8ab9969d0b6c1e2e9db53231e63822c01d3af8 | Python | 16,030 | 450 | #!/usr/bin/env python3
#
# Copyright 2016 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
bbf85db2508d3e0d087af2494291f8007acdb2075d686006d3f54daf93e582df | Python | 16,033 | 402 | # Copyright 2018-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... |
35d5655c66d29cf6dd60c784d5c0e060af88a628984e553414c3672bdb51f095 | Python | 16,052 | 457 | from datetime import (
UTC,
datetime,
timedelta,
timezone,
)
from dateutil.tz import gettz
import numpy as np
import pytest
from pandas._libs.tslibs import (
OutOfBoundsDatetime,
OutOfBoundsTimedelta,
Timedelta,
Timestamp,
iNaT,
offsets,
to_offset,
)
import pandas._testing... |
1d27e0ea000ea8ce4df98b0a5a8f9c04304a1bdcdfe7c95b1d0d10cc1fd4d259 | Python | 16,059 | 482 | # comparative_visualization.py
from initialization.initialization import *
from initialization.config import *
from data_processing.data_wrangling import *
from data_processing.statistics import *
import numpy as np
import pandas as pd
import os
import scipy
import scipy.stats as st
import seaborn as sns
import ma... |
24c1adb1ee1214899ba70823b320b297e4df0abe0097f1b0617f1da20f2db811 | Python | 16,070 | 504 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# increase the figure size
plt.rcParams["figure.figsize"] = [12, 10]
# remove the top and right spines from plot in the global plt setting
plt.rcParams["axes.spines.top"] = False
plt.rcParams["axes.spines.right"] = False
# change the linewidth o... |
1ccc8786215be26b81754a50aec169eb62b2c330f71ddcb9e5a115ac7e3ecda6 | Python | 16,072 | 410 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestCategoricalOpsWithFactor:
def test_categories_none_comparisons(self):
factor = pd.Categorical(["a", "b", "b", "a", "a", "c", "c", "c"], ordered=True)
tm.assert_categorical_equal(factor, factor)
def te... |
e5459545a3f4a044041bb42d9bffc1967e1196d1aac00a6c84b893872095f513 | Python | 16,086 | 460 | # Copyright 2018-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... |
bfe5b8716d70015e149912294b8b671b7d41813c350d5ad214c105e36da2ae5a | Python | 16,090 | 381 | #!/usr/bin/env python
"""Module Description: Test the cmbreps subcommand
(MACS3/Commands/cmbreps_cmd.py) and its option checks in
MACS3/Utilities/OptValidator.py (opt_validate_cmbreps): combining
replicate score tracks by Fisher's method, max or mean.
Output content is checked in-process (the real argparse parser plu... |
db445011dd03a064a843d21bf3f55070d16370ebf2e0f2b6a66bc4c16d1cfabd | Python | 16,093 | 495 | import numpy as np
import pytest
from pandas.errors import (
Pandas4Warning,
UnsupportedFunctionCall,
)
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
@pytest.fixture(
params=[np.int32, np.int64, np.float32, np.float64, "Int64", "Float64"],
ids=["np.int32"... |
0ce4433ad5bacaa7d0c4e4544812b19fac51d0418610e87a0d3d20adca61e7a8 | Python | 16,094 | 459 | #cleaning_Labeling.py
from initialization.initialization import *
from initialization.config import *
import os
import numpy as np
import pandas as pd
import itertools
from tqdm import tqdm
def clean_comb_df(df_in, deduplicate=True):
'''
A function with steps to clean up the comb_df
to standardize the ... |
a807a42acc6571e5d6fcee0af1d414819261eac39c4795c31c6ef995c6b73dcd | Python | 16,094 | 296 | import numpy as np
import torch, os, argparse, random
from sklearn.metrics import roc_auc_score, average_precision_score
from sklearn.model_selection import train_test_split, StratifiedKFold, StratifiedGroupKFold
basedir = os.path.abspath(os.path.dirname(__file__))
os.chdir(basedir)
torch.backends.cudnn.determin... |
445a87c852123e4aa9a7672b3c2a5e05e82e308a9b9f91b60b371947e065727c | Python | 16,095 | 432 | # Copyright 2018-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... |
55a7d4d0d4aad2b202c20ed45f45a3e562bc1c2217f2343cbfaddf6b77cf9425 | Python | 16,120 | 536 | """Accessors for arrow-backed data."""
from __future__ import annotations
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
TYPE_CHECKING,
cast,
)
from pandas.compat import HAS_PYARROW
from pandas.core.dtypes.common import is_list_like
if HAS_PYARROW:
import pyarrow as pa
im... |
e49bf40a303f92a4fd77f326a1abec3ce34cb9c81343018cab117ca0e68a266f | Python | 16,136 | 494 | # 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... |
7d1eecb9d5f08abf54e4117f3e3a627f8731c0b4a84d5f5ac103a8747f5b0b98 | Python | 16,140 | 503 | # 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... |
3bf31751c230a7812d5f04b3066f4b7720005c315ca1230ba9d6273a9fbf46aa | Python | 16,141 | 447 | from __future__ import annotations
from datetime import (
datetime,
time,
timedelta,
)
from decimal import Decimal
import re
import numpy as np
import pytest
from pandas.core.dtypes.dtypes import (
ArrowDtype,
)
import pandas as pd
import pandas._testing as tm
pa = pytest.importorskip("pyarrow")
f... |
e0f7d7ffc314b5906e14288536484a41a6060d5727df8a9f335727c13cd86700 | Python | 16,142 | 377 | import string
import sys
import numpy as np
import scipy.stats
import pandas as pd
from .plot import plot_irf
from .util import stderr
def read_params(path):
return pd.read_csv(path, sep=' ', index_col=0)
def irf(x, irf_name, irf_params, coefs=None):
if irf_name.lower() == 'exp':
out = np.exp(-x[..... |
57bad03809945202e92a0cc735edb2c485e9fa860dd1345075f72eda19371a8e | Python | 16,170 | 608 | from __future__ import annotations
import importlib
import inspect
import pathlib
import pkgutil
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
from pandas.api import (
executors as api_executors,
extensions as api_extensions,
indexers as api_inde... |
53bcb7ce5c82d17af5dbe1970e960602a844176fda0032ea1fc16ed9d7ff8a83 | Python | 16,178 | 491 | """
Tests column conversion functionality during parsing
for all of the parsers defined in parsers.py
"""
from io import StringIO
from dateutil.parser import parse
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
def test_converters_type_must_be_dict(all_parsers):
parser = all_... |
21f1739e37b05d1bae9097f51279bfa6f3348bfd7aa1e3a1ffe3988f942f8873 | Python | 16,182 | 356 | """Data modules split a dataset into train, val, and test modules.
:class:`BaseDataModule` wraps a labeled dataset and splits it via ``_setup``.
:class:`UnlabeledDataModule` (extends ``BaseDataModule``) additionally builds a DALI video
dataloader for semi-supervised training.
**Split logic** (``BaseDataModule._setup`... |
4e099b406cbd4debf9a0a468d713e53b92de8e4bb17cc284e5fc7ebc1f6202c7 | Python | 16,193 | 407 | import numpy as np
import pandas as pd
from itertools import groupby
from sklearn.cluster import KMeans, AgglomerativeClustering, BisectingKMeans
from sklearn_extra.cluster import KMedoids
from sklearn.mixture import GaussianMixture
def lav_observ(data, method, num_clusters):
"""
Calculate various results and... |
e499892d00a35712722b3a1640b984e7b249b352f447352099f35557fd496ea7 | Python | 16,215 | 415 | from rl_games.common.ivecenv import IVecEnv
from rl_games.common.env_configurations import configurations
from rl_games.common.tr_helpers import dicts_to_dict_with_arrays
import numpy as np
import random
from time import sleep
import torch
def can_concat_infos(env):
"""Return the env's concat_infos declaration.
... |
4e35522e62031c9284b8b98cf5795c0eaa53fc8f7128a3e24527069c474c3b72 | Python | 16,230 | 479 | """
test_indexing tests the following Index methods:
__getitem__
get_loc
get_value
__contains__
take
where
get_indexer
get_indexer_for
slice_locs
asof_locs
The corresponding tests.indexes.[index_type].test_indexing files
contain tests for the corresponding methods specific to th... |
57b3e47a38573c7c713aeaa6fb56619532b279b3d7c687840bdcbbf2de2c5d21 | Python | 16,236 | 501 | #shape_calculations.py
from initialization.initialization import *
from initialization.config import *
from data_processing.data_io import btrack_unpack
# from data_processing.data_io import *
from data_processing.data_wrangling import *
import os
import numpy as np
import pandas as pd
import fnmatch
import h5py
... |
314f5b0e0252a5d81c775299630d9c9136976986b01b3e0d80f8a8f818076a7a | Python | 16,241 | 438 | # Copyright 2018-2020 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.