sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
6031fed12470ff638f67fd536ac12f271262dc060f40d605fc73092d2f4124b8 | Python | 17,623 | 516 | ''' This program will find the representative images in SAGE for imagery in FLEW
'''
import argparse
from datetime import datetime
import json
from os.path import exists
import os
import re
import sys
import time
from types import SimpleNamespace
import colorlog
import requests
import MySQLdb
from pymongo import Mongo... |
61a9f03e2f19070357283aa1b35e2fc3fef341e99017e900fb668817aa7ff1d3 | Python | 17,627 | 424 | # 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... |
0ee29864cb5050a53e953d3aa1837157e8e8445c67dac4e39744b8db9fc7205c | Python | 17,640 | 465 | import math
import time
import warnings
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
def wrap_model_ddp(model, device, find_unused_parameters=False):
"""DDP wrapper for the training forward pass only: gradients are bucket-averaged
across ran... |
5b7622811b165dc320470fe02d430c67c5be8e71e6b22806d3a0d70d6a3becdb | Python | 17,640 | 328 | #!/usr/bin/env python3
# MIT License
#
# Copyright 2026 Broad Institute
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use... |
2dfd3e1db9b91440fd25c697d375033238838330886bc98f456529fa8f57de94 | Python | 17,641 | 303 | # SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
#
# 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... |
13950e3d6101518998f185d33c17c8507667ccce330c4cf743d842240f967e75 | Python | 17,643 | 408 | import numpy as np
import neuron
from neuron import h, gui, load_mechanisms
from CA1_plasticity.model.utils import RecordingVector
from CA1_plasticity.model.utils import Synapse
import sys
class CA1:
def __init__(self, setting):
self.setting = setting
load_mechanisms('./mods/')
h.xopen('./... |
3ab4dfe69e2ba762f2a203872949dc6b3395cdb89c245c8af4514f34cf79b4c7 | Python | 17,656 | 450 | """Aligns and calculates similarity between hmmer3 profiles
Kind of like hhsearch except much slower and for hmmer3 profiles instead of hhsuite profiles.
THIS VERSION USES BACKGROUND FREQUENCIES FROM THE 3Di alphabet
Adapted from pseudocode in:
Steinegger, Martin, Markus Meier, Milot Mirdita, Harald Vöhringer, Ste... |
1370f6d15b3f1ef196896091ffe6316a0d576b250030b18beeac5ebd13c59b5b | Python | 17,659 | 417 | #MIT License
#
#Copyright (c) 2019 Iñigo Prada Luengo
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge,... |
674e1624ff1fe140099e59b89ac0bebe2579d73a12309bb4088c3f93e907997b | Python | 17,668 | 483 | # 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... |
7706b4d394bd8c32087ddd90746955f80fb6f85f0a62b7195a78d0b7596aec09 | Python | 17,669 | 521 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
@pytest.mark.parametrize(
"interpolation", ["linear", "lower", "higher", "nearest", "midpoint"]
)
@pytest.mark.parametrize(
"a_vals,b_vals",
[
# Ints
([1, 2, 3, 4, 5], [5, 4, 3, 2, 1]),
([1, 2, 3, 4]... |
57797ca629308acfd81885cda79a0f6ffeb69247a107a181d706db301f396559 | Python | 17,734 | 451 | import json
import re
import scipy
import numpy
from sklearn import ensemble, svm, neighbors, decomposition
from loess import loess_1d
from matplotlib import pyplot
import matplotlib
import scipy
import pandas
import seaborn
import real_unit_convert
RATE_NAME = "nectar ingestion rate (mL/s)"
SUB_NAME = "proboscis subm... |
9d0bdd9333a741c87a7073ecb856a5722befa0a0de196aedf0138c24230007a2 | Python | 17,743 | 518 | ''' This program will find the representative images in SAGE for imagery in FLEW
'''
import argparse
from datetime import datetime
import json
from os.path import exists
import os
import re
import sys
import time
from types import SimpleNamespace
import colorlog
import requests
import MySQLdb
from pymongo import Mongo... |
8c42bea16e234dda8e72e91cf3880445ad54b4b796620087899030369b7325c2 | Python | 17,747 | 548 | """Data scaling and normalization module for PCNToolkit.
This module provides various scaling implementations for data preprocessing,
including standardization, min-max scaling, robust scaling, and identity scaling.
All scalers implement a common interface defined by the abstract base class Scaler.
The module support... |
46cf16eaf627635b463a753394423765439d4ee2394b45ea672559e682f9e3a6 | Python | 17,760 | 493 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestDataFrameDescribe:
def test_describe_bool_in_mixed_frame(self):
df = pd.DataFrame(
{
"string_data": ["a", "b", "c", "d", "e"],
"bool_data": [True, True, False, False, Fa... |
610bc4774fbb66bebc0704a0f7f8d38f228922f7bcc737b08e54323f92864340 | Python | 17,766 | 518 | ''' This program will find the representative images in SAGE for imagery in FLEW
'''
import argparse
from datetime import datetime
import json
from os.path import exists
import os
import re
import sys
import time
from types import SimpleNamespace
import colorlog
import requests
import MySQLdb
from pymongo import Mongo... |
c073f24f6e404a74a76b0a7822eb131c453f79186cdb0e02f2187fe1a01f7c5b | Python | 17,777 | 431 | import tensorflow as tf
from ...layers import (
dense_attention_layer, embedding_layer,
sequence_attention_layer, contextual_attention_layer,
contextual_attention_matrix_layer
)
from ...hyperparams import ACTIVATION_FN_FACTORY
from ...datasets import assemble_cnv_gep_data
def mca_fn(features, labels, mode... |
31f06cb040fec3bd647813ade1227c8f0cdd150bb9db6ceeaed364597304ffe1 | Python | 17,781 | 506 | from datetime import (
datetime,
timedelta,
)
import numpy as np
import pytest
from pandas._libs.algos import (
Infinity,
NegInfinity,
)
import pandas as pd
import pandas._testing as tm
class TestRank:
s = pd.Series([1, 3, 4, 2, np.nan, 2, 1, 5, np.nan, 3])
df = pd.DataFrame({"A": s, "B": s... |
9df783ab5d17e98e338e257e8cdc089cbaf27af91713f2790cd6b95ff1d8e4c6 | Python | 17,785 | 576 | #!/usr/bin/env python
#
# Copyright 2013 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... |
53b9c825a14f32fddb34c074e7b2b5fea72c5de056fe3e900afa972d76d02bdb | Python | 17,802 | 575 | """Module for designing and applying filters."""
import scipy.signal
import scipy.fftpack
import scipy.interpolate
import numpy as np
import matplotlib.pyplot as plt
class FIR:
"""Finite impulse response filter
Parameters
----------
fir : array
Finite impulse response (FIR) filter
Exampl... |
5125483e89e3bd1fcfce8001ee99d25fef84cecbd6897f9f22f0ab34b24e47f3 | Python | 17,806 | 592 | # -*- coding: utf-8 -*-
"""
This script generates plots for Figure 4, SI Fig 14, and Movie S3
Created on Fri Sep 2 14:03:54 2022
@author: jeanbaptiste
"""
import json
import pickle
import os
import sys
import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import deepcellcontrol a... |
edac4d84e70af2f5611062699cd8171a677882b92e566e8a05b62d095eed1bfe | Python | 17,806 | 350 | # 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... |
a34261c2913dd4c21b4de46d13b4ece6ca2666e63dc675a67683c2b903a2b45b | Python | 17,811 | 581 | """
Module consolidating common testing functions for checking plotting.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
from pandas.core.dtypes.api import is_list_like
import pandas as pd
import pandas._testing as tm
if TYPE_CHECKING:
from collections.abc import Seq... |
4d2d82def32eba3c1e553a09048c88db8f63f48c18536036b870fec497efc0c5 | Python | 17,834 | 393 | from rl_games.common import a2c_common
from rl_games.algos_torch import torch_ext
from rl_games.algos_torch import central_value
from rl_games.common import common_losses
from rl_games.common import datasets
from torch import optim
import importlib
import torch
class A2CAgent(a2c_common.ContinuousA2CBase):
"""C... |
6da51a901a1696fd2f8ab2d4ea62a2584b2c126a71bc1108b076fc67f06f2929 | Python | 17,846 | 513 | # 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... |
5397f2ca7998772269f9dc88a77eabd06d90e02f23784f26f9bba326efd68b21 | Python | 17,855 | 343 | import os
import pickle
import numpy as np
from sklearn.model_selection import KFold
from datetime import datetime
import Load as Load
import Models
import Plot
import Processing
startTime = datetime.now()
# Define Parameters
sesiones = [21, 22, 23, 24, 25, 26, 27, 29, 30]
total_subjects = len(sesione... |
172d94d5b4df2c1d3ec9cff32c80b25ae912b109d218b98e01443f43745b65ed | Python | 17,885 | 504 | from functools import partial
from typing import Any, Callable, Dict, Union
import os
import anndata as an
import numpy as np
import pandas as pd
import pytorch_lightning as pl
import torch
import torch.nn.functional as F
from pytorch_tabnet.tab_network import TabNet
from pytorch_tabnet.utils import create_explain_mat... |
891b030237669e9110db0eac31b3dff111e1cf7651d0e1dce2b2a1f5f42d1f21 | Python | 17,886 | 577 | #!/usr/bin/env python3
"""
Unwanted patterns test cases that are more complex/impossible to validate via regex.
"""
import argparse
import ast
from collections.abc import (
Callable,
Iterable,
)
import re
import sys
import token
import tokenize
from typing import IO
DEPRECATION_WARNINGS_PATTERN = re.compile(
... |
0225968a4217822fe3895fff1caa02159a60ed15883c47f61df6b7cc0cc930fe | Python | 17,897 | 513 | import types
from typing import Dict, Any, Tuple, Callable, Union, cast, Optional, List
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from ..transform import RigidTransform, axisangle2mat, mat_update_resolution
from ..utils import ncc_loss, gaussian_blur, meshgrid, resample
from ... |
1d440556ad1817f64efbc267b0bf6e50d2d1fde282a3747ed59256f7cab62f91 | Python | 17,931 | 552 | """Plotly-native classification diagnostics.
Each function takes a fitted classifier (or ``Pipeline``) plus a holdout
set and returns a ``plotly.graph_objects.Figure``. No file I/O, no
matplotlib — figures travel as JSON to the React dashboard.
Usage::
from pycaret.plots import classification as plots
fig =... |
d4c74efd35f60f57ea6edaba29389ef057879787f24b905bc41eb86edfd2c2a9 | Python | 17,933 | 467 | from torch.linalg import inv
from src.utils import *
class KalmanFilter(nn.Module):
"""Kalman filter
x: observation layer
z: hidden layer
"""
def __init__(self, A, B, C, Q, R, latent_size) -> None:
super().__init__()
self.A = A.clone()
self.B = B.clone()
self.C = ... |
158a2729909a7c0bca52f8f85342cb71181cbc3bb62c586e172450406e3da42c | Python | 17,943 | 384 | import os
from copy import deepcopy
import numpy as np
import h5py
import scipy.linalg as la
import logging
from . import matchingParam
from . import conjugateGradient as cg, kernelFunctions as kfun, pointEvolution as evol, loggingUtils, bfgs
from .pointSets import PointSet
from . import meshes, mesh_distances as msd
f... |
00506bb265475b3697509b65f42e4d92d0aaa433c28638a2aff60dac42d2cadd | Python | 17,947 | 475 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
)
import numpy as np
from pandas._config import using_python_scalars
from pandas._libs.lib import infer_dtype
from pandas._libs.tslibs import iNaT
from pandas.errors import NoBufferPresent
from pandas.util._decorators import cache_r... |
715f45583fb4128fcbe39c3c384089048734f667fdb238d059ee6e5a35b7b15c | Python | 17,951 | 413 | 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,
DiffGroupNorm
)
from torch... |
208ef3cd2c853cc2972c6d549af8a533f620948acaf837d7b44a3893598f4f86 | Python | 17,972 | 407 | import numpy as np
import numpy.linalg as la
import logging
from . import pointEvolution as evol
from .surfaces import Surface, extract_components_
from .curves import Curve
from .curve_distances import measureNorm0, measureNormDef, measureNormGradient
from .curve_distances import currentNorm0, currentNormDef, currentN... |
82302417d37c693539dbc9b74661b96dcfa8aa530d166ad12e67ca70fc6a12b1 | Python | 17,975 | 601 | from datetime import (
datetime,
timedelta,
)
import numpy as np
import pytest
import pandas as pd
class TestSeriesRepr:
def test_multilevel_name_print_0(self):
# GH#55415 None does not get printed, but 0 does
# (matching DataFrame and flat index behavior)
mi = pd.MultiIndex.from... |
f3073479ba63ed53077d52638a6ae9d7e7f2e13c39c48de9199d017b8ea80926 | Python | 17,975 | 422 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 30 23:34:16 2020
@author: vman
"""
import numpy as np
from copy import deepcopy as dcopy
from joblib import Parallel, delayed
import multiprocessing
num_cores = multiprocessing.cpu_count()
from mne.decoding import SlidingEstimator
from scipy.stats ... |
9e8dbba7b22cc74e19ae907d3c25141d418789c8a2b3865f168962a1e5932cae | Python | 17,977 | 399 | # 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... |
14d500be93b3b87b35d95799b726d6d05b30b3d6bcd5b3213b9cdc94b9d7a6b3 | Python | 17,979 | 485 | """Rich-based live progress display for interactive terminals and notebooks.
pyaging's step display is the package's only output channel. At
``verbose=True`` interactive runs (Jupyter or a TTY) get the animated
version: pending steps as hollow circles, the active step as a spinner with
its current stage and progress b... |
127ce47e9b0e6bc25905a8309bf3bbb99a6356640431069bcaab3c1cf853a165 | Python | 17,984 | 668 | """Convenience gate representations for testing"""
import pennylane as qp
from pennylane import math
from pennylane import numpy as np
# ========================================================
# fixed gates
# ========================================================
I = math.eye(2)
# Pauli matrices
X = math.array(... |
c7d32c0b6f01703a175b792857a0b11c332f112b1f82d12f1174bdc718a187cc | Python | 18,008 | 430 | import numpy as np
from model.utils import sampling, kernel
import os
import sys
from hdf5storage import loadmat
from hdf5storage import savemat
from tqdm import tqdm
import scipy
import copy
import time
sys.path.append('data')
from data.DataProcess import process
class OSLMM:
def __init__(self, ... |
6cdfe53305124908e01648e5d3bde0c8d4b8c16d2cba7a35300c3c79ee61cfc3 | Python | 18,027 | 449 | # 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... |
91360a0587e584bf1469dd96ea86042983cacd282b4ef51acaf3f97404c2bada | Python | 18,047 | 518 | # 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... |
a11aac5d2d14116a7ea38e1f66432bafa0e52ed7aaa44ae67d0ec567e1c8705b | Python | 18,049 | 408 | """Linear Operator Matrix class."""
from __future__ import annotations
import operator
from collections.abc import Callable, Iterator, Sequence
from functools import cached_property, reduce
from types import EllipsisType
from typing import cast
import torch
from typing_extensions import Self, Unpack
from mrpro.oper... |
38c4e4679883e24a9c3cad2a65c29161ac8bf3dbdbf1af4a75997565944625d5 | Python | 18,054 | 491 | """
This file contains a minimal set of tests for compliance with the extension
array interface test suite, and should contain no other tests.
The test suite for the full functionality of the array is located in
`pandas/tests/arrays/`.
The tests in this file are inherited from the BaseExtensionTests, and only
minimal ... |
9963ee8809ab7599f3acabc9c5c6e393a9f819d4d4dec2e1125a585b6290eacd | Python | 18,063 | 446 | from copy import deepcopy
from typing import Literal
import pytest
import torch
from mrpro.operators.Functional import ElementaryFunctional, ElementaryProximableFunctional
from mrpro.operators.functionals import MSE, L1Norm, L1NormViewAsReal, L2NormSquared, ZeroFunctional
from mrpro.utils import RandomGenerator
from m... |
a7955f55a5c2e5ecae10e4a2d86e495efbf89f8f6ed8d8e9f19fe9b5459fe23a | Python | 18,063 | 402 | # 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... |
430d9ccf5a0e59cd5fc3ae85c9725e7f6361ccd83a14499b41cf9a45adecd668 | Python | 18,069 | 476 | # 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... |
14db38cbdbf19308e046a2646687e693ebe6ff06c0bd6be86c93fe7f494a06be | Python | 18,072 | 562 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
Any,
Literal,
NamedTuple,
)
import warnings
import matplotlib as mpl
import numpy as np
from pandas._libs import lib
from pandas.util._decorators import cache_readonly
from pandas.util._exceptions import find_stack_level
from pan... |
2d753f29f5047cbd7d97f67f69796cb2f557c2a02bbb1f84f5c9ea88e7274627 | Python | 18,072 | 415 | # 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... |
f80b6666b114e3a05f56b62464463ed7860d5e695a42821281b35f0ce1a26683 | Python | 18,073 | 507 | import torch
from ND_Crossentropy import CrossentropyND, TopKLoss, WeightedCrossEntropyLoss
from torch import nn
from torch.autograd import Variable
from torch import einsum
import numpy as np
def softmax_helper(x):
# copy from: https://github.com/MIC-DKFZ/nnUNet/blob/master/nnunet/utilities/nd_softmax.p... |
113029df0c841250821ee43609a8da35760038ffb0bb9ae54181546460549202 | Python | 18,075 | 514 | """Phase 0-v2 run dispatcher.
Replaces the legacy ``Trial-owns-Run`` dispatcher. Now:
- Compare runs are *decomposed* into N Trial rows + N Trial-Jobs (one
per algorithm). Workers run each ``create_model(model_id)``
independently and stamp their Trial row. The Run's status is
derived from its Trials' statuses.
... |
e593fb5bb7c4bbb2e864f96cbadeca8975c143bd728dc883980159269b67a049 | Python | 18,076 | 300 | """
Advanced network metrics on ConnectivityMatrix (now in `conntility`)
authors: Daniela Egas Santander, Nicolas Ninin, András Ecker
last modified: 01.2023
"""
from tqdm import tqdm
import numpy as np
import pandas as pd
from scipy.stats import binom
from pyitlib import discrete_random_variable as drv
from conntilit... |
c5336af50791ff74ca6fa4fae9f8d09fb687a30e8e3031a6cf175c717c29e86d | Python | 18,080 | 441 | """ Subclasses of the tensorflow.keras.Model class.
These objects should be hidden from the user
"""
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
import tensorflow as tf
import logging
tf.get_logger().setLevel(logging.ERROR)
from apnet.layers import DistanceLayer, FeedForwardLayer, EdgeAttention
#######... |
32418682001b0eb93c8a373b325e242a33d95ce2a4350ed526ec879fb7a61fa6 | Python | 18,094 | 370 | # Copyright 2020 - 2021 MONAI Consortium
# 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 agreed to in wri... |
01781c3b1dfeffb94c102e1e40b1d4df1c69f2c868126f1cf3d1c7f274ff794a | Python | 18,097 | 576 | """
Protocols for matching putatively interacting sequences
in protein complexes to create a concatenated sequence
alignment
Authors:
Anna G. Green
Thomas A. Hopf
"""
from collections import Counter
import numpy as np
import pandas as pd
from evcouplings.couplings.mapping import Segment
from evcouplings.utils.c... |
7bb5ebc6b156cb4e0d1cefc97d83fa5954b0f1600d6b9905359ac23ea0c70e88 | Python | 18,132 | 477 | # 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... |
565a30506b5120c167c74b8ab5ee69aab42af416124e12571c66bfe38395b8c9 | Python | 18,137 | 461 | """Module that contain shard utils for dynamic data."""
import os
from onmt.utils.logging import logger
from onmt.constants import CorpusName
from onmt.transforms import TransformPipe
from onmt.inputters.dataset_base import _dynamic_dict
from torchtext.data import Dataset as TorchtextDataset, \
Example as Torchtext... |
7eff921234e9cc0d5896f074bde569afd5fe38d5726db85f4d52e025cc0efeca | Python | 18,143 | 407 | """
Compare summary statistics from real data with data simulated under the
inferred parameters.
Author: Sara Mathieson, Rebecca Riley
Date: 9/27/22
"""
# python imports
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import numpy as np
import optparse
import seaborn as sns
import sys
sys.path.i... |
07b756665f8f4b6654cd16a6845e417177ba7b4136c23e8d03842bad0cee3720 | Python | 18,154 | 531 | """Tensor reshaping utilities."""
from collections.abc import Sequence
from functools import lru_cache
from math import prod
import einops
import torch
from mrpro.utils.typing import endomorph
def normalize_index(ndim: int, index: int) -> int:
"""Normalize possibly negative index.
Parameters
---------... |
3720968c19548f4e3225d09a80e80a58f1a0e27e25b6a5d7689dbc11b3b9227e | Python | 18,156 | 469 | # 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... |
7b41558d44397314aaea4bb36ec2d4ff099edbb80684a2f19628ecbbf840d200 | Python | 18,160 | 494 | """
This file contains a minimal set of tests for compliance with the extension
array interface test suite, and should contain no other tests.
The test suite for the full functionality of the array is located in
`pandas/tests/arrays/`.
The tests in this file are inherited from the BaseExtensionTests, and only
minimal ... |
4891e9a895013f229ed40e6b42e17aa3c4ccb940da890a0de4ecd8624335c7f0 | Python | 18,175 | 546 | from datetime import datetime
import numpy as np
import pytest
from pandas.errors import Pandas4Warning
from pandas.core.dtypes.common import is_extension_array_dtype
import pandas as pd
import pandas._testing as tm
from pandas.core.groupby.groupby import DataError
from pandas.core.groupby.grouper import Grouper
fr... |
7e9a967e51e87be12bf2b803e54d728231b5c3124b67f6c0bb8dde9369d0b21f | Python | 18,183 | 437 | """SpatialDimension dataclass."""
from __future__ import annotations
from collections.abc import Callable
from typing import Generic, cast, get_args
import numpy as np
import torch
from numpy.typing import ArrayLike
from typing_extensions import Protocol, Self, TypeVar, overload
import mrpro.utils.typing as type_ut... |
67e1ec2b68af57928c363d756ba2ff0a8980d2d5d15f4791d9c2c7fbfabd514f | Python | 18,185 | 492 | # 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... |
222b3f3216ca472d4bf782333fbcbe19c559e4916a86221630388555b02115af | Python | 18,187 | 512 | from datetime import timedelta
import numpy as np
import pytest
from pandas._libs.tslibs import iNaT
from pandas._libs.tslibs.period import IncompatibleFrequency
import pandas as pd
class TestPeriodArithmetic:
def test_add_overflow_raises(self):
# GH#55503
per = pd.Timestamp.max.to_period("ns")... |
c64b2ec5445fdafc4c2265aafb11a2fcdb8d7738ef7ad05fc6d38610ecfd5557 | Python | 18,192 | 592 | # -*- coding: utf-8 -*-
# JN 2015-01-06
# JN 2015-04-13
# state of the project:
# switched to manager_cat, this code is legacy only
"""
manages spikes in h5 files
giving access to clusters, groups etc
"""
from __future__ import print_function, division, absolute_import
import logging
logger = logging.getLogger(__nam... |
193db4484bee27c8a6f979c0b28f23ac530a9dac3bed62011b66364a98419bdc | Python | 18,198 | 487 | """
Module containing tweaks to joblib.hashing to improve
performance.
Changes include:
1. Using the xxhash algorithm by default instead of md5.
2. Using the highest available pickle protocol by default.
3. Using O(1) hashing (https://github.com/joblib/joblib/pull/1011).
4. Special support for pandas/numpy object arra... |
36dbdf9f08e87a959b21bca20acfe7f8d61ae5a241adb3baee3ada4267518932 | Python | 18,204 | 381 | import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import scipy as sp
import seaborn as sns
import sys
paths = [os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))),'src'),
os.path.join(os.p... |
1443cdcdbbe655c029b6ef3258135a9b711e8e62d17e8fb07618160718a9e868 | Python | 18,207 | 320 | # Copyright (c) 2021-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... |
bd7da58239e7bb90a9b3af3a38bbea9b97eee943051ae8e7c7b6e621766b6517 | Python | 18,214 | 464 | # 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... |
3eb9d9418952d801903e2e8700cd7b50af076c1fdc54762d46b7e96b6351de78 | Python | 18,218 | 541 | from datetime import datetime
import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
from pandas.tseries import offsets
@pytest.mark.parametrize(
"compare_func, roll_func, kwargs",
[
[np.mean, "mean", {}],
[np.nansum, "su... |
06bc110f5f38a68f5c3bbf0a468e4ea6b7c511730c96f4686e4851619d729bb6 | Python | 18,228 | 550 | import re
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays import SparseArray
class TestGetitem:
def test_getitem_unused_level_raises(self):
# GH#20410
mi = pd.MultiIndex(
levels=[["a_lot", "onlyone", "notevenone"], [1970, ""]]... |
f9c0bc06b738acaae3bd64d380355da125b67940090b815d1a0e86875fc10247 | Python | 18,230 | 370 | """Indexer class for custom indexing with broadcasting."""
from collections.abc import Sequence
from typing import TypeVar, cast, overload
import torch
import torch.testing
from typing_extensions import Protocol, Self, runtime_checkable
from mrpro.utils.reshape import reduce_view
from mrpro.utils.typing import Torch... |
4aa44abebc26311b6bba4c49046a15e18cb378d8d40d4f95043fde3a3f43daaf | Python | 18,253 | 519 | import gc
import json
import shutil
from abc import ABC, abstractmethod
from itertools import chain
import numpy as np
import torch
import torch.nn as nn
from sklearn.metrics import accuracy_score, f1_score
from torch.nn.functional import softmax
from tqdm.autonotebook import tqdm
class BaseModelClass(nn.Module, ABC... |
7f4f7aaf780e8c3bc8d2326ff7898a2726b5b98af4cf1b350aad4003690eb5d5 | Python | 18,253 | 506 | import csv
import time
import argparse
import os
import re
from time import strftime
import numpy as np
from nibabel import load as load_nii
import torch
from torch.utils.data import DataLoader
from utils import color_codes, get_dirs, get_int
from utils import get_mask, get_normalised_image
from utils import time_to_st... |
314db092700d9ad6d06920aa3ebeb3fcec33ff6ea0f25ed12108eae8ca8a55e9 | Python | 18,269 | 549 | import numpy as np
import pytest
from pandas.core.dtypes.common import is_hashable
import pandas as pd
import pandas._testing as tm
class BaseSetitemTests:
@pytest.fixture(
params=[
lambda x: x.index,
lambda x: list(x.index),
lambda x: slice(None),
lambda ... |
21471cb6a58cc01e7cdcc29af1254a15f4df4b8a25b788ec71655a7cc6c69f72 | Python | 18,271 | 484 | #!/usr/bin/env python
import os
import argparse
import numpy as np
import scanpy as sc
import pandas as pd
from mudata import MuData
parser = argparse.ArgumentParser(description="Parameters for summary process")
parser.add_argument(
"--demuxlet", help="Folder containing output files of Demuxlet", default=None
)
p... |
76ee69b3afb88ecdff05bf84be786a50cb8b2d989486c6753bcb83981cce7de4 | Python | 18,276 | 536 | from __future__ import print_function
import os
import yaml
class WindseerParams(object):
'''
Class handling and loading the parameter for windseer
from a yaml file.
'''
def __init__(self, yaml_config, verbose=True):
'''
Parameters
----------
yaml_config : str
... |
75257335d125b3c2517cfae4f6f6bd262687869dae9ea9c4151e35a0324338a6 | Python | 18,278 | 493 | """Age-to-age z-score correlation matrices for longitudinal scores."""
from __future__ import annotations
import pickle
import re
import warnings
from pathlib import Path
from typing import TYPE_CHECKING, Any
import numpy as np
import pandas as pd
import xarray as xr
from pcntoolkit.math_functions.velocity import c... |
694ef7b6dc6e2dd9e23d2b38877f847451caeb569491278b540eaa61f2e6067e | Python | 18,281 | 466 | #objects.py
import numpy as np
import copy
from placerg.funcs import *
#from placerg.funcsrg import *
import placerg._dice6 as _dice6
from scipy import sparse
import h5py
import os
def avalanche_runsim(N0, N, loop, xmax, dt, nstim, percell, \
npprob, vj, sj, \
timeconst, phi, eta... |
d1685c6bd2124f3280260fbb46a3ecd19aa7d30392b8c918388ef856ed8510e5 | Python | 18,287 | 515 | # 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... |
476f1b8248b239c0cd9a94e42ff0b04da88f0533f591e186c44f82f55d0de108 | Python | 18,293 | 457 | """
This includes: LossComputeBase and the standard NMTLossCompute, and
sharded loss compute stuff.
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import onmt
from onmt.modules.sparse_losses import SparsemaxLoss
from onmt.modules.sparse_activations import LogSparsemax
from onmt.c... |
a5cd039191918f31b1441a0038b0caad61468325cae1178d9ce06aaf9bbd0f08 | Python | 18,294 | 360 | import numpy as np
import dgl
from dgl.nn.functional import edge_softmax
import dgl.function as fn
import torch
import torch.nn as nn
import torch.nn.functional as F
from dgllife.model.readout import WeightedSumAndMax
__all__ = ['HGNNLayer','MyGNN', 'MyPredictor']
class HGNNLayer(nn.Module):
def __init__(self,
... |
61d4f89fbf4ac6954a0ed97389299133bc50e4bafa1f8324cf850f9940861d4e | Python | 18,307 | 506 | # 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... |
7375927372dfa94500e8b727ceb4384fc61a23afe74a20be5ce44b4e438a3a6b | Python | 18,307 | 492 | # 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... |
95c0bfdc23b9f48f3742ab26a65f41a94633e2ec88d71db725b00e2aafe780fe | Python | 18,312 | 464 | import sys, os
import math
import time
import numpy as np
from pathlib import Path
ROOT_DIR = Path(__file__).parent
import tensorflow as tf
from apnet.keras_atom_model import KerasAtomModel
from apnet import constants
class AtomDataLoader:
""" todo """
def __init__(self, molecules, multipoles, r_cut):
... |
c018cbd5f9ec6c90c4ca992df15453e70ad23ed0279a13f7d05f510023269f38 | Python | 18,313 | 501 | # 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... |
34972d53259044f1187943fe57c9a6c33e33e391a4e5cea59869f1e9c574961b | Python | 18,315 | 412 | import pickle
import re
from pathlib import Path
import numpy as np
import pandas as pd
from keras import backend as K, Input, Model
from keras.layers import Dense, Reshape, Activation
from sqlalchemy import create_engine
from tqdm.auto import tqdm
from pygments import highlight
from pygments.lexers import PythonLexer... |
7d200f97ad6ce2104ce4e213df820f1bd59430f36e873b7ab5b98abee2acd23d | Python | 18,325 | 520 | from copy import (
copy,
deepcopy,
)
import re
import numpy as np
import pytest
from pandas.errors import Pandas4Warning
from pandas.core.dtypes.common import is_scalar
import pandas as pd
import pandas._testing as tm
# ----------------------------------------------------------------------
# Generic types ... |
6574b3fb91c7330cd57d4b03b9920096468565440432fc0275a56059aa623f8b | Python | 18,335 | 384 | #!/usr/bin/env python
import sys
import argparse
from argparse import RawTextHelpFormatter
###################################################
### 0. script description and parsing arguments ###
###################################################
synopsis1 = "\
- identifies co-linear (CL) relationship between two ... |
8376dabf88d7bcfbb18aeeb0c0baba168201c0136a5ecd78c0319a1006a53010 | Python | 18,356 | 471 | """Tests for EPG signal models."""
from collections.abc import Sequence
from typing import Literal
import pytest
import torch
from mrpro.operators.models.EPG import (
AcquisitionBlock,
DelayBlock,
EPGSequence,
FispBlock,
GradientDephasingBlock,
InversionBlock,
Parameters,
RFBlock,
... |
3d57e92d00b1666f613f460415439a678eeea8b5ea924a4cf9cf49a66d82a000 | Python | 18,369 | 503 | # 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... |
0e5ff1b59e884a0ea7faecab72e6c4533aab3d7c7b9dded062077b656761858c | Python | 18,375 | 442 | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 1 12:08:06 2024
Refiner module to correct the tracking results from sctrack. This
module will help fix the tracking error caused by sctrack due to occasional
false segmentations and miss assignments of cell tracking events.
@author: KuanY
"""
import ast # to con... |
f38c916f631223b0c93fd5560c8f94085b9d0c8f06fa9e847c701a0ebf604bb9 | Python | 18,400 | 450 | # 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... |
a79f0b39e9b8fb0480d69a906a3b425e3b6bbd6188686656409c210a14d8a7bf | Python | 18,414 | 518 | import numpy as np
import pytest
from pandas._libs import lib
from pandas._libs.tslibs import (
NaT,
OutOfBoundsDatetime,
Timedelta,
Timestamp,
iNaT,
to_offset,
)
from pandas._libs.tslibs.dtypes import NpyDatetimeUnit
from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG
import pandas._t... |
4f7aecb728ce6e176d7af04778bd2c7fe76b1af045b0129a897240c9b585041b | Python | 18,422 | 524 | """
Top level ``eval`` module.
"""
from __future__ import annotations
import tokenize
from typing import (
TYPE_CHECKING,
Any,
)
import warnings
from pandas._config.config import _global_config as config
from pandas._libs import lib
from pandas.errors import Pandas4Warning
from pandas.util._decorators impor... |
181d83c863813a2c266f129761cdc418282c36e761c8a86357019b8072d04ead | Python | 18,432 | 593 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Function
import torchvision.models as tvm
from typing import Tuple, Optional
# modified from https://github.com/jadore801120/attention-is-all-you-need-pytorch
class MultiHeadAttention(nn.Module):
"""Multi-Head Attention m... |
0ce500feb34e07984e8ab08c44fed8e53c219617eb7fc6126696aa48f4ffcb66 | Python | 18,437 | 451 | """Bounding-box coordinate transformation utilities.
Three coordinate spaces are used throughout this module:
- **frame**: absolute pixel position in the original full-resolution camera frame.
- **norm**: [0, 1] coordinates normalised relative to the bounding box
(top-left corner of bbox = (0, 0), bottom-right = (1... |
5a5ce7f8b7ef2d85af9bd59fe4f775d813e35e4ace34b038f37c234be61e40ba | Python | 18,439 | 504 | # 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... |
9e122173061360b3b30c23a4740628bde22d5464bc6a7bd3a04cf37db6253a8e | Python | 18,448 | 543 | from pathlib import Path
import pandas as pd
import seaborn as sns
from scipy.stats import zscore, spearmanr
from repo2data.repo2data import Repo2Data
from fmriprep_denoise.features import (
partial_correlation,
significant_level,
calculate_median_absolute,
get_atlas_pairwise_distance,
)
from fmripre... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.