sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
79b72b0e522e1dac663ccc12307e723c5eca4811893d87c6ee7ab88873958beb | Python | 18,457 | 473 | #!/usr/bin/env python3
import json
import pathlib
import os
import sys
import re
import nibabel as nib
import utils
def _resolve(p):
if isinstance(p, str):
return os.path.realpath(os.path.expandvars(os.path.expanduser(p)))
return p
with open('config.json') as f:
config = json.load(f)
if not "_i... |
13650dbcb45cb27a9ed630949f0f60629c99e2d18391967601a02a0159319c12 | Python | 18,461 | 408 | import random
class Annotation():
"""
Representation of a label
Contains a list of peaks which have been assigned a specific label
"""
# Annotation counter to automatically assign annotation ids
annotation_counter = 0
def __init__(self, label):
self.id = Annotation.annotation_c... |
ef6630c72ef855ba40c219bf74b26a728543b2350354e948e6d552697c05e4ed | Python | 18,467 | 372 | # IMPORTS
import pprint
import torch
import numpy as np
from tqdm import tqdm
import math
import time
import os
import pandas as pd
from collections import defaultdict
import wandb
from VINNA.models.networks import build_model
from VINNA.models.optimizer import get_optimizer
from VINNA.models.losses import get_loss_f... |
2d8b1e5d9b555a9423d66897c253d911336a8136016d47c05f2f5efa35aa0e59 | Python | 18,470 | 341 | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 19 10:31:16 2023
@author: lonya
"""
#%% preset
import tkinter as tk
import tkinter.filedialog as fd
import pickle
import os
import matplotlib.pyplot as plt
import pandas as pd
import my_funcs as mf
import numpy as np
import seaborn as sns
#%% Load single limb gaits in l... |
4090f23ff87012744855b5b4434f2353f0299c0132f8f5c89a8ed00947cecdbe | Python | 18,473 | 465 | # 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... |
59bfc79fe90e547150938600e766e65f0d3d1bcfcc236121ca5c80f598e9e3e4 | Python | 18,473 | 570 | import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
from torch.nn.modules.activation import ReLU
from torch.nn.modules.batchnorm import BatchNorm3d
from torch.nn.modules.container import ModuleList
BN_MOMENTUM = 0.2
class PlaceHolder(nn.Module):
def __init__(self):
... |
e9bd07e9637008b012ac84bbb6587150c32feb8dfc139b6f9e5c60ad68252bc6 | Python | 18,475 | 471 | import contextlib
import uuid
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.io.excel import ExcelWriter
from pandas.io.formats.excel import ExcelFormatter
pytest.importorskip("jinja2")
# jinja2 is currently required for Styler.__init__(). Technically Styler.to_excel
#... |
c64c0ca36c3f9699b01ca5b4a04237d856bae6e42da3af2304e0ba32db9fe614 | Python | 18,477 | 559 | # 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... |
5cf54ac5d52dabbbd4784ccf9f86a1fd0c4a76db8900187ba5139a6e00e181c4 | Python | 18,480 | 454 | # 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... |
17dd34d09728d924596a2cb6df628e28babb40f19aa700217bb6228c021cfc18 | Python | 18,486 | 634 | import argparse
import os
import sys
import yaml
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
from datetime import datetime
fr... |
42b6388008d580e05ee00ef151d8ace40baa69408bea54aab5c76f87c522ffde | Python | 18,497 | 397 | # 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... |
57e3457df3ccd0738be41792b4c62e92b654797354e65734b3d9df4b35b77bdc | Python | 18,503 | 634 | import argparse
import os
import sys
import yaml
import torch
from sklearn.model_selection import train_test_split as split
from roost.roost.data_pretrain_fl_mml import CompositionData, collate_batch
from roost.roost.model_pretrain_fl_mml import Roost
from roost.utils_pretrain_fl_mml import train_ensemble
from dateti... |
09aa609fc346407417f90e860d5783833f4d0f0c05210b328b54e6f4b2d9b8da | Python | 18,511 | 481 | """Kernel transformers for CBMA algorithms.
Methods for estimating thresholded cluster maps from neuroimaging contrasts
(Contrasts) from sets of foci and optional additional information (e.g., sample
size and test statistic values).
"""
from __future__ import division
import logging
import os
import warnings
from has... |
b3ec1eeb3d57f9c00ccbb9f33d5cebb0d474acf33590550c9e98ff2018cec58d | Python | 18,513 | 586 | # Disable type checking for this module since numba's internals
# are not typed, and we use numba's internals via its extension API
# mypy: ignore-errors
"""
Utility classes/functions to let numba recognize
pandas Index/Series/DataFrame
Mostly vendored from https://github.com/numba/numba/blob/main/numba/tests/pdlike_u... |
ed17b24d00de5824cf279e47def22b25f9d58b2d90cb1fb336ce200154643f4c | Python | 18,522 | 546 | import time
import argparse
import logging
import re
import os
import torch
from typing import List, Optional, Tuple, Dict, Any, cast
from ..image import Stack, Slice, Volume
from ..svort.inference import svort_predict
from ..inr.train import train
from ..inr.models import INR
from ..inr.sample import sample_volume, sa... |
ee564ec8651c439b5653de231624f3cf51571591ce5a532504dfb73f7ca78c6f | Python | 18,525 | 481 | """Tests the base Dataclass."""
from dataclasses import field
import einops
import pytest
import torch
from mrpro.data import Dataclass, Rotation, SpatialDimension
from mrpro.utils import RandomGenerator
from typing_extensions import Any
class SharedModule(torch.nn.Module):
"""A module with two submodules that ... |
c59f0aa241010e0a45159792324ed46cfe9bc73b098eb0ae936d11df98c1b7fe | Python | 18,527 | 486 | # 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... |
413ce467e45645a972bb3684aed1df8611225c5ab2c468e85de383920bc3ef18 | Python | 18,541 | 679 | from __future__ import annotations
from concurrent.futures import ThreadPoolExecutor
from decimal import Decimal
import operator
import os
from sys import byteorder
import threading
from typing import (
TYPE_CHECKING,
Any,
)
import numpy as np
from pandas._config import using_string_dtype
from pandas._config... |
de88d8f91d15c12797197977a507a315c233f4af0d7f3c2ac3f472a27dcbfdae | Python | 18,546 | 386 | # 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... |
08edac0fe1c3ca8b94378f3c9e9f7fb814861be626a02fa2ac28d2d542900651 | Python | 18,554 | 562 | # Copyright (c) 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 conditions ... |
51f9730019fd94e19372b01b1090f602d6f01b0b96cf01e77fb33eef6ba9a00e | Python | 18,554 | 449 | #!/usr/bin/env python
# encoding: utf-8
import os
import unittest
import numpy as np
from kcsd import sKCSDcell, sample_data_path
from kcsd.sKCSD_utils import LoadData
try:
basestring
except NameError:
basestring = str
def in_between(a,b):
return a+(b-a)/2
class testsKCDcell(unittest.TestCase):
... |
54260e0934a38ebab2c9a187fa7c77c4ad0c84cbdde9c5a36d736dfbc08f8174 | Python | 18,556 | 342 | # 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... |
46b71c5315cbf55314c948a250e2e02b31c452da7d160b68b383a0d9633faa7e | Python | 18,563 | 480 | # 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... |
495f326c88864f2ae131db564fac2696d59973d79c097d9b314801f42ebb95e3 | Python | 18,577 | 510 | import re
import numpy as np
import pytest
from pandas._libs.tslibs import Timestamp
import pandas as pd
import pandas._testing as tm
from pandas.util import _test_decorators as td
pytestmark = [pytest.mark.single_cpu]
def test_format_type(temp_hdfstore):
df = pd.DataFrame({"A": [1, 2]})
temp_hdfstore.put... |
8158e2602fcb67328de39f37acf0374f320b170c642ccf991a94a6bcde73e38f | Python | 18,579 | 391 | # 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, copy, modify, merge, ... |
aac32862ab77c433d0461ea81d6f49d18726a5845eb3054eab5df1293532b1d5 | Python | 18,584 | 403 | #! /usr/bin/env python
from treeshrink.sequence_lib import sample_from_list
from treeshrink.threshold_lib import threshold_l_kernel, threshold_loglnorm
import treeshrink
from treeshrink.optimal_filter_lib import TreeFilter
from treeshrink.tree_lib import prune_tree, get_taxa,tree_as_newick
from sys import argv, stdout... |
2e3d001dbba654a9699f1ba23089966a55b5ba1b4690cf6019f2e12064516b76 | Python | 18,585 | 502 | #!/usr/bin/env python3
# script to update checkpoint directories for scpca-nf for version 0.4
# copies files to new checkpoint directory location and
# adds scpca-metadata.json files as needed
import argparse
import json
import subprocess
import boto3
import pandas
# Functions #
def get_barcode(tech, barcode_dir)... |
c3dfab0c1b6f63b0de53ffa5c78016b8c1602be92410485d5204ba4a60379694 | Python | 18,594 | 455 | import torch
import torch.optim as optim
import torch.utils.data
import torch.nn.functional as F
from torch.nn.utils import clip_grad_norm_
import numpy as np
import collections
import pickle as pkl
from pprint import pprint
from sklearn.metrics import confusion_matrix, roc_auc_score
class DualBranchDATrainer(object)... |
54cd629a3696a7933db32aeb323c342e0fb3a6c4d71526a2a22b403d1f1d17c3 | Python | 18,595 | 551 | import re, os, sys, argparse
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'resource-gcg', 'scripts'))
import tree
argparser = argparse.ArgumentParser(description='''
Calculates Dependency Locality Theory integration cost values by word (along with some other useful fields).
Integration cost is ... |
70695aaeb80caeac4939cf308974db0e57bad1a10114f5553463b54569098575 | Python | 18,605 | 430 | #Basics
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
import sys
import os
import csv
import time
import random
import pandas as pd
import scipy
import scipy.stats as stats
from scipy.stats import shapiro,normaltest,kstest,uniform
import seaborn as sns
import matplotlib.colors as colors
sys.path.... |
bd0b113eaeee6cdb8b22a06331ecbd61f96ce17c627100a53c540fd621ced31f | Python | 18,623 | 368 | # Time-stamp: <2024-10-11 10:28:07 Tao Liu>
"""Description: Call variants directly
Copyright (c) 2017-2023 Tao Liu <vladimir.liu@gmail.com>
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).
@status: release ... |
271d95b39ac5c69b82611868e1128c76bd6768e6e7ab7e2fc0eac56842da3087 | Python | 18,634 | 507 | import collections
import operator
import sys
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tests.extension import base
from pandas.tests.extension.json.array import (
JSONArray,
JSONDtype,
make_data,
)
# We intentionally don't run base.BaseSetitemTests bec... |
4132d70e13ad23268edb079bc2665e68c76312bb1efe36f2f14ddea3101264d7 | Python | 18,648 | 416 | #!/usr/bin/env python
"""Module Description: Test the bdgbroadcall subcommand
(MACS3/Commands/bdgbroadcall_cmd.py): two-level (nested) broad peak
calling on a bedGraph score track, written as gappedPeak lines.
Output content is checked in-process (the real argparse parser plus
``run``) on a tiny bedGraph whose expect... |
6c1f319c7e3b8bc94c798bd1b4c54598fdee7b33c99507155374a493f78de5b8 | Python | 18,673 | 552 | """
Collection of tests asserting things that should be true for
any index subclass except for MultiIndex. Makes use of the `index_flat`
fixture defined in pandas/conftest.py.
"""
from copy import (
copy,
deepcopy,
)
import re
import numpy as np
import pytest
from pandas.compat import IS64
from pandas.errors... |
529b506c3e3be55353cc21f66adb37503e919ea187b9b5efdff698b552fdd437 | Python | 18,679 | 515 | __all__ = ["TrainerBase"]
import abc
import os
from logging import Logger
from typing import (
Any,
Callable,
Dict,
Generic,
List,
Mapping,
Optional,
Sequence,
Sized,
TypeVar,
Union,
)
import torch
from torch.optim.lr_scheduler import (
_LRScheduler,
SequentialLR,
... |
482a0bf63ede214012d8e8d0ce9e74ccc2f90bbb5d3fea202b97560bd6a98c0d | Python | 18,684 | 433 | # 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... |
cf54c2bfff7e2cf06990d7ee4046f5aaa5e9f444111fab491001d32a78fc5ef2 | Python | 18,723 | 485 | # 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... |
73b5d3e7e0dead15566816a09d32b1b8f37ca670b05f8f909f22607d7b95967e | Python | 18,726 | 445 | # 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... |
5ec507c4430830a526fe8fcd4554e10c7a2f2a8595ad28eaf1ec3e89d131261c | Python | 18,738 | 510 | import collections
import operator
import sys
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tests.extension import base
from pandas.tests.extension.json.array import (
JSONArray,
JSONDtype,
make_data,
)
# We intentionally don't run base.BaseSetitemTests bec... |
7affc9e0bf7680c60126a5666251ed61f13400aec83b69258461afefec08d799 | Python | 18,738 | 694 | from __future__ import print_function
import json
import os
import re
import shutil
import subprocess
import sys
import tempfile
import nibabel as nib
import numpy as np
import pandas as pd
from pcntoolkit.util.output import Errors, Messages, Output
path = os.path.abspath(os.path.dirname(__file__))
path = os.path.d... |
900e0803db11e2492a64ae65a57ed6057a50fe218817a7c90943091a27829ed3 | Python | 18,739 | 352 |
"""
module containing functions for calculating the choice probability of recorded neurons
1/19/2018
Eric Finkel
"""
import time
import math
import scipy as sp
import scipy.io
import scipy.stats
import os
import numpy as np
import pandas as pd
import glob
import csv
import random as rand
from sklearn.metrics import ro... |
16da8ea2384064677fbe4b0527768e67d698fc860351932bf2500adf5ddc642e | Python | 18,754 | 582 | import numpy as np
import scipy.linalg as la
from sklearn.cross_decomposition import CCA
from sklearn.metrics import accuracy_score
from scipy import stats, signal
import math
from statsmodels.stats.weightstats import ttest_ind
class TRCA():
def __init__(self, n_components=1, n_band=1, montage=40, win... |
4beec30be11f8cc8c46c31babcd41ea9bc9d5e89620323939b0694a07cbcb09b | Python | 18,768 | 534 | import re
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
@pytest.fixture
def df():
return pd.DataFrame(
{
"a": [1, 2, 3],
"b": [4.0, 5.0, 6.0],
"c": ["x", "y", "z"],
}
)
@pytest.fixture
def mi_df():
return pd.DataFr... |
8ce48852418622ebb9de94f583e72b6ff582d7e697d79aac66dc2b080c64695a | Python | 18,771 | 549 | import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
class TestFloatNumericIndex:
@pytest.fixture(params=[np.float64, np.float32])
def dtype(self, request):
return request.param
@pytest.fixture
def mixed_index(self, dtype... |
1ece5044d5929500a9e558d701a81b5b6f9c63f301036d8f374c765302a90e99 | Python | 18,773 | 583 | import numpy as np
import scipy.linalg as la
from sklearn.cross_decomposition import CCA
from sklearn.metrics import accuracy_score
from scipy import stats, signal
import math
from statsmodels.stats.weightstats import ttest_ind
class TRCA():
def __init__(self, n_components=1, n_band=1, montage=40, win... |
76de2f34c1b35f4037da3da95326488490b74c0c0d7a983b1a4e5a7b367fb067 | Python | 18,780 | 463 | from spycon.spycon_inference import SpikeConnectivityInference
from spycon.spycon_tests import load_test
from torch import nn
import torch
from torch.utils.data import DataLoader
from tqdm import tqdm
import numpy, pandas
import pickle
import spycon
device = "cuda" if torch.cuda.is_available() else "cpu"
print("Using ... |
5b06ddb3fbe2c67f4eb27d05014a5f0b5aedbe225d2b5b41947b2843aef88685 | Python | 18,791 | 515 | # -*- coding: utf-8 -*-
import os
import codecs
import math
from collections import Counter, defaultdict, OrderedDict
import torch
from torchtext.data import Field, RawField, LabelField
from torchtext.vocab import Vocab
from onmt.constants import DefaultTokens, ModelTask
from onmt.inputters.text_dataset import text_... |
5bc105bc7fa7c54922d8c34ebc8bcc845229d11fe4fe6d91f1b8e62e758ddaa3 | Python | 18,801 | 528 | # 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... |
5d5ce761cda2999b81e03042c5a61d39816fe5bc07b0eeab5d3fa74e36299898 | Python | 18,801 | 508 | import copy
import h5py
from itertools import compress
import numpy as np
from scipy.interpolate import RegularGridInterpolator
import torch
try:
import GPy
gpy_available = True
except ImportError:
print('GPy could not get imported, GPR baseline not available')
gpy_available = False
import windseer.da... |
1eb7d5c810b9bf64e404e951d2055bba8f8293ce5b425e2d821fcb866e78b66b | Python | 18,814 | 494 | import array
import multiprocessing
import queue
from hashlib import sha256
from typing import Any, Dict, List, Optional
import ngs_tools as ngs
import numpy as np
import pysam
from tqdm import tqdm
from typing_extensions import Literal
from .. import config, utils
from ..logging import logger
from . import bam
BASE... |
533d82d543135e34ac9e2075a24fd8b393dd4e8aabbdce4705fcef59e7a771cc | Python | 18,814 | 528 | ''' load_codex_to_mongo.py
This program will update emBody and emDataSet in MongoDB as well as the versioned published
table in DynamoDB from Codex data
Codex files used:
classification.csv (FAFB only)
neurons.csv
(https://codex.flywire.ai/api/download?dataset=banc)
(https://codex.flywir... |
8b8551118519c32defb8a28d318925ee5d01b73eaee257dc05bb35d8604c65d0 | Python | 18,832 | 528 | """Utilities for coordinate-based meta-analysis estimators."""
import logging
import os
import nibabel as nib
import numpy as np
import numpy.linalg as npl
import sparse
from scipy import ndimage
from nimare import references
from nimare.due import due
from nimare.extract import download_peaks2maps_model
os.environ[... |
022befc34d1bb0289773f2c6b91402da0ace33358953e1808cc3987e873ba82e | Python | 18,834 | 554 | # 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... |
69d1330740eac82370a537eb33e3723ccd1ba2887db39bb3d1932d3be9a57ee2 | Python | 18,846 | 685 | from __future__ import annotations
from concurrent.futures import ThreadPoolExecutor
from decimal import Decimal
import operator
import os
from sys import byteorder
import threading
from typing import (
TYPE_CHECKING,
Any,
)
import numpy as np
from pandas._config import using_string_dtype
from pandas._config... |
81b3e03bee8201f134ad420df7c9cf9067c6eca2ceaeedc2884e1e0cc9bedeb6 | Python | 18,856 | 561 | import logging
import time
import math
from typing import List, Tuple, Optional, cast
import numpy as np
import torch
import torch.nn.functional as F
from ..svr.registration import stack_registration
from ..svr.reconstruction import SRR_CG, simulate_slices
from . import SVoRT, SVoRTv2
from ..transform import RigidTrans... |
1fa2e945e015739018a29f7b07a0fbdb102c200ada9d2727e82d4ab1226a5c46 | Python | 18,857 | 418 | """
Assembly detection related utility functions (mostly loading simulation related stuff)
author: András Ecker, last update: 06.2023
"""
import os
import json
import h5py
import warnings
from collections import namedtuple
import numpy as np
import pandas as pd
from libsonata import EdgeStorage
from bluepysnap import ... |
607996bdae191b2fd6e1b9f239b424ffb414e507e2fefdc211145777b8b98bcd | Python | 18,859 | 562 | 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... |
3d71826a72b45311532dab2ee888e87e1445c76b5f5585de4995743940e8e3f5 | Python | 18,872 | 466 | import os
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch_geometric.nn as pyg_nn
from torch_geometric.data import DataLoader
import torch.optim as optim
from torch.utils.data.sampler import WeightedRandomSampler
import copy
import random
import heapq
import re
import ... |
bb46502ff25b9d1764048d8c13300894491cf13f666a685e52cbb138513b14ed | Python | 18,879 | 517 | from datetime import (
datetime,
timedelta,
)
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestRangeIndexSetOps:
@pytest.mark.parametrize("dtype", [None, "int64", "uint64"])
def test_intersection_mismatched_dtype(self, dtype):
# check that we cast t... |
ae98ec1bccb987f000b243cec5828f6d18f232549452bbf6301b30464ae899ee | Python | 18,880 | 505 | ''' update_dynamodb_published_versioned.py
Update a janelia-neuronbridge-published-* DynamoDB table.
'''
import argparse
from datetime import datetime
from operator import attrgetter
import re
import sys
import time
import boto3
import inquirer
import MySQLdb
from tqdm import tqdm
import jrc_common.jrc_common as J... |
72d7c3e2c057345eb031e7d9d9c9124e9eeda0cd280d9c1b46b3ad34326b285c | Python | 18,881 | 683 | # Natural Language Toolkit: TextGrid analysis
#
# Copyright (C) 2001-2011 NLTK Project
# Author: Margaret Mitchell <itallow@gmail.com>
# Steven Bird <sb@csse.unimelb.edu.au> (revisions)
# URL: <http://www.nltk.org>
# For license information, see LICENSE.TXT
#
"""
Tools for reading TextGrid files, the format us... |
1769b1c293400a2e6981406d68190d2cf8f6c3bfa52291a00f61ebbbcb097891 | Python | 18,892 | 541 | """
Tests for Timestamp parsing, aimed at pandas/_libs/tslibs/parsing.pyx
"""
from datetime import (
UTC,
datetime,
)
import locale
import re
from dateutil.parser import parse as du_parse
import numpy as np
import pytest
from pandas._libs.tslibs import (
parsing,
strptime,
)
from pandas._libs.tslibs.... |
f15fac5b58a3782c4f220116cc757b814125dc4ceba46630bec7936291786663 | Python | 18,907 | 554 | # 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... |
d9ae6b842725a0030027b8f39ae674251437c369f43f3f2d6edee8f8e229c8ab | Python | 18,915 | 408 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet):
# ----------------------------------------------------------------------------------------------... |
c46322e5a216a6524968f47a9077c99e8a63ec982689d6fe936c50617f975104 | Python | 18,926 | 591 | """Classes and methods to support parallelization of operations.
"""
import inspect
import logging
from multiprocessing import Process, Value, Queue
import os
from queue import Empty, Full
import sys
import time
from atropos import AtroposError
from atropos.util import run_interruptible
RETRY_INTERVAL = 5
"""Max time ... |
874718f0bb3755968b56fc4ecb83e7a45966eb31441a547fdd7c04c701dd2bb7 | Python | 18,947 | 556 | # 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... |
d769032ae77c803fadf71fe13f7c75ae4d16697eeb3ed22b3152c3a250b92d38 | Python | 18,961 | 429 | import datetime as dt
import os
from typing import Dict, List, Optional, Union
import pandas as pd
import pystan
from typing_extensions import Literal
from . import config, constants, estimation, preprocessing, utils
from .logging import logger
from .stats import Stats
@logger.namespaced('estimate')
def estimate(
... |
c78967001a25a04a50820251572e4e0bd4f1201b6b3078e088878e2e54b170cc | Python | 18,964 | 413 | #!/usr/bin/env python3
"""Training-only nested schedule selection for ten saved ADNI SBF rounds.
This diagnostic is conditional on the saved adaptive-ridge dictionaries and
coefficient normalization. It never requests the held-out-test NPZ member or
test targets. Three rank-balanced folds within the 192 training subje... |
13fe16a44fd013097cda11903e6177b2dbeec36f4afecb87ce43a5332c11394e | Python | 18,965 | 539 | # cython: language_level=3
# Time-stamp: <2024-10-22 15:19:55 Tao Liu>
"""Module for SAPPER ReadAlignment class
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).
"""
# ------------------------------------
# p... |
7b16dac60493dd6573ad0dee8ede3bc48fc84852e97347f2ea94cf65fb164e8a | Python | 18,971 | 377 | import numpy as np
import torch
import torch.utils.data as data_utils
from torchvision import datasets, transforms
import argparse
import torch.optim as optim
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import os, fnmatch
import cv2
import shutil
import sklearn
from sklearn... |
0d370e47f8d3273bb31f198d4c4fb75bb6fc1d793e4341e4b1d92eceb0906c48 | Python | 18,978 | 379 | def flatten(foo):
# Taken from https://stackoverflow.com/a/5286571
for x in foo:
if hasattr(x, '__iter__') and not isinstance(x, str):
for y in flatten(x):
yield y
else:
yield x
def freedman_lane(data_df, Yvar, Xvars, Zvars, n_perms=10000, stat='tstat', p... |
5b6f3d61e468fe0f334c36bbf529d6c062a7e1076ddb29182245196f77ac565a | Python | 18,989 | 508 | """Amplitude view."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import logging
import numpy as np
from phylib.utils._types import _as_array
from phylib.utils.event import connect, emit, un... |
f025ffbcd334c14c1e2cf9879dbc83cd29da3458bafa2e31e78e68d233318ec7 | Python | 18,989 | 525 | # 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... |
aa9178f2fe7be9b096fcf2b8bbe2fb9a31e5f97b3abc306d5334450aa249e1ed | Python | 19,000 | 467 | # -*- coding: utf-8 -*-
"""
This file is used to create the sequences for the experiment
"Decoding of sequential memory reactivation from wake rest"
There are 16 items which are ordered on a complex grid with 4 gridpoints
which have two exit nodes. This is the example structure of the grid:
Note: vertical bars are... |
ce2d8d5be473d5c39ca2d9890428bf378fa8de52ab061cb410cf4d7f315fc9f5 | Python | 19,006 | 549 | from pathlib import Path
import torch
from kilosort import preprocessing
from kilosort.gui import (
DataViewBox,
HeaderBox,
MessageLogBox,
ProbeViewBox,
RunBox,
SettingsBox,
DataConversionBox
)
from kilosort.gui.logger import setup_logger
from kilosort.io import BinaryFiltered
from kilosort.... |
ebffc7081f2c43a515416d390ef27fe243b3ba7546770daca5e9bba5defff064 | Python | 19,008 | 592 | import torch
import torch.nn as nn
class IntermediateSequential(nn.Sequential):
def __init__(self, *args, return_intermediate=True):
super().__init__(*args)
self.return_intermediate = return_intermediate
def forward(self, input):
if not self.return_intermediate:
... |
b87677da6163649f1879b0e8ba352ec9e43bb9ea107da30c883e810d204a0392 | Python | 19,011 | 304 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'sorter.ui'
#
# Created by: PyQt5 UI code generator 5.13.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWin... |
fb5c76add9b19dda44588b04b466b688762e3e521171ec97e2889d8ce1d75cc5 | Python | 19,011 | 503 | # 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... |
b9b28ce6a46491806bc85eec15681858a6fc9856f228640bf5cd4b6777efa6b4 | Python | 19,012 | 417 | # 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... |
6db8822ea31b7e64cc9c58a8425c33e6a4da4ea764bf1f8cba32993c77f05162 | Python | 19,022 | 619 | from io import StringIO
import re
from string import ascii_uppercase
import sys
import textwrap
import numpy as np
import pytest
from pandas.compat import (
HAS_PYARROW,
IS64,
PYPY,
is_platform_arm,
)
import pandas as pd
import pandas._testing as tm
from pandas.util.version import Version
@pytest.f... |
b6329acc87974d20499b9600ac6f4e7e6015fa7dc171e317b8d2f80d6829f05a | Python | 19,023 | 508 | # 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... |
eccd4b6548de33d3aa3d1850bdfe1895f25a1f003f93bc61e02f696517322ffa | Python | 19,027 | 443 | #!/usr/bin/env python
"""Module Description: Test the HMMR_EM class, which fits the means and
standard deviations of the mono-, di- and tri-nucleosomal fragment
length distributions for HMMRATAC.
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file LICE... |
23bbd13703d8888f288bfeb4dbbccc7d7a1a9c5d8eb554d3f78833542dc9c043 | Python | 19,043 | 549 | import operator
import numpy as np
import pytest
import pandas._libs.sparse as splib
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays.sparse import (
BlockIndex,
IntIndex,
make_sparse_index,
)
@pytest.fixture
def test_length():
retur... |
cc7599908be8194f83e1597d44508d1cb1d99cd6da4b8267294dd4f29662df9e | Python | 19,046 | 435 | # 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... |
fa5f2dd4263d22fba0ae28bea625ba4b280d692b372125c2ead60642bece36e5 | Python | 19,057 | 432 | import copy
import shutil
from pathlib import Path
from unittest.mock import MagicMock, patch
import numpy as np
import pandas as pd
import pytest
import torch
from omegaconf import OmegaConf
from lightning_pose.api import Model
from lightning_pose.api.model import _build_datamodule_pred
from tests.api.model_helpers ... |
b496d2eabc6d681cfcfd9b64922c5b173131ee65492950a1ef95fe7703092947 | Python | 19,059 | 513 | import torch.nn as nn
import torch
import torch.nn.functional as F
from torch.utils.checkpoint import checkpoint
import numpy as np
from sequence_models.layers import PositionFeedForward, PositionFeedForward2d, DoubleEmbedding
class MaskedConv1d(nn.Conv1d):
""" A masked 1-dimensional convolution layer.
Tak... |
53274b47bbe87daef986228ee6a11aa363a1696f5f2cd09429b6016934c7bb24 | Python | 19,073 | 441 | # %% [markdown]
# # Basics of MRpro and Cartesian reconstructions
# Here, we are going to have a look at a few basics of MRpro and reconstruct data acquired with a Cartesian sampling
# pattern.
# %% [markdown]
# ## Overview
# In this notebook, we are going to explore the `~mrpro.data.KData` object and the included hea... |
8f4fffb1d1cbfdcef6e5e9fcd986ccd58d5332f04afc40f45979d7a9578630e0 | Python | 19,073 | 611 | # Copyright 2023 Image Analysis Lab, German Center for Neurodegenerative Diseases (DZNE), Bonn
#
# 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... |
239b2217434af9995577643fd6e11ad558bf96e2903a79e601021849f67d173f | Python | 19,080 | 558 | """Module to generate networkx graphs."""
"""Implementation based on the template of ALIGNN."""
from multiprocessing.context import ForkContext
from re import X
import numpy as np
import pandas as pd
from jarvis.core.specie import chem_data, get_node_attributes
# from jarvis.core.atoms import Atoms
from collections im... |
e54ec293e59c00256c525ed7c80f6686e1e9008f8ba4e9509e1f01b22c597a45 | Python | 19,081 | 418 | # -*- coding: utf-8 -*-
# Authors: Gianvittorio Luria <luria@dima.unige.it>
# Sara Sommariva <sommariva@dima.unige.it>
# Alberto Sorrentino <sorrentino@dima.unige.it>
#
# License: BSD (3-clause)
import copy
import itertools
import numpy as np
from .particles import Particle
class EmpPdf(object):
... |
2e2222644e108bf071e454128671b3b57e93f20b27b878c92206fd64b096334c | Python | 19,083 | 507 | #
# File to train networks built from the hnn.py class.
#
# This file establishes the clebsch gordan coefficients, sets up an hnn with given parameters,
# loads holograms from .npy files, and then tests the network via a function call.
#
from argparse import ArgumentParser
import atexit
import math
import logging
impo... |
f16dc22c4098d9ca1862ff74ccab0a829ea663cf698702df0bd42fa94de66fe3 | Python | 19,107 | 520 | #!/usr/bin/env python
"""
Should always be faithful duplicate of sequence/BioReaders.py
Duplicated here for tofu installation. This one is called via cupcake.io.BioReaders.
"""
import re, sys
from collections import namedtuple
Interval = namedtuple('Interval', ['start', 'end'])
class... |
e1673375dc4ed1dc033759a84f2ed2c23a51d13a37ca93c886ddaea8ceda7390 | Python | 19,108 | 578 | """Fetch data."""
import gzip
import hashlib
import os
import pickle
import shutil
from glob import glob
import numpy as np
import pandas as pd
from nilearn.datasets.utils import _fetch_file, _fetch_files
from nimare.dataset import Dataset
from scipy.sparse import load_npz
from gradec.utils import get_data_dir
OSF_... |
1438f26afd81116a7ba296cf43b5981c85f32e6796a51de6b7fa03dc435c3e4c | Python | 19,110 | 491 | # 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... |
9d18238d55726bec792335c452453113878f5286ed1d315ddad75603940931c1 | Python | 19,113 | 556 | #!/usr/bin/env python3
# JN 2015-07-29
"""
Log file parser for Cheetah by Johannes Niediek
This script reads out the reference settings
by sequentially following all crs, rbs, and gbd commands.
Please keep in mind that the following scenario is possible with Cheetah:
Start the recording
Stop the recording
Change the... |
c2cec735087b30e588b9fdf93ba6c60098a6667de34de711f783d564e1fbad03 | Python | 19,117 | 493 | # 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... |
ee5348ea956ab81d1a71deb7fd65b6c45812b8b5f9bbeaf043512d6bcf94ee13 | Python | 19,135 | 440 | # cython: language_level=3
# Time-stamp: <2024-10-24 15:20:26 Tao Liu>
"""Module Description: Detect peaks, main module
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).
"""
# ---------------------------------... |
90de5e8ef9196989fc0b07a5c12dd1b7ce8a4582a65dca54aace0efbd9415388 | Python | 19,147 | 522 | """Workflow for running the grdient-decoding analyses"""
import argparse
import itertools
import os
import os.path as op
import pickle
from glob import glob
import mapalign
import nibabel as nib
import numpy as np
import pandas as pd
from brainspace.gradient import GradientMaps
from gradec.decode import GCLDADecoder, ... |
b3258474e21c74943d25c725f5c6c7a26249d1259170b94275cb115dfa5ed5e1 | Python | 19,151 | 299 |
import os
import sys
import itertools
import functools
import pandas as pd
import numpy as np
import pybedtools # this script was developed using pybedtools v. 0.8.0
# ^ some/all of pybedtools requires 'bedtools' to be available on your PATH /tools/bedtools/2.27.1/bin/bedtools
# BedTool(..).sort(): "sortBed" does n... |
fb7160fc3dec8566fe1a7c91d525d67a5f60af87b08af48453a9fa44f611c5dc | Python | 19,152 | 285 | # Imports
from sklearn.metrics import confusion_matrix
from sklearn.preprocessing import StandardScaler
from src.vizualization import heatmap
import scipy.stats as ss
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import GridSearchCV, train_test_split
from sklearn.metrics import ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.