sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c55b47a1b10a3324c85ee4a3ec7dd30a3b7517ba3cddcd0d653bd70b3a292eb3 | Python | 8,622 | 247 | from concurrent.futures import ProcessPoolExecutor
from typing import Dict, List, Optional, Tuple, Union
import numpy as np
import pandas as pd
from numba import njit
from scipy import sparse
from .. import utils
from ..logging import logger
def read_p_c(p_c_path: str,
group_by: Optional[List[str]] = N... |
3e70c7ee8956344588fdbaaf96d50803118638acc470b60af60b3dc3e95ed84a | Python | 8,628 | 208 | import sys
import numpy as np
from sklearn.neighbors import NearestNeighbors
from sklearn.linear_model import LinearRegression
from utilities import compute_info_imbalance, compute_pearson_correlation, construct_time_delay_embedding
################# Convergent Cross Mapping ###################
def compute_cross_m... |
b6552ec30f7251c85501aa40877be8c561fce62254f0c52f67e5e5fd882963eb | Python | 8,629 | 257 | """Phase 12: governance + approval workflow routes.
Endpoints:
- ``GET /workspaces/{ws}/approvals`` list
- ``POST /workspaces/{ws}/approvals`` open a new request
- ``POST /approvals/{id}/approve`` sign off
- ``POST /approvals/{id}/reject`` ... |
b50030c9173676fb5e8d9992dfa03b6f16cb22d89fd7bb38470d0c32e475de1c | Python | 8,632 | 261 | """Miscellaneous functions used for analyses."""
import logging
import os
import os.path as op
import nibabel as nib
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.collections import LineCollection
from neuromaps.datasets import fetch_atlas
from nibabel import GiftiImage
from nibabel.gifti imp... |
b862ac039204d9b3bb65ce3d774d8b77e4695a82e13e93fde4d76497aa2084fc | Python | 8,633 | 205 | import os
import warnings
import pandas as pd
from datasets.scar import SCAR
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
from nltk.stem.snowball import SnowballStemmer
from tqdm import tqdm
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text im... |
fdb041d7459e765ae1ed7c3de28ccc11a5121298cb94cb77cc18aeb97c9df3b5 | Python | 8,637 | 262 | from PyQt6 import QtCore, QtGui, QtWidgets
DEFAULT_CSS = """
QRangeSlider * {
border: 0px;
padding: 0px;
}
QRangeSlider #Head {
background: #cef;
}
QRangeSlider #Span {
background: #16f;
}
QRangeSlider #Span:active {
background: #05f;
}
QRangeSlider #Tail {
background: #cef;
}
QRangeSlider > QS... |
f4d8ca9da16d9431e45fffd5c6603e6d41a2cd4dc0e227456b48b68505c00e6a | Python | 8,643 | 238 | """
Configuration file for the Sphinx documentation builder.
This file only contains a selection of the most common options.
For a full list see the documentation:
https://www.sphinx-doc.org/en/master/usage/configuration.html
"""
import datetime as dt
import importlib.metadata as im
import pathlib as plib
def load_... |
7b2425fe0e08a7286b4296899ccc0815eb08a506de081c0f86d3a565ada4eee1 | Python | 8,649 | 254 | import numpy as np
from kilosort.gui.logger import setup_logger
from PyQt5 import QtGui, QtWidgets
logger = setup_logger(__name__)
def create_prb(probe):
chan_map = np.array(probe["chanMap"])
xc, yc = np.array(probe["xc"]), np.array(probe["yc"])
probe_prb = {}
unique_channel_groups = np.unique(np.arr... |
d5c17bef7d3851a0824cbf3aef5cd52e78b2c90c805e614f37089ed07d128729 | Python | 8,655 | 231 | # 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... |
26d3e7abf9a0139008cc6760268fa32ca7e07b4e900616ecd28028714232d332 | Python | 8,656 | 254 | import random
import time
from typing import Any, Mapping
import torch
from deepglyco.chem.common.elements import ElementCollection
from deepglyco.chem.gpep.fragments import GlycanFragmentTypeCollection
from deepglyco.chem.gpep.glycans import MonosaccharideCollection
from deepglyco.chem.pep.aminoacids import AminoAci... |
c910cc921bb8fda0c164e658ecf6ae650dd93241091c5604a28bf6a15e4256e4 | Python | 8,657 | 236 | from datetime import (
datetime,
time,
)
import locale
import numpy as np
import pytest
from pandas._libs.tslibs import timezones
import pandas as pd
import pandas._testing as tm
class TestBetweenTime:
def test_between_time_formats(self, frame_or_series):
with tm.set_locale("C", locale.LC_TIME)... |
17f843f04ba30805b4826f677993398b5969e83fa4a7d9ebcb8cdf91c0a69e2d | Python | 8,663 | 310 | """
Tests that work on both the Python and C engines but do not have a
specific classification into the other test modules.
"""
from datetime import datetime
from io import StringIO
import pytest
import pandas as pd
import pandas._testing as tm
xfail_pyarrow = pytest.mark.usefixtures("pyarrow_xfail")
skip_pyarrow =... |
a8cd56f64ef8a024d59ca757d8a02ced03bedf72840ea59e6564927c08808105 | Python | 8,664 | 227 | #!/usr/bin/env python
"""Module Description: Test the UnitigRAs and UnitigCollection classes
in MACS3.Signal.UnitigRACollection, which hold reads re-mapped to
fermi-lite unitigs and the unitig-to-reference alignments used by
callvar after local assembly.
The unitig alignment used throughout is written by hand:
r... |
75caa062157562796aa73ea2469765ffbb481c9ff6f72b12c4147c1686cca2ec | Python | 8,666 | 164 | from Environment_ui import *
from PySide2.QtWidgets import QWidget, QFileDialog, QTextBrowser, QPushButton, QMessageBox
from PySide2.QtUiTools import QUiLoader
from PySide2.QtCore import Signal, QObject
from pages.Whole_brain_seg.utils import test_each_brain
from pages.Whole_brain_seg.dataset_whole_brain import Whole_b... |
d353c530343311ea4d7ad0211233f52c97b22c16d8c7b55e436ee04ab6d6c3a7 | Python | 8,668 | 262 | from io import StringIO
import time
from torch.nn.functional import max_pool2d, avg_pool2d, conv1d, max_pool1d
import numpy as np
import torch
from sklearn.cluster import KMeans
from sklearn.decomposition import TruncatedSVD
from tqdm import tqdm
from kilosort.utils import template_path
device = torch.device('cuda')
... |
fde69b26a29e72d2b729390c24e6d42f2e7c0a2783731387d11d5e3ee0a27173 | Python | 8,670 | 210 | """Bounded public BAM framing regressions for #766; no pysam required."""
import gzip
import json
from pathlib import Path
import random
import struct
import subprocess
import sys
import zlib
import pytest
from conftest import macs3_env
HEADER = (b'BAM\1' + struct.pack('<ii', 0, 1) + struct.pack('<i', 5)
... |
2d871d4a55e0fe18c7a8a28d7ab63df428be88bded57a81b70577b64364a25c0 | Python | 8,673 | 249 | import operator
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays import FloatingArray
# Basic test for the arithmetic array ops
# -----------------------------------------------------------------------------
@pytest.mark.parametrize(
"opname, exp",
[... |
f097b354bb70eaeab3030c1c6bf751c6e32ef3679104b165e286062864adf690 | Python | 8,673 | 246 | import sys, os
import time
from utils import getLogger, getHelp
from ioput import parseBedpeFiles, txt2jd, parseJdFile
from joblib import Parallel, delayed
import numpy as np
import pandas as pd
from HNSW3 import HNSW3 as HNSW
from estimate import estimateInterAndSelfCutFrag
from plot import plotInterSelfCutFrag
from m... |
c10ccd369e1b1549d5d8406eaf017090226c0a4bc6daa3c7fd9d9ba113438264 | Python | 8,680 | 230 |
#
# 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.
#
aa_to_ind = {'CYS': 2, 'ILE': 8, 'GLN': 12, 'VAL': 6, 'LYS': 13,
'P... |
a85c2a6ba2c1b39ae379d78740d2c12a50cf8fef66cef734597c487f1b651c71 | Python | 8,683 | 256 | import torch
import numpy
import matplotlib.pyplot as plt
import bionetwork
import plotting
import pandas as pd
import seaborn as sns
import time
def getSample(filePath, sampleName):
file = open(filePath + 'name.txt', mode='r')
curSample = file.read()
file.close()
select = sampleName == curSample
r... |
cdd1de9e14d65387f676701a923c084ba48c7e078186c60ba0d8997b2863a83d | Python | 8,683 | 285 | import sys
import time
import os
import warnings
import copy
import subprocess
import multiprocessing
import setproctitle
setproctitle.setproctitle("DASDC")
import numpy as np
from script_simu_fev.Data_To_Feature_pipline import write_haf, write_sfs, write_hapFre, write_allelFre\
, write_safe, write_ihs... |
568571afd2faa5d754477af151490dc51992918713dd056d989a57f778048d91 | Python | 8,691 | 228 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestDataFrameClip:
def test_clip(self, float_frame):
median = float_frame.median().median()
original = float_frame.copy()
double = float_frame.clip(upper=median, lower=median)
assert not (doub... |
0c29d96f0fd076398de001f17af211492b463382d1cd13dc97073e15b0c3f3f9 | Python | 8,692 | 298 | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import numpy as np
import torch
"""
An evaluation module for use with the OCP dataset and suite of tasks. It should
be possible to import t... |
252b1e0561f966e8b463ff79050da034088cbcd786f72d0ace5b86ff6d2e4645 | Python | 8,701 | 197 | # Copyright (c) 2012-2021, NECOTIS
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice,
# this list of conditions and th... |
18755308dc02dc8caecde1e4d0e8d407d5ce1c7d4c6abd268d96fef1835ddbfd | Python | 8,705 | 268 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
@pytest.mark.parametrize("other", [["three", "one", "two"], ["one"], ["one", "three"]])
def test_join_level(idx, other, join_type):
other = pd.Index(other)
join_index, lidx, ridx = other.join(
idx, how=join_type, level=... |
911d221ccdf6abe1e7b2a271ae98bd664fec35f7e43619a1b97318e1f23d5daf | Python | 8,705 | 250 | import copy
import multiprocessing
from functools import partial
from operator import truediv
from typing import Dict, FrozenSet, List, Optional, Set, Tuple
import numpy as np
import pandas as pd
from .. import utils
from ..logging import logger
from .conversion import CONVERSION_COMPLEMENT, CONVERSIONS_PARSER
SNP_C... |
b0bde854b4b39944a0745dd8bfbfbe609454326f1ff3e2d74f2ac8bebd2277f2 | Python | 8,705 | 222 | import pytest
import torch
from lightning_pose.models.heads.heatmap import HeatmapHead
from lightning_pose.models.heads.heatmap_mhcrnn import (
HeatmapMHCRNNHead,
UpsamplingCRNN,
)
class TestHeatmapMHCRNNHead:
@pytest.fixture
def basic_mhcrnn_head(self):
"""Create a basic HeatmapMHCRNNHead i... |
1476bce1cfe902f0495f2df13bde093e970e0f01179758fd07e664f52f7d0794 | Python | 8,708 | 176 | """Build PAC from the checksum-pinned original Kuo et al. R release.
Run ``uv run python clocks/build_proteoclock.py`` from the repository root.
The Insilico proteoclock wrapper is not used as PAC's coefficient source: it
rounds Gompertz constants and applies optional, separate cohort preprocessing.
ipfP3GPT is not bu... |
45c3a631065cf74192b7a47d37558738c91cc01aa82c42d0a19e5e964b321fc9 | Python | 8,708 | 272 | import torch
import torch.nn as nn
import torch.nn.functional as F
from roost.core import BaseModelClass
from roost.segments import ResidualNetwork, SimpleNetwork, WeightedAttentionPooling
class Roost(BaseModelClass):
"""
The Roost model is comprised of a fully connected network
and message passing graph... |
4904ca203a204f41b737c4bbb2142ca4f43c076324e6ac679708f50273bd7132 | Python | 8,709 | 223 | import codecs
import numbers
import pathlib
import importlib.resources
import time
import dclab
from PyQt6 import uic, QtCore, QtWidgets
from ..widgets import show_wait_cursor
from ..widgets.feature_combobox import HIDDEN_FEATURES
from ..._version import version
STAT_METHODS = sorted(dclab.statistics.Statistics.avai... |
e70bf538d268efe683b163b14302b0bf38da4a01eeb5f3462960d2eea28360cc | Python | 8,713 | 257 | # 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... |
d8ad0aa99dc582de2bd670c7136118954621cfddcecdf434a5ab5b7d028bd0c5 | Python | 8,718 | 189 | from transformers import T5EncoderModel, T5Tokenizer
import torch
import h5py
import time
from tqdm import tqdm
import numpy as np
# @title Load encoder-part of ProtT5 in half-precision. { display-mode: "form" }
# Load ProtT5 in half-precision (more specifically: the encoder-part of ProtT5-XL-U50)
def get_T5_model():... |
2de5e691f85b6abc178e05975fc8e36aeb30aad778a326ef64f52ccc3f61d832 | Python | 8,723 | 277 | """
Visualization of properties on 3D structures using
Pymol pml scripts
Authors:
Thomas A. Hopf
"""
import pandas as pd
def _write_pymol_commands(commands, output_file):
"""
Helper function to write a set of lines to a file
Parameters
----------
commands : list(str)
List of commands,... |
15748126379da45a44474239f9139600297647131ccee88824871534e2e28f94 | Python | 8,729 | 121 | """Additional descriptive stability and matched-source sensitivity analyses.
Defined after the first manuscript results, at the user's request for a stronger
analysis. No local epidemiological model or data-driven source selection is used.
"""
from pathlib import Path
from datetime import datetime, timezone
import jso... |
68b54e9ac4f6354ded63433e4c43afb0c9366207b52adfc97d2e40bfc0c44f08 | Python | 8,730 | 224 | from decimal import Decimal
import numpy as np
import pytest
from pandas._libs.missing import is_matching_na
from pandas.compat.numpy import np_version_gt2_2
import pandas as pd
import pandas._testing as tm
class TestGetIndexer:
@pytest.mark.parametrize(
"method,expected",
[
("pad",... |
0f841d81dce04475ddaacbc5f263c4f34e7e6474e446b77e153cd8f0812e877a | Python | 8,735 | 171 |
from ..file_utils import get_filepath
from .server_utils import parse_variant
from flask import url_for
import urllib.parse
import itertools
import re
import copy
import sqlite3
from typing import List,Dict,Any,Optional,Iterator
# TODO: sort suggestions better.
# - It's good that hitting enter sends you to the thin... |
82af829bee6b49e70abd97e3552cdf3cb9a4c98288ed4f9cc504ee4cb755c933 | Python | 8,736 | 207 | import multiprocessing
import numpy as np
import h5py
import torch
import torch.nn as nn
import logging
import matplotlib.pyplot as plt
from torch.utils.data import Dataset
from typing import Dict, Tuple, List, Optional, Callable
from itertools import pairwise
from operator import itemgetter
from pathlib import Path
fr... |
eb1cef8cb01e2d22dc9b08af65c35e2b907964591df301d02ca966180531c573 | Python | 8,738 | 256 | # ----------------------------------------------------------------------------
# Copyright (c) 2016-2026, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
f9c3d7f178554bed6492f271f7bf3e272ee715b22cc12faf8dd418c6fd766501 | Python | 8,738 | 327 | """
This script converts .dat (Siemens twix format) to .h5 files.
The data involves navigator acquisition.
Stepwise,
1. use 'twixtools' to read in .dat file;
2. split Imaging echo and Navigator echo;
3. store data slice by slice;
4. estimate coil sensitivity maps using Espirit in SigPy
Author: Zheng... |
1bd830b54bbf3fd0f01bc83980998a2a84279a994f8cf185be922d3bf9d35486 | Python | 8,744 | 230 | """Tests for the pure merge-proposition domain and codecs."""
from dataclasses import FrozenInstanceError
import numpy as np
from pytest import raises
from .._propositions import (
MergeProposition,
MergePropositionCatalog,
MergePropositionController,
PropositionEntry,
PropositionReview,
Prop... |
65fac3915c1ccd1949f789d96c2e5f0a9a1edaa30691ed2bbc73f83634eb76a8 | Python | 8,751 | 207 | """HPS parity with pinned Kuo et al. R code, including the public input path."""
import importlib
import importlib.util
import json
from pathlib import Path
import numpy as np
import pandas as pd
import pytest
import torch
FIXTURES = Path(__file__).resolve().parents[1] / "data" / "hps"
def _fixture_model():
as... |
96d731b9cd2b89caf5dbd0c30cf31a159103d92cbd3fb8e96e4da96654a954f8 | Python | 8,753 | 187 | import os
import argparse
from cptools2 import generate_scripts
from cptools2 import job
from cptools2 import parse_yaml
from cptools2 import colours
from cptools2 import file_tools
from cptools2 import __version__ as CPT_VERSION
from cptools2.colours import pretty_print
from cptools2.generate_scripts import get_user_s... |
67d0ea59f96f009000c069ee7db9752eb1cee4d58aef3b7463d3179f8765952e | Python | 8,760 | 277 | # 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... |
45fa661f51f544fed1b3354568a437b7d4fdcab8015c427a60cccefecd598256 | Python | 8,764 | 333 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 2 18:15:32 2022
@author: System 6
"""
import time
import warnings
import serial
# TODO: Add threading inheritance and monitor serial feedback?
class Synchronizer:
'''
Class to control the hardware synchronization arduino.
'''
def __init__(self, pl... |
efe0bae0544fb07b52983e737f6ec5ca02df4b3f73f6906a2f0369a6214d7cd2 | Python | 8,765 | 172 | import os
import datetime
import cc3d
import pickle
import cv2
import numpy as np
import pandas as pd
import shutil
import os
import tifffile
from filehandling import read_nifti, write_nifti
from inference.inference import create_empty_memmap
from skimage.morphology import binary_dilation
from skimage.draw import ellip... |
74c0fa39cbc03dee90a63ee33069771d96f898c02e162a39a8ff1626859b2cc3 | Python | 8,769 | 256 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestDataFrameValues:
def test_values(self, float_frame):
with pytest.raises(ValueError, match="read-only"):
float_frame.values[:, 0] = 5.0
assert (float_frame.values[:, 0] != 5).all()
def test... |
1bde4f0154d576225e18ef833ddbd65b583d508a9efbe4a78c8167ab837750cc | Python | 8,771 | 207 | import argparse
import os
import numpy as np
import pandas as pd
import yaml
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
from yaml import Loader, Dumper
from cdr.config import Config
from cdr.model import CDREnsemble
from cdr.plot import plot_irf, plot_surface
from cdr.util i... |
beb47c480919b2764064a3fa9135b9e4d85f406ff7812ac3e2451eef23950e4f | Python | 8,771 | 244 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#Importing required libraries
import string
import torch
from torch.nn.utils.rnn import pad_sequence
import torch.nn.functional as F
from tqdm import tqdm
from Bio import SeqIO
import numpy as np
import importlib.resources as importlib_resources
def _open_if_is_name(file... |
bba400140d6e287709b398503807b7af2a97f784f7037eb0af9ccf4150b2fe89 | Python | 8,773 | 222 | # 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... |
ad8851ee83b53677b467aeabddfd4ff12b2fa2783735393bdb459b1a6157e3f1 | Python | 8,781 | 179 | #! /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... |
9594cd8f9621a87e7119530fe5950153583b572a14fe388845877d96146f06e1 | Python | 8,782 | 172 | import pandas as pd
import os
import matplotlib.pyplot as plt
import argparse
import numpy as np
def compute_max_tuning_and_stderr_for_layer(file_path):
"""Compute the average and standard error of the maximum absolute tuning value for each neuron in a given layer."""
data = pd.read_csv(file_path)
max_tun... |
99ab14a3fd48d9fcdde8d69ccaca0558c6c8fe20dc384ff56988d62bec510961 | Python | 8,782 | 268 | # 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... |
b53675872fbb327db5b88e76ac024f8805391b4c907a4cd71a69b6280e301a19 | Python | 8,782 | 223 | import dataclasses
import sys
from typing import List, Literal, Tuple, Union
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib.figure import Figure
from matplotlib.cm import ScalarMappable
from .common import Palette, get_colormap
@d... |
4ccfc4e66dd1e701f791164dd4aa62de0dc7ec060a27482a79d8af562d1bc03b | Python | 8,783 | 301 | """
Implementation of nlargest and nsmallest.
"""
from __future__ import annotations
from typing import (
TYPE_CHECKING,
Generic,
Literal,
cast,
final,
)
import numpy as np
from pandas._libs import algos as libalgos
from pandas.core.dtypes.common import (
is_bool_dtype,
is_complex_dtype... |
9b156d10400f1d8535f064094784583caf401a6bef42f7119879da88f4775662 | Python | 8,788 | 280 | import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
from pandas.core.reshape.merge import merge
def test_merge_antijoin():
# GH#42916
left = pd.DataFrame({"A": [1, 2, 3]}, index=["a", "b", "c"])
right = pd.DataFrame({"B": [1, 2, 4]}... |
07622bf9210719189356708bfdd63f8c07d10ba5141d1978e5355b45b4f2eaab | Python | 8,796 | 227 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# NiMARE documentation build configuration file, created by
# sphinx-quickstart
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All conf... |
392c5942c25a6883047305605778c51f7c8e22650a3dcfab35330eb3be02e877 | Python | 8,800 | 249 | #! /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... |
f0e66337854a45fee1bfd9f2415ccdd676432cf7f5e43b89052edfac54f27444 | Python | 8,804 | 268 | import regex
import unicodedata
from .language_info import get_language_info
from .transliterate import transliterate
MARK_RE = regex.compile(r'[\p{Mn}\N{ARABIC TATWEEL}]', regex.V1)
DIGIT_RE = regex.compile('\d')
MULTI_DIGIT_RE = regex.compile('\d[\d.,]+')
def preprocess_text(text, language):
"""
This fun... |
5b530c6f76ae77cff2b76dc43a2ec4115a6229efec8ef9db113a8e47566ea3e8 | Python | 8,809 | 273 | import os
import numpy as np
import reverb
import tensorflow as tf
import wandb
from rl_toolkit.networks.models import DuelingDQN
from rl_toolkit.utils import VariableContainer
from ...core.process import Process
class Agent(Process):
"""
Agent
=================
Attributes:
env_name (str):... |
ce755fe9ac92dad8e94e2a46855427004f625f53342f0f06ab2cdc3b7c208b83 | Python | 8,811 | 276 | __all__ = [
"InputPeptideEncoding",
"InputPeptideCharge",
"PeptideBiLSTM",
"PeptideCNNLSTM",
]
from typing import Optional, cast
import torch
from torch import nn
from ....util.collections.dict import chain_get_typed, chain_item_typed
from .data import PeptideDataBatch
class InputPeptideEncoding(nn... |
deaa436fdd2a002ac99727ec4c6eda4dccbaef506b43f74f77f2eda3f4a822fb | Python | 8,814 | 254 | # 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... |
3676a2da7c7174d295e3cd848adb01af78d05124f8d95d87f778092791a662c6 | Python | 8,815 | 178 | import pandas as pd
import numpy as np
import os
def human_ens_to_human_symbol(df_unmapped: pd.DataFrame, df_map: pd.DataFrame, drop_unmapped: bool=False, verbose: bool=False) -> None:
"""Map dataframe index human ensemble id to human gene symbol inplace
Parameters
----------
df_unmapped : DataFrame
... |
fb9082b54b3fddd0f9d0bafdb5c42487807d76c17cde8d18aba33fa70e01c352 | Python | 8,816 | 184 | import gzip
import os
import shutil
import tempfile
from unittest import TestCase
import pandas as pd
from dynast.technology import TECHNOLOGIES_MAP
def tqdm_mock(iterable, *args, **kwargs):
return iterable
def import_mock(mocked, *args):
def _import_mock(name, *args):
return mocked
return _... |
221ec5abc3d767d21195ff0edc621305073295eaf92c0289b12c6536bdf4f67e | Python | 8,818 | 252 | from datetime import timedelta
import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
from pandas.core.indexes.timedeltas import timedelta_range
def test_asfreq_bug():
df = pd.DataFrame(data=[1, 3], index=[timedelta(), timedelta(minutes=3)])
... |
b100c757df881ff99ec928c23e8b5fce0b2a44474778d089948cf855fd461c31 | Python | 8,822 | 211 | #!/usr/bin/env python
__author__ = 'etseng@pacb.com'
"""
Reporter for junction summary for one or more samples.
Recommended to run before scrubbing sample GFFs prior to chaining.
Suggested process is:
1. run collapse to get GFF for each sample
2. run this report script on all sample GFFs
3. run scrubber on all sample... |
bf233d6307092637e504821ac4c1dd3ccff035384a6d98fa4f38c2a3bd68aab5 | Python | 8,824 | 222 | import numpy as np
from tempfile import NamedTemporaryFile as NTF
from typing import Dict, Tuple
from skimage.util import view_as_windows
class Grappa:
def __init__(self, kspace: np.ndarray, kernel_size: Tuple[int, int] = (5, 5), coil_axis: int = -1) -> None:
self.kspace = kspace
self.kernel_size ... |
47aa1887c14ec0a206cedb99c7aed722605ec90dfc4ebd8a2499dbe67150d092 | Python | 8,826 | 221 | import sys
import numpy as np
import wormdatamodel as wormdm
import wormbrain as wormb
import matplotlib.pyplot as plt
import os
import mistofrutta as mf
import pumpprobe as pp
from scipy.signal import savgol_coeffs
folder = sys.argv[1]
if folder[-1]!="/": folder += "/"
save = "--no-save" not in sys.argv
sig_green = "... |
380a3cd66c67fa87458aa2cb3ba6853d7d34405a653b09d835e59cc8eacb904d | Python | 8,830 | 248 | import torch
import torch.nn as nn
import torch.nn.functional as F
from darts.api import Model
from darts.modules.conv import Cell
from darts.modules.classifier import MultitaskClassifier
from darts.genotypes import PRIMITIVES, Genotype
class Hyperparameters:
c = 8
num_nodes = 2
num_cells = 3
channel... |
26aae546b4b58897816f96180241079b60e969c85c8185328b6908c5a7af41d2 | Python | 8,833 | 223 | from __future__ import generators
import logging
import glob, os, functools
import sys
sys.path.append('../')
sys.path.append("./HDBET/")
import argparse
import SimpleITK as sitk
import numpy as np
import scipy
import nibabel as nib
import skimage
import matplotlib.pyplot as plt
import scipy.misc
from scipy import ndi... |
461166dc54e818d51bb8b99865c2f7623a0c57a381b760cca88612a92b51347e | Python | 8,834 | 277 | """
Statistical significance is tested for every chromosome using the local permutated background.
"""
import gc
import numpy as np
import pandas as pd
from scipy.stats import poisson
from ioput import parseJdFile, parseIv
from utils import mesFlush
def getCorLink(cs):
"""
@param cs: [1,2,3,4], a list for the... |
953257166d00098523b6ada3f1eeaecbb84cee3f1f11d062a0bd4aec6b2473d5 | Python | 8,835 | 244 | """Camera geometry utilities for multi-view 2D-to-3D projection and triangulation."""
from __future__ import annotations
import copy
import itertools
from pathlib import Path
import cv2
import numpy as np
import torch
from aniposelib.cameras import CameraGroup as CameraGroupAnipose
from jaxtyping import Float
from k... |
4972ab67faf0ec70d8d925b510651410bdaef79926a74354bef6f1c978438b52 | Python | 8,836 | 202 | import json
from neuronbridge.model import *
from neuronbridge.model import PPPMatch
from neuronbridge.model import LMImage
by_body = json.loads(
"""
{
"results" : [ {
"libraryName" : "FlyEM_Hemibrain_v1.2.1",
"alignmentSpace" : "JRC2018_Unisex_20x_HR",
"anatomicalArea" : "Brain",
"gender" : "f",
... |
b1095fdca1583fe3dea6bcc2b7faca70c905a77601d839fe13c80e8715fe12d9 | Python | 8,837 | 258 | import torch
from torch_scatter import scatter
from ocpmodels.models.gemnet.layers.base_layers import DenseLayer, ResidualLayer
from ocpmodels.modules.scaling.scale_factor import ScaleFactor
class EwaldBlock(torch.nn.Module):
"""
Long-range block from the Ewald message passing method
Parameters
---... |
b9ab1e6fc236d2c7293b1feae5bf863370e6d437dc39fd9bf8532c91df9bd7fb | Python | 8,840 | 221 | """`UnsupervisedExperiment` — base for clustering and anomaly detection.
Unsupervised tasks don't have a target column. They add `assign_model` — the
verb that labels every row in the dataset with its predicted cluster / anomaly
score using a fitted model.
Session-28 drain: `create_model` and `assign_model` no longer... |
1f82c1173c1c2f05f38dd1a5a4e8eb3d4ca560000f5410abd7cf7787c2bcb836 | Python | 8,847 | 196 | # 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... |
393c67e81c862c2921b559215768c01c35014b1c01fb0bcafc0f95300017c64a | Python | 8,849 | 279 | __all__ = ["PeptideSpectralLibraryHdf"]
from types import MappingProxyType
from typing import Optional, Union, overload
import numpy.typing as npt
import numpy as np
import pandas as pd
from .abs import (
PeptideSpectralLibraryBase,
Indices,
Columns,
)
from ...util.io.hdf import HdfFile
class PeptideSpe... |
1bd56dcdd708aa15b081b93d9db9dd91fbaff65e56a2d0e62d61e6c01c7fa223 | Python | 8,850 | 207 | # 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... |
32cd7b16e5fc16db1ac5c16d833ac4c86ad6cbbaa4ff5167486764b775819073 | Python | 8,850 | 246 | # 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... |
28481a333608a738e9de9455f671010c2d03564caf82863cc36279d7c9e0d65d | Python | 8,853 | 214 | import ntpath
from sys import path as sys_path
sys_path.append('/cis/home/kstouff4/Documents/MeshRegistration/master/py-lddmm/')
sys_path.append('/cis/home/kstouff4/Documents/MeshRegistration/master/py-lddmm/base')
sys_path.append('/cis/home/kstouff4/Documents/SurfaceTools/')
import os
from base import loggingUtils
imp... |
2bb378340140dbd25937075c7b401c7654d8e1f3b441278436134d3450653f92 | Python | 8,853 | 241 | import operator
import numpy as np
import pytest
from pandas.compat import (
WASM,
)
from pandas.core.dtypes.common import is_number
import pandas as pd
import pandas._testing as tm
from pandas.tests.apply.common import (
frame_transform_kernels,
series_transform_kernels,
)
@pytest.mark.parametrize("f... |
b4068b8668ef9674c2f2074e159ed60fde59bf2858f19c73bc2df766fcc9d0cd | Python | 8,853 | 263 | import argparse
import copy
import h5py
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
import os
from scipy.interpolate import RegularGridInterpolator, interp1d
from scipy import ndimage
import torch
import windseer.measurement_campaigns as mc_utils
parser = argparse.ArgumentParser(
... |
0508446c33a134240919bf0cc46406c17db4c23615c2ad45c2c5be8272d2fb4d | Python | 8,854 | 231 | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 14 11:11:06 2023
Figure 3. Dorsal striatal neurons encoding single-limb phase angle, body speed,
and start/stop of walking.
@author: lonya
"""
#%% Load Data
from tkinter import messagebox
import tkinter as tk
import tkinter.filedialog as fd
import numpy as n... |
3d2de7fe7c75707149dd7dc4bc4156c24c68a7e8d3c475a05d6b0e210de7025a | Python | 8,858 | 187 | import argparse
import os
import ete3
import pandas as pd
from ete3 import NCBITaxa
def get_args():
"""
Get arguments from command line with argparse.
"""
parser = argparse.ArgumentParser(
prog='Convert_RMA_NCBI_c2c.py',
description="""Convert a NCBI c2c file obtained from a read-count ... |
6390b0291c0d951fa9d3d3d3dfeb589a2de7d035e0785bd86fc91ffe081067f0 | Python | 8,858 | 219 |
import os
import torch
import pickle
import matplotlib.pyplot as plt
import matplotlib as mpl
load_dir = '/Users/elizabethnewman/Desktop/tnn_results/cifar100/tensor/'
subdir_names = []
for subdir_name in os.listdir(load_dir):
if subdir_name == '.DS_Store':
continue
subdir_names.append(subdir_name)
s... |
e06cf0fa14080eb63451e12ba0afc041c0e07ac4b4a45c35ecfa55527da9bfcb | Python | 8,876 | 283 | #cleaning_Labeling.py
from initialization.config import *
from initialization.initialization import *
import os
import numpy as np
import pandas as pd
import itertools
def clean_comb_df(df_in, deduplicate=True):
'''
A function with steps to clean up the comb_df
to standardize the dataframe formatting f... |
6bfc213fe38d4bf87bb207f7bd14056c7481181244e9e2eed6319850dc6e260e | Python | 8,877 | 291 | # 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... |
583ba56112a3bd76b1de458325c2383a1701774ea589ec3d8cdba91853d3f9e1 | Python | 8,878 | 260 | import numpy as np
import pytest
from pandas.core.dtypes.common import is_integer
import pandas as pd
import pandas._testing as tm
from pandas.core.indexes.datetimes import Timestamp
class TestSeriesQuantile:
def test_quantile(self, datetime_series):
q = datetime_series.quantile(0.1)
assert q ==... |
61a4190f8dd9388b71398029a293a9b4a93ad752fd0674f8dc7288d312ade9ae | Python | 8,878 | 243 | #-----------------------------------------------------------------------------
# Crw
#-----------------------------------------------------------------------------
import numpy as np
import os
import sys
import DXGB.get_pdbinfo as get_pdbinfo
def get_RW(fn, inpro):
''' Select the HOH in [2.0, 3.5] of protein '''
... |
bcf822e21301f72dad97f89d0acc376634cb1fb01cea57c0df641c1140575d1a | Python | 8,882 | 229 | from torch.utils.data import Dataset
import numpy as np
import os, cv2, time
from PIL import Image
from torchvision import transforms
from datasets.data_io import *
s_h, s_w = 0, 0
class MVSDataset(Dataset):
def __init__(self, datapath, listfile, mode, nviews, ndepths=192, interval_scale=1.06, **kwargs):
... |
c25bbcbfd24720f7190edb26a573aee9d44c6637c7822f7055bb0ceb1669811b | Python | 8,883 | 208 | """Tests for PredictionResult.to_dict() and MultiviewPredictionResult.to_dict()."""
import numpy as np
import pandas as pd
from lightning_pose.data.datatypes import (
ComputeMetricsSingleResult,
MultiviewPredictionResult,
PredictionResult,
)
# -------------------------------------------------------------... |
dcc02fc7fb46525471e78d710b3ebc040fc378bbd0a6bb9d6bb71f6d93eb9368 | Python | 8,884 | 259 | # 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... |
5c5a9d3589a1a9c2908da84b738ea1802c659675ae361293c4393e4cefcb89e0 | Python | 8,888 | 241 | """Test cases for GroupBy.plot"""
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tests.plotting.common import (
_check_axes_shape,
_check_legend_labels,
_check_legend_marker,
)
mpl = pytest.importorskip("matplotlib")
class TestDataFrameGroupByPlots:
de... |
bd74c4bac8fcfb078c2aebb32fd4711bd9261e061db981b8ae3a5cf4f23ac301 | Python | 8,901 | 228 | """Training config/loop ported from `Training.ipynb`'s `train_3d_model`.
**Documented divergences from the legacy notebook** (see
`docs/legacy-notebooks-inventory.md`, "`Training.ipynb`" section):
- MLflow/DagsHub tracking (`mlflow.start_run`, `mlflow.tensorflow.autolog`,
`input()`-prompted credentials) is dropped ... |
b6eceac6d734edf01c53a52c31de31a7a9f79213f53ad21b4a52e246d16a335a | Python | 8,903 | 240 | from typing import Sequence, Optional, Tuple
import cv2 # type: ignore
import numpy as np
import torch
import byotrack
class TwoColorInteractiveVisualizer:
"""Interactive visualization with opencv
Keys:
* `space`: Pause/Unpause the video
* w/x: Move backward/forward in the video (when paus... |
3b48adcfa32de86c244faf8f1d4c907053fe2c098d097df127689c52a68f1b3c | Python | 8,904 | 229 | #
# 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 logging
import os
import sys
import ... |
7ef849d0ea628980b07d83e82b34574d9590c39f2a80e773324346e96d6d4bc1 | Python | 8,904 | 291 | """
Statistical significance is tested for every chromosome using the local permutated background.
"""
import gc
import numpy as np
import pandas as pd
from scipy.stats import poisson
from ioput import parseJdFile, parseIv
from utils import mesFlush
def getCorLink(cs):
"""
@param cs: [1,2,3,4], a list for th... |
0f072d81193b74878848c1ef0868e2df9cd4ae1b1b6e328785af5a5f8098a3a3 | Python | 8,909 | 263 | # 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... |
64ca8b4ccc360938581def891022f1d1f0ce8ed696426824f06f1aea7da1ab57 | Python | 8,909 | 247 | """Bound native table lifetime and allocation-failure probes in subprocesses."""
import subprocess
import sys
import pytest
from conftest import macs3_env
SCRIPT = r'''
import math
import sys
import threading
import weakref
from concurrent.futures import ThreadPoolExecutor
from unittest.mock import patch
import nu... |
444d983eb930d1dc3def1b79c32ebad3530a9a5177cb0f8706629a16890dbe11 | Python | 8,911 | 200 | import torch
import torch.nn as nn
import torch.nn.functional as F
def inverse_warping(img, left_cam, right_cam, depth):
# img: [batch_size, height, width, channels]
# cameras (K, R, t)
# print('left_cam: {}'.format(left_cam.shape))
R_left = left_cam[:, 0:1, 0:3, 0:3] # [B, 1, 3, 3]
R_right = ri... |
3b27ef105a8b5cbfab82800b86dcd7521d69e56dc647f27c5e2f59d87030786f | Python | 8,921 | 198 | #!/usr/bin/env python
import re, sys, os, argparse
from argparse import RawTextHelpFormatter
###################################################
### 0. script description and parsing arguments ###
###################################################
synopsis1 = "\
- updates 'BestHitPairs' files so that reciprocal 'c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.