sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
ab25fbe940fedfffa257c2fcabac2ed3c109ec7175fa3f643b5707d1078eaf73 | Python | 5,581 | 159 | # Calculate structure searching performance
import numpy as np
from collections import defaultdict
run_file = "run.out"
dataset_dir = "../../dataset"
known_problems = ["d6a1ia1"]
domid_to_fam = {}
fams_search = []
with open(dataset_dir + "/search_all.txt") as f:
for line in f.readlines():
cols = line.rst... |
e234880cdce6e7cbe4917bd0a7b1a0a5041d6b057fb763a8e23a2f7615474ef2 | Python | 5,582 | 191 | import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
# increase the figure size
plt.rcParams["figure.figsize"] = [12, 10]
# remove the top and right spines from plot in the global plt setting
plt.rcParams["axes.spines.top"] = False
plt.rcParams["axes.spines.right"] = False
# change the linewidth o... |
4825a8bfb854f0f50c8722647acf52e8f8bf59c719df05deea2b620d5474631f | Python | 5,584 | 94 | #! /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... |
dd993302f107ce609e2faa214d4f8e5ed82af6a84bc288802624fec44fca5752 | Python | 5,584 | 159 | # Calculate structure searching performance
import numpy as np
from collections import defaultdict
run_file = "run_tm.out"
dataset_dir = "../../dataset"
known_problems = ["d6a1ia1"]
domid_to_fam = {}
fams_search = []
with open(dataset_dir + "/search_all.txt") as f:
for line in f.readlines():
cols = line.... |
eaf6d78d6ede72c6239131d8b69a6a289fa6d5e64ede32e140c5112d7731f0de | Python | 5,584 | 199 | # 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... |
0527078a13e25154b59ed793d5c1fa117aa628f5547ab50d7832cd69c470901e | Python | 5,585 | 159 | # MIT License
#
# Copyright (c) 2020 Gabriel Nogueira (Talendar)
# Copyright (c) 2023 Martin Kubovcik
#
# 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 ... |
5e9e4c8d2bd70633a9ef59fb69f8cbe4c381e14072a144cfdf5a3da330c74988 | Python | 5,589 | 97 | """Draw the study workflow from the implemented public-data methods.
Four stages read left to right with short labels; colour separates environmental
inputs, processing, external health evidence and outputs. Detail stays in the text.
"""
from pathlib import Path
from io import BytesIO
import json
import matplotlib
mat... |
3e12a5eb39c45fe18b17109839b689f50b85871ac826b1706b1ae015c6eb518e | Python | 5,590 | 96 | # Imports
import numpy as np
np.random.seed(0)
import os
os.environ['TF_ENABLE_ONEDNN_OPTS']='0'
import matplotlib.pyplot as plt
import matplotlib.backends.backend_pdf
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import MinMaxScaler
from sklearn.decomposition import PCA
import u... |
f5731195b508de8236f2c208657723c3af501cabb5ece0c5aabab05e02fdf401 | Python | 5,590 | 119 | import io
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QHBoxLayout, QPushButton, QCheckBox, QMessageBox
from PyQt5.QtCore import pyqtSignal, Qt
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from .SpiderPlot import *
class FigureWindow(QDialog):
sgn = pyqtSignal(object) # S... |
62359dd9348a79f77df2a6075db37f95d5042faaabc90306fb892ef31b31391f | Python | 5,593 | 161 | from typing import List, Sequence
import cv2 # type: ignore
import numpy as np
import scipy.stats # type: ignore
import torch
import byotrack
def is_noise(signals: np.ndarray, threshold: float) -> np.ndarray:
"""Check if the signal matches a gaussian distribution
Args:
signals (np.ndarray): Multi... |
223c8042426ec583b006ba071baaba2fcdcbc4debe4fa59e72fffa2cb374838b | Python | 5,595 | 169 | # 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... |
86fb01f86730aceba441b2411101bec5a3c3641ae10f4107d35167d45c27be2c | Python | 5,595 | 146 | import os, re, sys
import subprocess
try:
import vcf
except ImportError:
print("Cannot import vcf! Please install pyvcf!", file=sys.stderr)
sys.exit(-1)
from phasing.io import SAMMPileUpReader as sam
from phasing.io import MPileUpVariantCaller as VC
from phasing.io import VariantPhaser
MIN_COVERAGE = 10... |
b841577daae00c189d3fbb728db4101aca1689cac6e8531b536768ad2a7d81e0 | Python | 5,600 | 126 | import os
import cloudpickle
import dask.dataframe as dd
import dask.delayed
import pandas as pd
from . import parent_classes
import glob
import compatibility
####################################################
# custom to_csv method, because the one of dask does eat all the memory
# this method has to the aim to be... |
e1d81223610c10477fe5517e24fcf531341b9931e272fc942296dda7b2672f34 | Python | 5,602 | 148 | import numpy as np
#Generate labels
def generate_label(X_train_seq, X_train_dm, X_train_other_seq, X_train_other_dm, X_train_geneid, X_train_geneid_other, X_test_geneid, positive_Gene):
gene_count = 0
gene_index_dic = {}
y_train = np.array([])
y_test = np.array([])
gene_index = []
last_gID = '... |
13a650163239e8db1d1bf206d34a96b99764a4c51bb3c237dfba31f24c099a98 | Python | 5,603 | 145 | import torch
from tnn.layers import Permute, View, LinearLayer, tLinearLayer
from tnn.networks import tFullyConnected
# from tnn.training.batch_train import train
from autoencoder_batch_train import train
from tnn.tensor_utils import dct_matrix, random_orthogonal
from tnn.utils import seed_everything, number_network_we... |
87981d7db328a4ccc99f7be7c8a699e0b7dcea7bc3c56e3eb04707a5f817e001 | Python | 5,603 | 198 | """
Numba 1D mean kernels that can be shared by
* Dataframe / Series
* groupby
* rolling / expanding
Mirrors pandas/_libs/window/aggregation.pyx
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import numba
import numpy as np
from pandas.core._numba.kernels.shared import is_monotonic_increas... |
c5f555e1d8bef4ca0214687b86b9387a9656ddcaef8d1e84fd9c8ab2606a75c5 | Python | 5,605 | 134 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import mistofrutta as mf
import wormdatamodel as wormdm
import sys
volumes_1 = []
volumes_2 = []
folder_1 = None
folder_2 = None
xlim = []
ylim = []
dz_from_logbook_um = None
for s in sys.argv:
sa = s.split(":")
if sa[0] ==... |
870c9c0e8319f9072c936f2d12490450edf9bbcb9b52d2a7cbe6540713b7f9ed | Python | 5,606 | 156 | # -*- coding: utf-8 -*-
"""
Configuration parameters for hunting behavior analysis.
This module provides a centralized configuration class for all analysis parameters,
making it easy to adjust settings without modifying the main analysis code.
Author: KerschensteinerLab
"""
from dataclasses import dataclass
from typ... |
2532a16f07e554f36149adaf0f23a03a8a9ba797ed7a79c8fc6e0912d8bc7dc8 | Python | 5,608 | 173 | #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,... |
5df141df371cc205f7a00c911d486fb0ce951b7b5b237f0b0166e248d802df3a | Python | 5,608 | 108 | """Scientific figures with all keys, north arrows and scale bars outside maps."""
from pathlib import Path
import os,json,sys
os.environ.pop('PROJ_LIB',None);os.environ.pop('PROJ_DATA',None)
sys.stdout.reconfigure(encoding='utf-8')
import numpy as np
import pandas as pd
import rasterio
import matplotlib
matplotlib.use(... |
23e51d66227dfdcd21be6cf03cfb0e84e92c3a60e3c7da5ebea96c03b162d4e7 | Python | 5,610 | 152 | # 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... |
3caf0600e38c0a09ad0a6820f81a9a2e44289d70d1ea3d3dc3742680eecc61f4 | Python | 5,614 | 170 |
import numpy as np
import scipy
from matplotlib import pyplot
from skimage import filters, morphology as morpho, io as skio
import cine
def get_horiz_edges(image: np.ndarray) -> np.ndarray:
edges = filters.sobel_h(image)
mag_edges = np.abs(edges)
li = filters.threshold_li(mag_edges)
horiz = mag_edges ... |
240950155c25487abfebee08362c964cca18d8e3e00db74b856d6d1db489bc13 | Python | 5,619 | 132 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet):
# ----------------------------------------------------------------------------------------------... |
8da7de564730598d2ad3866f03f6289fb1796350d7210dc2ea0473355bdc61dc | Python | 5,620 | 132 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet):
# ----------------------------------------------------------------------------------------------... |
a9ff7632b78360391e4f2391ee5a0a94b7cba6936263f1994deb5d8827cb2ae2 | Python | 5,620 | 157 | '''
Class to handle Speed dataset
'''
import os
import numpy as np
import os.path
import skimage
import pandas as pd
import se3lib
import utils
from dataset import Dataset
import itertools
import json
class Camera:
fwx = 0.0176 # focal length[m]
fwy = 0.0176 # focal length[m]
width = 1920 # number of ho... |
11f42b61c882868e4b3800316cd3a522e9de0670123a4a18898a867bab79016c | Python | 5,623 | 142 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.api.extensions import ExtensionArray
from pandas.core.internals.blocks import EABackedBlock
class BaseConstructorsTests:
def test_from_sequence_from_cls(self, data):
result = type(data)._from_sequence(data, dtyp... |
99d86fcd60dd96b82ee868e431f391ec74220eb4c56d7dcffcb9b72761c4c77a | Python | 5,623 | 203 | import random
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon as matplotlib_polygon
import matplotlib
import math
#from crossing import *
from utils.crossing import *
class Point(tuple):
"""docstring for Point"""
def __new__ (self, x, y):
retu... |
0b587550d3ca07fb7721400bfb640c603c286b5d25077463b2e90015a215ab58 | Python | 5,624 | 173 | ''' correlate_annotations.py
This program will correlate annotations from a spreadsheet with NeuronBridge
'''
import argparse
import collections
from operator import attrgetter
import sys
import pandas as pd
from tqdm import tqdm
import jrc_common.jrc_common as JRC
#pylint:disable=broad-exception-caught,logging-fs... |
8e444b7f226757c7dae0a2689c090401b716a0fe0e600cab0e454d85a7968cce | Python | 5,626 | 132 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet):
# ----------------------------------------------------------------------------------------------... |
d27883eeb13a99e10b429edf40ea20bac064e4f74f506fe8021a98cb12a66e6e | Python | 5,628 | 135 | #!/usr/bin/env python
__author__ = 'etseng@pacb.com'
import pdb
"""
Demultiplex IsoSeq (SMRT Link 8.0) job output (with genome mapping)
"""
import os, re, sys
from csv import DictReader, DictWriter
from collections import defaultdict, Counter
from Bio import SeqIO
mapped_id_rex = re.compile('(PB\S*.\d+[.\d+]?)')
def... |
99edca96e23d84e2c4421f223e4919dc6cf94253e26d3e2cce6362cbdbb72ca0 | Python | 5,629 | 151 | import datetime as dt
from datetime import date
import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
class TestDatetimeIndex:
def test_is_(self):
dti = pd.date_range(start="1/1/2005", end="12/1/2005", freq="ME")
assert dti.is... |
5284aeffc54b3333477f5b54391c8861fc77029cd12f01d185f49296206712d8 | Python | 5,633 | 133 | # cython: language_level=3
# Time-stamp: <2024-10-04 11:45:30 Tao Liu>
"""Module description:
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).
"""
# ------------------------------------
# python modules
# ---... |
bc9d468bcfd0a4b4a99f2c1af6c6751ed858e92cd27bc54188f4dba6507b20c0 | Python | 5,633 | 141 | import torch
import numpy
import bionetwork
import plotting
import pandas
import argparse
from scipy.stats import pearsonr
import time
#Get data number
parser = argparse.ArgumentParser(prog='Macrophage simulation')
parser.add_argument('--selectedCondition', action='store', default=None)
args = parser.parse_args()
cure... |
1abad41be1213c99431045b4822b30a84b8f7559991cfa827fc81c688b40972f | Python | 5,635 | 191 | from __future__ import annotations
import importlib
import sys
from typing import (
TYPE_CHECKING,
Literal,
overload,
)
import warnings
from pandas.util._exceptions import find_stack_level
from pandas.util.version import Version
if TYPE_CHECKING:
import types
# Update install.rst, pixi.toml,
# deps... |
26a6df825234537a225a77c319124b7f190f77f8a53c1e86b9b119f63f09151c | Python | 5,635 | 154 | from PyQt5 import QtWidgets, QtCore
import pyqtgraph as pg
from brainflow import BoardShim, DataFilter, DetrendOperations
from brainflow.board_shim import BrainFlowInputParams, BoardIds, LogLevels
import pandas as pd
import time
import sys
import logging
# ------------------- Logging Configuration ------------------- ... |
5baf1dce09beaa2802a50760221a1798055943938392294fabca70c454c3da84 | Python | 5,636 | 189 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# kCSD-python documentation build configuration file, created by
# sphinx-quickstart on Sat Jun 15 16:08:11 2019.
#
# 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
... |
6ba9accb66e9a8df6d65787b47b8ca1db8b4d00d3a0007821cb9462a0ac9101e | Python | 5,636 | 156 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from dclab.features.emodulus import get_emodulus
settings = [{"channel width": 15,
"flow rate 1": 0.016,
"flow rate 2": 0.032,
"flow rate 3": 0.048,
"x range": [10, 170],
... |
055278fa7e9ac3c9a93a4db36aee8736b4569b74be92c7c72af3f4155d310e34 | Python | 5,638 | 194 | """
Ops for masked arrays.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
from pandas._libs import (
lib,
missing as libmissing,
)
if TYPE_CHECKING:
from pandas._typing import npt
def kleene_or(
left: bool | np.ndarray | libmissing.NAType,
right: bo... |
a9631a81a851539fef6b7f72f269f8ce4ce0cfb943852ab8634618f52e940599 | Python | 5,638 | 212 | """
Boilerplate functions used in defining binary operations.
"""
from __future__ import annotations
from functools import wraps
from typing import TYPE_CHECKING
import warnings
import numpy as np
from pandas._libs.lib import (
is_list_like,
item_from_zerodim,
)
from pandas._libs.missing import is_matching_... |
e06eebbd98cb5b8c9b8310799535dc453445b4e1a1c4afa945017f1ca5fdad35 | Python | 5,638 | 173 | import sqlite3
import numpy as np
from sqlalchemy import create_engine
from pandas import (
DataFrame,
Index,
date_range,
read_sql_query,
read_sql_table,
)
class SQL:
params = ["sqlalchemy", "sqlite"]
param_names = ["connection"]
def setup(self, connection):
N = 10000
... |
6a58936e715fae144edcc9e0d51c2293a33203d3185777f8aadcb2d00d139ba2 | Python | 5,639 | 161 | # 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... |
cf6d1a2dabdde4bfa1db9186e01c8f4ef20bc8e9bf0fe3bf51f36ac5fbe1f001 | Python | 5,642 | 138 | #!/usr/bin/env python
"""Bedtools does not lie or cheat"""
import argparse
from collections import defaultdict
import re
from FEICP import open_file
from scipy.stats import binomtest
import numpy as np
import sys
EXON_INTRON_JUNC_LEN = 5
def parse_args():
parser = argparse.ArgumentParser(
... |
813301cb0c707410421f2f0422d935c67de9cc3aed24742cd2c61220b630bbd0 | Python | 5,644 | 149 | """
This module contains methods that can be used in various plot modules and don't really belong to a specific module
"""
# matplotlib was removed from core deps in 4.0.0a1. Lazy-imported so the
# legacy MatplotlibDefaultDPI helper's no-op path is available without pulling
# matplotlib into every pycaret install.
try... |
146b1670f01f21f1f8ec3c062dca0266fac14f07847a44c9f44207a58f817fa3 | Python | 5,645 | 143 | """Soft iterative refinement metrics.
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from .sgc_resnets import SGCAutonomousStage
def layer_dropout(stage, inp, final_fun, eval_mode=False):
"""Layer dropout: compute metric required for Recurrence Index.
Args:
block: Set of res... |
c1ee56af18abaa185141327720ad2f6e97ea1d3f5127a0a49d86065d8393cabc | Python | 5,645 | 185 | """Build-time generator for the Clock Explorer data.
Downloads the public aggregate clock metadata from Hugging Face and writes:
- docs/_static/clocks.json (array consumed by the Explorer front-end)
- docs/_static/clock_glossary.csv (download + no-JS fallback)
"""
import argparse
import json
import math
import ... |
2d53f18e9da6bf8c401e45243c0c243f2636f52301567dfceea95b63f54d92b4 | Python | 5,646 | 174 | #initialization.py
from initialization.config import *
import os
import shutil
import datetime
import warnings
warnings.filterwarnings("ignore")
TIMESTAMP = str(datetime.datetime.now()).replace(':', '-').replace('.', '-').replace(' ', '_')
# print('Dataset in current notebook: ',DATASET_SHORTNAME)
print('Initializ... |
f29ce0238a8ec0d052003c5ec2783e1518ab3b1558e6d39843765fc7eb6c880d | Python | 5,647 | 175 | """Encoding limits dataclass."""
import dataclasses
from dataclasses import field
from ismrmrd.xsd.ismrmrdschema.ismrmrd import encodingLimitsType, encodingType, ismrmrdHeader, limitType
from typing_extensions import Self
@dataclasses.dataclass(slots=True)
class Limits:
"""Limits dataclass with min, max, and ce... |
5ce243d5ce13f96f7e6ca70387dc6cda6b60517bddac6019bda033aa1e376cc5 | Python | 5,648 | 169 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays.sparse import SparseArray
@pytest.mark.parametrize(
"kwargs",
[
{}, # Default is check_exact=False
{"check_exact": False},
{"check_exact": True},
],
)
def test_assert_extensi... |
c92dcb8553356db9d77e4c99c5f6ed6c9d8ac68f60e4efe62b79aa6596df73ca | Python | 5,648 | 147 | """LBFGS for solving non-linear minimization problems."""
from collections.abc import Callable, Sequence
from typing import Literal
import torch
from torch.optim import LBFGS
from typing_extensions import Unpack
from mrpro.algorithms.optimizers.OptimizerStatus import OptimizerStatus
from mrpro.operators.Operator imp... |
3ffe493d920083bc3241ff3ba0c312e295b1c48f539fadc19c157268508caac5 | Python | 5,653 | 180 | # -*- coding: utf-8 -*-
import json
import numpy as np
from scipy.interpolate import interp1d
ERROR_PROBABILITIES_JSON = "config/error_detection/probabilities.json"
class ErrorDetection(object):
def __init__(self, config_file=ERROR_PROBABILITIES_JSON):
"""
Class is used for the creation of a er... |
af8221ac0fc055b46c0dd0306d2315ce6e4b4d6639f622efb6d6ac8b71692ec1 | Python | 5,654 | 151 | '''
date: 15.09.2016
autor: arco bast
the manylines function allowes to make plots in parallel
'''
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import dask.dataframe as dd
import dask
import unittest
from model_data_base.plotfunctions._figure_array_converter import fig2np, PixelObject
fro... |
08b80eaef1572769f7091928a0da388e9fa390480c379681e152916ab546c843 | Python | 5,655 | 132 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet):
# ----------------------------------------------------------------------------------------------... |
6a9180d78d1833ada1a65d06bae94105e67ff58c6a9f7c2a5b540e2de49f424c | Python | 5,656 | 132 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet):
# ----------------------------------------------------------------------------------------------... |
4df41d4d328e5d3fc5186d1f4816e37484e12e2f9ecfec560928039c8968ca98 | Python | 5,657 | 132 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet):
# ----------------------------------------------------------------------------------------------... |
85407279bb200b54cfa3b94aaf0791d4a35c07b125f7b6e560f95cf2836192bd | Python | 5,659 | 209 | from io import StringIO
from string import ascii_uppercase
import textwrap
import numpy as np
import pytest
from pandas._config import using_string_dtype
from pandas.compat import (
HAS_PYARROW,
PYPY,
)
import pandas as pd
def test_info_categorical_column_just_works():
n = 2500
data = np.array(lis... |
8af4cd90fc04496b2a2be493ad34f50faa129dca13cbc75a80e35788c48982d7 | Python | 5,665 | 131 | #!/usr/bin/env python
import argparse
import os
import pandas as pd
from common import fileopen
from compute_simulated_accuracy import summary_fields
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", default="-")
parser.add_argument("-o", "--output")
parser.add_argumen... |
222613f3931b96135b840e2f9d9bee17c891d892900795f8ef04ee9fc3151823 | Python | 5,666 | 136 | import os
import subprocess
import sys
import tempfile
import unittest
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[1]
RUN_TREESHRINK = REPO_ROOT / "run_treeshrink.py"
def write_tree_fixture(path):
with open(path, "w") as tree_file:
for i in range(1, 11):
tree_file.w... |
f77107483aeebf1b7b63f4e56e1d9b77c2197fb6a278966aa080a61fb5c98e60 | Python | 5,668 | 151 | from datetime import (
UTC,
timedelta,
)
import pytest
from pandas._libs.tslibs import timezones
import pandas as pd
import pandas._testing as tm
class TestTZLocalize:
def test_series_tz_localize_ambiguous_bool(self):
# make sure that we are correctly accepting bool values as ambiguous
... |
dd317fa68067bcc9a0cb357a27af23c940bb18740184c5b33a5986ddfc5eee48 | Python | 5,669 | 209 | import numpy as np
import matplotlib.pyplot as plt
# increase the figure size
plt.rcParams["figure.figsize"] = [12, 10]
# remove the top and right spines from plot in the global plt setting
plt.rcParams["axes.spines.top"] = False
plt.rcParams["axes.spines.right"] = False
# change the linewidth of the axes and spines
... |
4ded2ed1dda74800d27709588b1c6c071221f25a0f84780c30d1dabbbfe9dc36 | Python | 5,670 | 168 | from sys import path as sys_path
sys_path.append('..')
sys_path.append('../base')
import os
import matplotlib
if os.name == 'posix' or 'DISPLAY' in os.environ:
use_display = True
matplotlib.use('qt5Agg')
else:
use_display = False
matplotlib.use("Agg")
print(os.environ)
import matplotlib.pyplot as pl... |
d2a53ac5c5beabc85fa838b2c085396be281836937c8a1ad855ec39f785d00b5 | Python | 5,670 | 167 | import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
from pandas.api.types import is_bool_dtype
@pytest.mark.parametrize(
"data, index, drop_labels, axis, expected_data, expected_index",
[
# Unique Index
([1, 2], ["one", "two"], ["two"], 0, ... |
e7a4ed94e82e41221f5e7720f9e9492ea4e33d07132a65010133fe58a89f4a5d | Python | 5,670 | 160 | # Calculate structure searching performance
# Run `gunzip run_nn_allatom.txt.gz` first
import numpy as np
from collections import defaultdict
results_file = "run_nn_allatom.txt"
dataset_dir = "../../dataset"
known_problems = ["d6a1ia1", "d1qdma1", "d1jqga2", "d1ayea2", "d1kwma2", "d1ldtl_"]
domid_to_fam = {}
fams_se... |
d6d69d6a0deac2859feb3c4fd3c20d6478a57bb75e798f216e538e2575a020b1 | Python | 5,671 | 158 | # 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... |
d934d0c42fa36183ec1c375f2692de7ae24ee46e6f779c2a6fa169af78e46426 | Python | 5,672 | 170 | # -*- coding: utf-8 -*-
"""Console script for tractify."""
import os
import sys
import click
import subprocess
from bids import BIDSLayout
from . import utils
from .workflows.base import init_single_ses_wf
class Parameters:
def __init__(
self,
t1_file,
fs_file,
rawavg_file,
... |
ac077fc08b7218db9907507c7496ba5cebadaf39e5838014076ea6679fd60941 | Python | 5,677 | 161 | # 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... |
cd40bc1354ff1d8e904a188bc7d23bece6405b54dea6a94163f911cc6f210684 | Python | 5,679 | 189 | from pathlib import Path
from typing import Optional, Tuple, Union
import dataclasses
import cv2
import numpy as np
from numpy.lib.arraysetops import isin
import scipy.stats as stats
@dataclasses.dataclass(frozen=True)
class Image:
data: np.ndarray
@property
def height(self):
return self.data.sh... |
0a2549e712945ea618f88f0a39343c7ec3c7a75e53d4d7e18a6c45915336ff4a | Python | 5,682 | 133 | """Convolutional Synthesis Dictionary Operator."""
import warnings
from typing import Literal
import torch
from torchnd import adjoint_pad_nd, conv_nd, pad_nd
from mrpro.operators.LinearOperator import LinearOperator
class ConvSynthesisDictionaryOp(LinearOperator):
"""Convolutional Synthesis Dictionary Operato... |
cf7f30c13b9a7b94021e441f867a901bdc6d9fe3fd373391336adb0abaa026a6 | Python | 5,682 | 131 | import pandas as pd
import numpy
def contains(haystack, needles):
result = numpy.full(len(haystack), False, dtype=bool)
for curNeedle in needles:
result = numpy.logical_or(result, [curNeedle in x for x in haystack])
return result
human = 9606
trustedSource = numpy.array(['KEGG',
'Inn... |
cb87d05a860211907a70aa0d84e2525295f1029e9935f2959532d7370fd14477 | Python | 5,686 | 150 | import torch.nn as nn
import torch.nn.functional as F
from AYN_Package.DataSet.ForObjectDetection.VOC_nwpu import *
import torch.nn as nn
from tqdm import tqdm
import numpy as np
import os
from torch.utils.data import DataLoader
from AYN_Package.Task.ObjectDetection.D2.YOLO.V4 import *
from AYN_Package.Optimiz... |
e2c79083d3180e88623da8dc4e0c3d05089b267baabf910a3a226392d5e1ed1b | Python | 5,688 | 180 | import sys
import os
from numpy import nan
import math
import pandas as pd
import argparse
import csv
if __name__ == '__main__':
argparser = argparse.ArgumentParser('''
Extract eye-tracking time series from MECO eye-tracking corpus source.
''')
argparser.add_argument('sentitems_path', help='Path to fil... |
5386a7ffdcc5dc32f59500a817152a5932d7378331a6385ea26b54c685de3d3a | Python | 5,696 | 176 | # 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... |
9cbf2925ab756759e9b975aac012df38766e6637766c8814290939304d41c800 | Python | 5,696 | 203 | #funcsall.py
from placerg.funcs import *
from placerg.funcsrg import *
from placerg.objects import *
import copy
def fieldshist(env):
pl=env.fields[:,:,env.nonplacecell].flatten()
plott=drawpdf(pl, 100)
return plott
def hamhist(env):
pl=env.h[:,:,env.nonplacecell].flatten()
plott=drawpdf(pl, 100)... |
b64130727185b2912a3be422838b92a645131e3752792addfa2269544201cd18 | Python | 5,696 | 115 | import os
import pandas as pd
#read gff file with de novo gene coordinates
def read_gff_to_df(gff_file):
coord=pd.read_csv(gff_file, sep="\t", names=["chr","program","annotation","start","stop","x","strand","y","name"])
coord=coord[["chr","annotation","start","stop","strand","name"]]
return coord
#read fi... |
4561858ad59cd1a09635c10b4b4dd42f3cd8d25ddd36d3db77ec222155c888bb | Python | 5,698 | 142 | """Heatmap generation and evaluation utilities."""
import numpy as np
import torch
from jaxtyping import Float, Int
# to ignore imports for sphinx-autoapidoc
__all__: list[str] = []
def generate_heatmaps(
keypoints: Float[torch.Tensor, 'batch num_keypoints 2'],
height: int,
width: int,
output_shape:... |
6e44ff8faa0b644ffc77b529a80838ee2a1bc1316c23ad1ac5e35ac95aa30d2f | Python | 5,699 | 148 | # 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... |
18fb5637b4824664b68e88d05d5b9bf3656d35b69dcd5e3f333a839c701eb77d | Python | 5,704 | 149 | """Screenshots for documentation
Data available at https://doi.org/10.6084/m9.figshare.11302595.v1
"""
import pathlib
import sys
import dclab
from PyQt6 import QtCore
from PyQt6.QtWidgets import QApplication
from shapeout2.gui.main import ShapeOut2
from shapeout2 import session
app = QApplication(sys.argv)
QtCore.Q... |
aa9739d38d8616f7a8fed7ec669847cb6e7bcfd0eec72fa5e2a93760b856550b | Python | 5,704 | 145 | """Spiral trajectory calculator."""
import torch
from mrpro.data.KTrajectory import KTrajectory
from mrpro.data.SpatialDimension import SpatialDimension
from mrpro.data.traj_calculators.KTrajectoryCalculator import KTrajectoryCalculator
from mrpro.utils.reshape import unsqueeze_left
from mrpro.utils.unit_conversion i... |
b9e154d9e7cc387b9a1f1a29048e414ea101da7ee617752eee0e00c55d807fac | Python | 5,707 | 182 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.api.types import (
is_complex_dtype,
is_numeric_dtype,
)
from pandas.core.indexes.datetimelike import DatetimeIndexOpsMixin
def test_numpy_ufuncs_out(index):
result = index == index
out = np.empty(index.sha... |
2b81d276b829116a52348de5ae8d6e57bd508ed05078d7db08efa1bb4d2ee6ff | Python | 5,714 | 187 | import time
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.metrics import roc_curve, auc
import numpy as np
import tensorflow as tf
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
from sklearn.model_selection import tr... |
a3129fc8d4111d733d7972c382d466cab8642d9eabbaf72e56bcdb658f77e0ff | Python | 5,714 | 177 | import matplotlib.pyplot as plt
from sklearn.metrics import r2_score
import os
import numpy as np
import pickle
def plot_performance(test_labels, y_pred, title = 'CNN', save_path = None):
"""
Plot model performance with scatter plot of observed vs. predicted values.
Parameters:
te... |
067609b80e0a801eda375974d25fbd4db85bc0ebafe67871eb93af9bc22d11d7 | Python | 5,715 | 202 | from datetime import datetime
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tseries.offsets import BDay
def test_map(float_frame):
result = float_frame.map(lambda x: x * 2)
tm.assert_frame_equal(result, float_frame * 2)
float_frame.map(type)
# GH 465... |
bf9fb20782e1647865150dd8601e7efaf907b576d7b2d18ad468c0e08cc3c411 | Python | 5,715 | 167 | # 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 agree... |
7fb384f89593b2006df67809b5c0174cd8b4d38d7868d55475843fa267ae0da6 | Python | 5,722 | 181 | from decimal import Decimal
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestDataFrameUnaryOperators:
# __pos__, __neg__, __invert__
@pytest.mark.parametrize(
"df_data,expected_data",
[
([-1, 1], [1, -1]),
([False, True], [T... |
ff8eea694120fc790c0d04662af196ee7d363866ad4a3c09df7da2b088575952 | Python | 5,723 | 161 | __all__ = ["PeptideSpectrumFilter"]
from typing import Iterable, Mapping, Sequence, TypeVar, Union, cast
import numpy as np
import numpy.typing as npt
from ..common.filter import SpectrumFilter
from .spec import PeptideMS2SpectrumProto
MS2SpectrumType = TypeVar("MS2SpectrumType", bound=PeptideMS2SpectrumProto)
cl... |
6ecc11126564f5ea8fdbed6b23e291eb36f3a5b7b694003c4249b860be946bcb | Python | 5,727 | 175 | """Test extension capabilities"""
import pathlib
import shutil
import tempfile
import pytest
from dclab.rtdc_dataset import feat_anc_plugin
from shapeout2 import extensions
data_path = pathlib.Path(__file__).parent / "data"
@pytest.fixture(autouse=True)
def cleanup_plugin_features():
"""Fixture used to cleanu... |
5c6110f15d418050238b2d71e817cd81d2fd23e1a657e4eba271e3caac38f96c | Python | 5,734 | 136 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 15 22:22:41 2021
@author: Wladek
"""
import numpy as np
import pylab as py
from scipy.signal import filtfilt, butter, detrend, argrelmax, argrelmin
from scipy.stats import pearsonr
from kcsd import oKCSD3D
from mayavi import mlab
import sov_funcs as sf
import scipy.io
f... |
be846cc4cc07bf2b21120f8bf4880828c2254a5b649556f84bb6abd3bde404d4 | Python | 5,735 | 173 | """Phase 0-v2 trial-centric read API.
The legacy ``/runs/{run_id}/trials/...`` routes are the primary surface
(every Trial belongs to one Run via ``Trial.run_id``). These endpoints
exist as a convenience for the cross-experiment views — "every Trial
in this Experiment" — and for direct deep-linking by trial id.
Endpo... |
558226d5d41cf7f0137ecbcdfa9281da1804d4ee76d7d82a5207157f68d08ae8 | Python | 5,737 | 155 | from logging import Logger
from typing import Literal, Optional
import numpy as np
import pandas as pd
COLUMN_RUN_NAME = "run_name"
COLUMN_RT = "retention_time"
COLUMN_CALIBRATED_RT = "calibrated_retention_time"
COLUMN_ORIGINAL_RT = "original_retention_time"
class RetentionTimeCalibrator:
def __init__(
... |
57694e9e7a8f6af294e0d4575366e4d59373e906638452dc231efcf902b91467 | Python | 5,737 | 159 | import glob
import vuba
import cv2
import numpy as np
import re
from tensorflow import keras
import tensorflow as tf
import pandas as pd
from tensorflow.keras import layers
import matplotlib.pyplot as plt
import multiprocessing as mp
from tqdm import tqdm
from typing import Tuple
import atexit
import time
import os
imp... |
c8abca6108fb543c1548262f89bb76cc7eca070f5408eea0df3d9c75651e2fb3 | Python | 5,737 | 164 | # 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... |
160f35aa55bb6cd47553073b9c35346a6a2a075f5852f37522d572cfb566c1e1 | Python | 5,738 | 149 | #!/usr/bin/env python3
"""
Description:
This module performs hierarchical clustering on DTU events detected by SPIT.
It creates dendrograms and heatmaps to visualize sample clustering patterns
based on differential transcript usage events.
Usage:
./cluster_samples.py -l <pheno> --include_shared_dtu -... |
05244b64054f1a74e67e34915ed0f37677a3d1674671ae4793d516cfb6c78e65 | Python | 5,739 | 173 | #
# calculation of synthetic accessibility score as described in:
#
# Estimation of Synthetic Accessibility Score of Drug-like Molecules
# based on Molecular Complexity and Fragment Contributions
# Peter Ertl and Ansgar Schuffenhauer
# Journal of Cheminformatics 1:8 (2009)
# http://www.jcheminf.com/content/1/1/8
#
# se... |
786d2377069fcba1f2554eddfb058a89efcc4353ad765fd72f9f1e12b2d50fb9 | Python | 5,741 | 178 | #%%
#Imports
import numpy as np
import os
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
import matplotlib.animation as animation
import matplotlib.backends.backend_pdf
# plt.style.use('seaborn-talk')
matplotlib.rcParams['lines.linewidth'] = 0.5
matplotlib.rcParams['lines.markersize'] = 1
mat... |
f1e947a175c1355c967f5979b0602e797d8bafd587ad776b7584d8bbf77957ed | Python | 5,741 | 153 | import numpy as np
class YOLOV4DataSetConfig:
root_path: str = 'F:/RSI/NWPU'
image_net_dir: str = 'F:/RSI/NWPU/JPEGImages'
# data set root dir
image_size: tuple = (608, 608)
image_shrink_rate: dict = {
'for_s': (8, 8),
'for_m': (16, 16),
'for_l': (32, 32),
}... |
79af0b9cf94792ce2e07120d9638da0309c8a27793f87b72ad3b2a95cc07a51b | Python | 5,750 | 134 | #!/usr/bin/env python3
from src.hash_realign.classes import Sequence
from src.hash_realign.classes import Segment
from src.hash_realign.hash_aligner import HashAligner
from src.cigar_op import fetch_ref_seq, DetailCigar, HyperCigar
def select_longest(segments):
longest_true = []
longest_false = []
for se... |
cef59f3d6ddda6d30937e9cf8a369e26ef3b3accadacc820ea9d3823a9c77836 | Python | 5,751 | 151 | # 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... |
4799ae055ff74ea8c5a6206abf4bc86b3affd43b6695e6c8a023aa0b4600ab65 | Python | 5,753 | 144 | import os
import cv2
import random
import torch
import numpy as np
from PIL import Image
from cvtransforms import transforms
from cvtransforms import functional as tf
import datetime
class Augmentations_PIL:
def __init__(self, augment_mode,h,w):
self.augment_dict=augment_mode
self.imag... |
4c91c0a1e211f94844379cd3c805cfed9b65c131abd4fd2e5efbf7fc41c5ad7b | Python | 5,754 | 175 | # 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... |
f1a6ad8deba0815eda30487a44df4a34a1228bcf62e09f955e2ea094be244ac4 | Python | 5,758 | 139 | """Convolutional Analysis Dictionary Operator."""
import warnings
from typing import Literal
import torch
from torchnd import adjoint_pad_nd, conv_nd, pad_nd
from mrpro.operators.LinearOperator import LinearOperator
class ConvAnalysisDictionaryOp(LinearOperator):
"""Convolutional Analysis Dictionary Operator."... |
ec600cca717341e74b2b47463197b77251f7fe610f9617a1bffa814e9844ef2c | Python | 5,762 | 149 | """GAE (Generalized Advantage Estimation) with optional Triton acceleration.
Provides compute_gae() which automatically dispatches to a Triton kernel
when available and enabled, otherwise falls back to the PyTorch loop.
Disable Triton: export RLG_NO_TRITON=1
"""
import torch
from rl_games.triton_config import USE_TR... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.