sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
f9770c1953e4453cddd3118d4a577221d249d896b8b36a94bd954d08e7952a73 | Python | 10,779 | 291 | #Basics
import numpy as np
import sys
import os
import csv
import time
import random
import pandas as pd
import scipy
sys.path.append('../../')
#sklearn
from multiprocessing import cpu_count
from sklearn.utils import shuffle
#Pytorch
import torch
from torch import nn
from torch.nn import functional as F
from torch.u... |
193be5c9862a7180028add4e65ec05ef29f5a417127a540fe1e90a8ea3c98e56 | Python | 10,780 | 248 | import numpy as np, matplotlib.pyplot as plt, sys
import pumpprobe as pp, wormdatamodel as wormdm
from scipy.optimize import curve_fit
sort = "--sort" in sys.argv
pop_nans = "--pop-nans" in sys.argv
stamp = "--no-stamp" not in sys.argv
SIM = "--sim" in sys.argv
use_kernels = "--use-kernels" in sys.argv
drop_saturatio... |
5ea43ecd52487cfe64d69a3d0cdd212f5204cbf585ec28d0242ba7e0a34c557c | Python | 10,781 | 276 | import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
from pandas.tseries.offsets import Hour
class TestTimedeltaIndex:
def test_union(self):
i1 = pd.timedelta_range("1day", periods=5)
i2 = pd.timedelta_range("3day", periods=5... |
7ab6fefac5f4089173011e430f271938dd7d9e485dc4b7a20a37fc9cd9d7f688 | Python | 10,782 | 315 | # 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... |
83664dbae928ce2d206817c374d0dc25439b6382dffd93f9479076a05585010f | Python | 10,789 | 331 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 9 10:54:53 2023
code to produce the supplementary figures
@author: simon.kern
"""
import json
import compress_pickle
import matplotlib.pyplot as plt
import mne
import numpy as np
import pandas as pd
import seaborn as sns
from joblib import Parall... |
0fa19da628b89b2c1aa97053010704a7d78e5216199d3730dada486353031c1c | Python | 10,791 | 218 | #!/usr/bin/env python
#-*- coding: utf-8 -*-
# PROGRAM : a workflow for eccDNA analysis
# AUTHOR : xiaoning.hong@outlook.com
# CREATED : Thu June 09 2022
# VERSION : V1.0.0
# UPDATE : [V1.0.0] Thu June 09 2022
import os,sys,re
from argparse import ArgumentParser
from collections import defaultdict
sys.path.append(os... |
5b476c73c798f7866cc01493dc23f03fdba391bfaca1e5dd2d5f582fac9a56ec | Python | 10,793 | 336 | """
Module for formatting output data into CSV files.
"""
from __future__ import annotations
from collections.abc import (
Hashable,
Iterable,
Iterator,
Sequence,
)
import csv as csvlib
import os
from typing import (
TYPE_CHECKING,
Any,
cast,
)
import numpy as np
from pandas._libs import... |
ad84a8bd1ac81a2c2d1374704c879908d10956f335de73905e46e486fe53bcb3 | Python | 10,794 | 331 | #!/usr/bin/env python
"""
Utility functions for BASALT deep learning components.
This module provides helpers for downloading model weights, normalising
feature matrices, managing logging directories, training and evaluating
PyTorch models, and computing focal loss.
"""
import os
import sys
from glob import glob
fr... |
9ee9feb400470999ffc60c5e750c4019a9445c416ab73b9ab29d14c60d2d737c | Python | 10,798 | 298 | import sys
import os
import re
import numpy
import random
import collections
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'resource-gcg', 'scripts'))
import tree
import gcgtree
import semcuegraph
import morph
numpy.set_printoptions(linewidth=200)
I = 100 ## number of iterations
Y... |
d28b16f66744537932223848540ad596beffd676e580cb80aca7fcb55f29b052 | Python | 10,802 | 252 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for GCPNet (https://github.com/BioinfoMachineLearning/GCPNet):
# ----------------------------------------------------------------------------------------------... |
d56a49c6dd09e99a0c439c53b3be4c780c6a4f253e34c583a917460764db1496 | Python | 10,803 | 296 | """test feather-format compat"""
from datetime import datetime
import warnings
import zoneinfo
import numpy as np
import pytest
from pandas.compat.pyarrow import (
pa_version_under18p0,
)
import pandas as pd
import pandas._testing as tm
from pandas.io.feather_format import read_feather, to_feather # isort:ski... |
3b303d42b7bd6740820187334933fd4df54ba70a0c3d3afc8813adceb074ddf4 | Python | 10,804 | 223 | # 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... |
93340b01164fa8e8ccca229d94e5f8ce966c63192703cf49457d1f32f4f2a29c | Python | 10,805 | 283 | from __future__ import annotations
from contextlib import (
AbstractContextManager,
contextmanager,
nullcontext,
)
import inspect
import re
import sys
from typing import (
TYPE_CHECKING,
Any,
Literal,
cast,
)
import warnings
from pandas._libs import lib
if TYPE_CHECKING:
from collecti... |
bf101f92917abd9b9b71d9ff588a826309d41b476e3ebffe74045a61a4e8190f | Python | 10,805 | 300 | # Copyright (C) 2019-2024 PyCaret
#
# Module: containers.metrics.classification
# Author: Antoni Baum (Yard1) <antoni.baum@protonmail.com>
# Contributors (https://github.com/pycaret/pycaret/graphs/contributors)
# License: MIT
# The purpose of this module is to serve as a central repository of classification metrics. T... |
f5d278c61ba1f947af10acd5dc4895472980fc4518795335953b12198edd31d6 | Python | 10,805 | 293 | # Copyright 2018-2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or... |
557730893ab9a3e25264763749b6586e65a8ddcca5d94ed0d57e9d7978d69ed4 | Python | 10,806 | 384 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 14 20:43:48 2021
@author: reisertm
"""
import sys
import os
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as npss
import tensorflow as tf
import math
from tensorflow.keras import Model
from tensorflow.keras import layers
... |
4214c285719fa7a31b6bdc5a8647a24801b61f1de201eb27c462d600f85d931b | Python | 10,808 | 332 | """Render CITATION.cff from template and git history.
Reads contributor data from ``git log``, orders
authors by total lines added (descending), and
generates CITATION.cff from a Jinja2 template with
rich author metadata (ORCID, affiliations).
"""
import re
import subprocess
from collections import defaultdict
from d... |
308d4260432a04b1f742da28d34ac2bb4d1117f76b6e2b2ca54f2ea6a203951f | Python | 10,815 | 270 | import numpy as np
import matplotlib.pyplot as plt
import dask
import os
import glob
import IPython
import jinja2
import functools
from base64 import b64encode
import multiprocessing
from ..utils import chunkIt
html_template = 'animation_template.html'
def find_nearest(array, value):
'https://stackoverflow.com/q... |
94e52c27ed3e5324a9d7a2d8748d80631363c2fa6afdd768edbe711090d530f6 | Python | 10,817 | 337 | """Plotly-native clustering diagnostics.
Functions:
- ``elbow_curve`` — sum-of-squared-distances vs. k for KMeans-family
models.
- ``silhouette_curve`` — silhouette score vs. k.
- ``silhouette_plot`` — per-sample silhouette for the chosen model.
- ``cluster_distribution`` — bar of cluster sizes.
- ``embedding_2d`` ... |
89295b8c46d9d3b6c360870fc7e7f2d45042d38d8540ec4f279e96badcd959d3 | Python | 10,819 | 193 | # Copyright 2019 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
b025c642d7b472d85fcad91523750422ce5aaa0b7506ff78bcdd946c57903113 | Python | 10,821 | 300 | # -*- coding: utf-8 -*-
"""
@author: Barisoo
This file allows for easy extraction of the following features cif files,
particularly for metal-organic frameworks:
number of hydrogen atoms per unit cell
number of carbon atoms per unit cell
number of nitrogen atoms per unit cell
number o... |
a8168d0452ba970969e2f03bd0ef0d5c9cf06e5ed269356928ff06d59927d931 | Python | 10,825 | 294 | '''
Given either a single file of region data (match_genes) or a set of serveral
region data files produced by different discriminators, find and filter the
gene data corresponding to the given regions, using provided reference files
Author: Rebecca Riley
Date 6/12/23
'''
import json
import optparse
from from_refseq ... |
aefd28be2bffaaaef9811ebe68a60d008d966fb6cf868932e14cc35e94858784 | Python | 10,826 | 267 | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 6 09:40:11 2021
@author: fm02
"""
# plot average activity for each vertex, for each participant
import numpy as np
import pandas as pd
import pickle
import os
import mne
from mne.minimum_norm import read_inverse_operator
import warnings
warnings.filterwarnings('ignor... |
8e03a337867639411913a7a6f72fe53d2b3863c78c9b9bde177fdf8123964826 | Python | 10,827 | 295 | # 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... |
26731d4907b3fe886f0f18bbd1207ca30a8576c847788bb7c032100189331736 | Python | 10,830 | 325 | # 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... |
be68ff046052d7d68e7f92dea21ee1908e1650df739bcafeab0bc9d8fff0481c | Python | 10,830 | 287 | # Copyright (c) Facebook, Inc. and its affiliates.
import collections
from dataclasses import dataclass
from typing import Callable, List, Optional, Tuple
import torch
from torch import nn
@dataclass
class Schema:
"""
A Schema defines how to flatten a possibly hierarchical object into tuple of
primitive ... |
ccde8d90e924da8002b050fa8398421722f8bbbe628684e08a4bf0f39bc1e0e3 | Python | 10,832 | 308 | import logging
import os
import sys
import random
import matplotlib.colors as mcolors
import numpy as np
import string
import time
import yaml
from collections import OrderedDict
from functools import singledispatch, update_wrapper
angle_vals = [180, 157, 135, 112, 90]
distance_vals = [0, 1, 2, 3, 4]
exp_params = Or... |
4ed2ee36e77a7ba4f7b7517f614edc4ec383722fb120dbacc463865ad9f23755 | Python | 10,835 | 349 | from __future__ import annotations
import functools
from typing import (
TYPE_CHECKING,
Any,
)
import numpy as np
from pandas.compat._optional import import_optional_dependency
from pandas.core.util.numba_ import jit_user_function
if TYPE_CHECKING:
from collections.abc import Callable
from pandas.... |
c4a207aaa44debde3a6fae5c736828de94720c0d4ad82bcf97ba875f801d18e1 | Python | 10,839 | 234 | """Conjugate gradient operator."""
from collections.abc import Callable
from typing import TYPE_CHECKING, TypeVar
import torch
from torch.autograd.function import once_differentiable
from mrpro.algorithms.optimizers.cg import cg
from mrpro.operators.LinearOperator import LinearOperator
from mrpro.operators.LinearOpe... |
67891f57b587f628d88ff6b23f9b4a02d3a9973ca527c9c703dbdd4146fc96d7 | Python | 10,846 | 276 | import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
class TestSeriesSortValues:
@pytest.mark.filterwarnings("ignore:The inplace keyword in Series.sort_values")
def test_sort_values(self, datetime_series):
# check indexes are reor... |
838d6c86cd5438b1abcfd583b3b4a67f5886f8f8d8b22f7f335ecfca93a5a32c | Python | 10,846 | 307 | from datetime import (
UTC,
date,
datetime,
timedelta,
timezone,
)
from dateutil.tz.tz import tzoffset
import numpy as np
import pytest
from pandas._libs import (
NaT,
iNaT,
tslib,
)
from pandas._libs.tslibs.dtypes import NpyDatetimeUnit
import pandas as pd
import pandas._testing as t... |
13687146ec2ba4cc4e63e14dad56d63e8343c4a4050f48cc2b032664d022a6c4 | Python | 10,847 | 354 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# JN 2015-01-04
"""
script creates an artifact column in data_ h5 files
different functions can be called to mark artifacts
"""
from __future__ import print_function, division, absolute_import
import logging
import os
from argparse import ArgumentParser
import numpy as ... |
379b4e5e1161f2f96ee10f9e77f020963dc1f15b8a57e712268965549d5e1f75 | Python | 10,855 | 232 | #!/usr/bin/env python
import sys, os, subprocess
import argparse
from argparse import RawTextHelpFormatter
###################################################
### 0. script description and parsing arguments ###
###################################################
synopsis1 = "\
- runs mcl on OrthNets to remove spur... |
44c58ebf9ec8bf804e39bc545ab8311e965024ab17c4325aa03223d9c46d6592 | Python | 10,856 | 262 | import argparse
import torch
import joblib
import os
import numpy as np
from torch.utils.data.dataloader import DataLoader
import torch.nn.functional as F
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import CrossEntropyLoss
import torch.optim as optim
from torch.u... |
3e0d906b6dc4d3761aad4ca07a0c7b38d1c51cf10bbaec46dc039fa855c90716 | Python | 10,860 | 266 | import pathlib
from typing import Union
import anndata as an
import lightning.pytorch as pl
import pandas as pd
from lightning.pytorch.callbacks import EarlyStopping, ModelCheckpoint, Timer
from sklearn.preprocessing import LabelEncoder
from scsims.lightning_train import DataModule
from scsims.model import SIMSClassi... |
58cd4bf6ea8a01cb81e1b4a68518becd732764236d5f300ab42bb50920eeea10 | Python | 10,860 | 306 | # 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... |
39cc87f2e54073383acac2902a41b6739728b486dfab6835773de72bb1f50047 | Python | 10,862 | 307 | """
Utility functions for inducing predicate vectors and cued association transition model
Some code is adapted from the DGL implementation of RGCN link prediction:
https://github.com/dmlc/dgl/tree/master/examples/pytorch/rgcn
"""
import sys, os, re
import numpy as np
import torch
import torch.nn.functional as F
impor... |
f8913560c2c3dad469aa89226c5b6811b377216a49a4ce5750d047f699bc7784 | Python | 10,864 | 301 | import numpy as np
import pytest
import pandas as pd
mpl = pytest.importorskip("matplotlib")
pytest.importorskip("jinja2")
from pandas.io.formats.style import Styler
pytestmark = pytest.mark.usefixtures("mpl_cleanup")
@pytest.fixture
def df():
return pd.DataFrame([[1, 2], [2, 4]], columns=["A", "B"])
@pytes... |
4c9ad9dfd037e876322c758db4a3c40e417e020886aa573d19f9a29caf2d479b | Python | 10,868 | 255 | #! /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... |
d9ca656ddf30ac11f4bb5e6d62904d07e4bc4524d7e01f32e13ccb9920feb40c | Python | 10,871 | 291 | # License: see [LICENSE, LICENSES/legged_gym/LICENSE]
import matplotlib.pyplot as plt
import numpy as np
from collections import defaultdict
from multiprocessing import Process, Value
class Logger:
def __init__(self, dt):
self.state_log = defaultdict(list)
self.rew_log = defaultdict(list)
... |
def83239034f793a6ce465f245b0d58e689e127181b5f4934395dcb27cea7e86 | Python | 10,874 | 293 | from datetime import UTC
import dateutil.tz
from dateutil.tz import tzlocal
import pytest
from pandas._libs.tslibs.ccalendar import MONTHS
from pandas._libs.tslibs.offsets import MonthEnd
from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG
from pandas.errors import OutOfBoundsDatetime
import pandas as pd
imp... |
e9de504a5f193043c3118dca4c8f0d559080a8f086c5cfa32297b90d7cc79b69 | Python | 10,875 | 211 | import os
import pysam
def fetch_denovo_sv(input_vcf, tool):
output_path = "/".join(input_vcf.split("/")[: -1]) + "/trio_denovo"
if not os.path.exists(output_path):
os.mkdir(output_path)
print(os.path.join(output_path, input_vcf.split("/")[-1].replace(".vcf", ".denovo.vcf")))
output_vcf = o... |
2b21993c5da2adb4877818c3edb4ca094fc525814bd105718ea1182731e21b8a | Python | 10,878 | 293 | from datetime import UTC
import dateutil.tz
from dateutil.tz import tzlocal
import pytest
from pandas._libs.tslibs.ccalendar import MONTHS
from pandas._libs.tslibs.offsets import MonthEnd
from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG
from pandas.errors import OutOfBoundsDatetime
import pandas as pd
imp... |
8d60396a8ce1992b2f19137e04801916af5739b0304bf27b792198147201f700 | Python | 10,881 | 325 | import functools
import itertools
import os
import random
import time
from typing import cast
import pandas as pd
from deepglyco.chem.common.elements import ElementCollection
from deepglyco.chem.gpep.fragments import GlycanFragmentTypeCollection
from deepglyco.chem.gpep.glycans import MonosaccharideCollection
from d... |
f6a954ea1fca98f164bc5e0f61c2230738f6c8d3983b8ad766cd50a5ba68c481 | Python | 10,882 | 318 | # 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... |
2b0c5dad3d3304c1577f862e82239cb2bec06a0cf137a93155787d107d20bc5c | Python | 10,884 | 257 | #######
# This code was written by Nino Verwei, Niek van Hilten, and Andrius Bernatavicius at Leiden University, The Netherlands (29 March 2023)
#
# When using this code, please cite:
# Van Hilten, N.; Verwei, N.; Methorst, J.; Nase, C.; Bernatavicius, A.; Risselada, H.J., Bioinformatics, 2024, 40(2) DOI: 0.1093/bi... |
250c6b54091e89f93d3df6679d387d78dc92340dbcc7a7b8b0916f4c4643dbaa | Python | 10,886 | 549 | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 8 08:32:34 2021
This file contains project-wide definitions and settings
@author: Simon Kern
"""
import os
import warnings
import numpy as np
from sklearn.linear_model import LogisticRegression
def rescale_meg_transform_outlier(arr):
"""
same as rescale_meg, ... |
53cd0fcbfffa5247c81b57551c9bc51ff57a57c7c4d628e2a9fd6ab22719547b | Python | 10,887 | 317 | import os
from typing import Literal, Optional, Union
import anndata as ad
import mudata as md
import pandas as pd
import scanpy as sc
from appdirs import user_cache_dir
PYCALLINGCARDS_CACHE_DIR = user_cache_dir("pycallingcards")
if not os.path.exists(PYCALLINGCARDS_CACHE_DIR):
os.makedirs(PYCALLINGCARDS_CACHE_DI... |
dc027f18e7ca3652d0cf88ab1f24bf6ef3906e83f60376555d9aa19053eb07bf | Python | 10,887 | 264 | """Compact presentation table for automatic merge propositions.
This view owns only presentation state. Proposition identity is always the
catalog's stable string key; the integer ``id`` used by :class:`Table` is an
ephemeral rendering implementation detail.
"""
from __future__ import annotations
from collections.a... |
1eb04eeb2dc0396845c91e661861b0a775cb9a22f4fd8a04b70ade07374bb0c5 | Python | 10,898 | 284 | import numpy as np
from PyQt6 import QtCore
import pyqtgraph as pg
from pyqtgraph.graphicsItems.GradientEditorItem import Gradients
from ... import plot_cache
from .. import pipeline_plot
from ..widgets import SimplePlotWidget, SimpleViewBox
class QuickViewScatterWidget(SimplePlotWidget):
update_hover_pos = QtC... |
9d4465c8cb2036e50792eed3bc6fa134c578a581b0f6a8804222bfccdc6f555e | Python | 10,899 | 357 | # Tests specifically aimed at detecting bad arguments.
# This file is organized by reason for exception.
# 1. always invalid argument values
# 2. missing column(s)
# 3. incompatible ops/dtype/args/kwargs
# 4. invalid result shape/type
# If your test does not fit into one of these categories, add to this... |
807504fc9c6b7dd9dd3911aee4c64a5c9457293a43338abcb72232121f097380 | Python | 10,903 | 199 | import numpy as np
import torch, os, argparse, random
from sklearn.metrics import roc_auc_score, average_precision_score
basedir = os.path.abspath(os.path.dirname(__file__))
os.chdir(basedir)
os.makedirs("models", exist_ok=True)
os.makedirs("results", exist_ok=True)
torch.backends.cudnn.deterministic = True
to... |
1acad2db18e01520f47343c7c30d298ae68cac3f53d4b85d9cad54da3bf427d6 | Python | 10,904 | 257 | """KTrajectory dataclass."""
from collections.abc import Callable
from typing import Literal
import ismrmrd
import numpy as np
import torch
from typing_extensions import Self
from mrpro.data.Dataclass import Dataclass
from mrpro.data.enums import TrajType
from mrpro.data.SpatialDimension import SpatialDimension
from... |
399c5be479016bb4b31c34c8895a25f587b5636e7172f8290cd58237567d668c | Python | 10,905 | 311 | """
Application entry point for PG-GAN.
Author: Sara Mathieson, Zhanpeng Wang, Jiaping Wang, Rebecca Riley
Date 9/27/22
"""
# python imports
import datetime
import numpy as np
import sys
import tensorflow as tf
import scipy.stats
# our imports
import discriminator
import global_vars
import util
from real_data_random ... |
062b44cefc2ad14cf7fdbf45bbe427815c358ebdd55519382aa8df4374fbf627 | Python | 10,906 | 288 | # Copyright 2018-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... |
580918f955fb91a358ab106691b2f0b707538f9222497a688b861a25708881ec | Python | 10,913 | 308 | """
@author: mkowalska
"""
import os
import numpy as np
from figure_properties import *
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import targeted_basis as tb
__abs_file__ = os.path.abspath(__file__)
def set_axis(ax, letter=None):
"""
Formats the plot's caption.
Parameters
... |
04f242bc40b69ec652bdcd8f114cc1f39342a892efbe93519282be62de4d3d57 | Python | 10,914 | 333 | """Plotly-native anomaly-detection diagnostics.
Functions:
- ``score_distribution`` — histogram of anomaly scores with the
detection threshold marked.
- ``anomaly_map`` — 2-D scatter colored by anomaly flag (PCA / t-SNE /
UMAP).
- ``feature_anomaly_scatter`` — pick two features, scatter raw data
colored by anom... |
023cb73ab723a92c481b27a2004e3a6a4b3b54f29419f1686816b23a21e7a346 | Python | 10,915 | 308 | import struct
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestEmptyConcat:
def test_handle_empty_objects(self, sort, using_infer_string):
df = pd.DataFrame(
np.random.default_rng(2).standard_normal((10, 4)), columns=list("abcd")
)
... |
09d5112c91de0657ca7c758a003e238ada0fe88a313bf9e14a4c3f6759cc045f | Python | 10,918 | 248 | import os
import tempfile
from typing import Dict, List, Optional
import ngs_tools as ngs
from typing_extensions import Literal
from . import config, constants, utils
from .logging import logger
from .technology import Technology
def STAR_solo(
fastqs: List[str],
index_dir: str,
out_dir: str,
techno... |
28e08b4aba017bd2e7bd05166981d4f930519d0ff93cfa1316ed97520eaac30a | Python | 10,919 | 291 | # Stephen Hwang's FASTQ quality inserter into SAM files.
# Adds qualities from a FASTQ back into a SAM that is missing them.
# License: "I can put it online this afternoon or go ahead" - Stephen Hwang
# https://ucsc-gi.slack.com/archives/D02GGLLQXUM/p1673976340012069
import re
import sys
from math import log
from stat... |
504c1a9df73fc0282f91f4f6f8bf4de3691d79b8a4f1af1f2a4524e322e9ff7d | Python | 10,921 | 316 | """Plotting GUI tests"""
import pathlib
import tempfile
import dclab
import h5py
import numpy as np
from PyQt6 import QtCore
import pytest
from shapeout2.gui.main import ShapeOut2
from shapeout2 import pipeline, session
datapath = pathlib.Path(__file__).parent / "data"
@pytest.fixture(autouse=True)
def run_around_... |
0473770621e7a7deeebad0e1951d4e479170a10e13c95b318311414bfa3437ea | Python | 10,926 | 214 | import sys
import torch
import torch.nn as nn
import torch.nn.functional as F
sys.path.append('..')
from model.cell_model.cell_encoder import *
from model.drug_model.drug_encoder import *
class DRP_multi_view(nn.Module):
"""
Multi-view deep learning model designed for drug response prediction.
... |
f86951b3d63646a2845db5a6d80f5cd632871c7be75da416b4b4f35452d8279e | Python | 10,928 | 298 | # 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... |
99071f30d1b5420da2d0e66c99562528b376536c053e7d6bfb960008bf5e6377 | Python | 10,929 | 396 | """
Tests for offsets.Tick and subclasses
"""
from datetime import (
datetime,
timedelta,
)
import numpy as np
import pytest
from pandas._libs.tslibs.offsets import delta_to_tick
import pandas as pd
import pandas._testing as tm
from pandas.tests.tseries.offsets.common import assert_offset_equal
from pandas... |
70be5cd1c25139e29f48c0bc309cae350facdcef95787495df0fe40e11c34c3c | Python | 10,933 | 309 | #%%
from driver import compute
from values import *
from defs import *
from set_params import set_torq_params
import re
import electrochemical
import water
import glucose
import cotransport
import NHE3
import ATPase
import NKCC
import KCC
import NCC
import ENaC
import Pendrin
import AE1
import NHE1
import flux
import ... |
2c20efb46246383f4602e40ba89ab5bb3b0e0c297b43024455ca611fb8667483 | Python | 10,938 | 222 | # -*- coding: utf-8 -*-
# code from https://github.com/pochih/FCN-pytorch
from __future__ import print_function
import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import models
from torchvision.models.vgg import VGG
class FCN32s(nn.Module):
def __init__(self, pretrained_net, n_cla... |
5bfde6704ece3360a4c8832fb7f059fe792838684d2c63f6df08bd51b2f34446 | Python | 10,943 | 322 | from datetime import (
UTC,
datetime,
timedelta,
timezone,
)
import pprint
import dateutil.tz
import numpy as np
import pytest
from pandas.compat import WASM
import pandas as pd
ts_no_ns = pd.Timestamp(
year=2019,
month=5,
day=18,
hour=15,
minute=17,
second=8,
microsecond... |
2f6d0dc9db33e1211857d9aec07310e6b7db386f34ed2a6b1054e375dbf97b92 | Python | 10,944 | 225 | import pandas as pd
import numpy as np
import torch
from torch import nn
from torch.nn import functional as F
from utils import create_pytorch_geometric_graph_data_list_from_smiles_and_labels, init_weights, KFoldGraphs
import pickle
from GATF import CancerDrugGraphFeaturesDataset, GATmannEncoder, GATF, train_epoch, tes... |
1a6a0593e3a8466aa13e9bef95459ab2008352102234635e80137aefcb8e68f7 | Python | 10,946 | 305 | """Axes."""
# ------------------------------------------------------------------------------
# Imports
# ------------------------------------------------------------------------------
import numpy as np
from matplotlib.ticker import MaxNLocator
from phylib import connect
from phylib.utils._types import _is_integer
... |
e89e2efd43db4b4bf8276b86a6250de09696f283bfbe78f9c746c9d7dee7c635 | Python | 10,947 | 293 | #! /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... |
7bc5a486d33f2fa4e4ce9991dfa333c2eb0c24904eb85e6f2186fac91559a7de | Python | 10,951 | 299 | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... |
450864f44f3678bb2718b0e20fc3ad6f7a533da999a983fbc54dbe5380d42c35 | Python | 10,953 | 325 | """Session 32 — Phase 0-v2 (Trial/Run revert + parallel dispatch).
The data model is back to ``Run contains Trials`` (PyCaret 3.x
convention). Each Trial:
- Has its own ``run_id`` parent
- Carries metrics + artifact + status directly
- Goes through its own ``queued → running → succeeded`` lifecycle
- Is dispatched as... |
bb2952d905596c9189ef45decde96695a138a2b6024ac621b109d0fed3e87a68 | Python | 10,956 | 279 | # 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... |
68855390802f8bf1a34df7b9cddabb8532ade1619c635c08412849244e5502a7 | Python | 10,957 | 282 | # 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... |
b65446274ef15436ab2422993058574cb415e9514da1c1f6d90bf1e5d05c8319 | Python | 10,969 | 298 | # Module: containers.metrics.regression
# Author: Antoni Baum (Yard1) <antoni.baum@protonmail.com>
# License: MIT
# The purpose of this module is to serve as a central repository of regression metrics. The `regression` module will
# call `get_all_metrics_containers()`, which will return instances of all classes in thi... |
522b7aff5b12e6bf98264813a10b9a56a7f550e8f82338fd51dc2f9635b6efe8 | Python | 10,970 | 265 | # 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... |
37443ecd04240bbf7b54d1ec5c5a4674870fb049cd4c7fc92b7ebd9c8193add0 | Python | 10,975 | 247 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gs
from utils import Volatile_Resistor, Memristor, poisson_spike_train, update_plot_defaults
########################################################################################################################
# Figure 4: Spiking V... |
5df1ada1b02d861a2228a51c0cc9aad9013d0cd697ed0f88a457f726f10bbbe3 | Python | 10,977 | 340 | """
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 logging
import os
import pickle
import random
import xml.etree.ElementTree as etree
from pathlib import Path
from typing import Callab... |
fd5968675e9c3f1460f550517a218cd083ff3120ea2fabca92e9b63bbdb3579f | Python | 10,982 | 309 | # 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... |
1001e728d7da43e77d1918dd9edefd082cdf0c72e24cbd9002f4f934e3937de4 | Python | 10,985 | 424 | # 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... |
91c4965045ac302c410e5b3e075ba480fa6c2ecb2467cb9b0baf4368cf70f4d9 | Python | 10,985 | 349 | from __future__ import annotations
import functools
from typing import (
TYPE_CHECKING,
Any,
)
import numpy as np
from pandas.compat._optional import import_optional_dependency
from pandas.core.util.numba_ import jit_user_function
if TYPE_CHECKING:
from collections.abc import Callable
from pandas.... |
0bff5573e88d7d3bc666ee357b7fb4381ba47ed7f7ed5cfa1b8a27ef0d0b8a88 | Python | 10,988 | 417 | import time
import os
import re
import sys
import traceback
from subprocess import check_call
import statsmodels.api as sm
import matplotlib.pyplot as plt
from itertools import product
import numpy as np
from nibabel import load as load_nii
from scipy.ndimage.morphology import binary_dilation as imdilate
from scipy.ndi... |
d89b97712e2d8b812a8b592bdebd301ce04d951bc02c01e7d7188686d78f53f3 | Python | 10,989 | 379 | #!/usr/bin/python3
def read_gff(gff):
import sys
import re
f = open(gff)
id = ''
gene_dict = {}
cds_dict = {}
for line in f:
tmp = line.split('\t')
scaf = tmp[0]
start = int(tmp[3])
end = int(tmp[4])
strand = tmp[6]
if tmp[2] == 'mRNA':
m = re.search(r'^ID=(\S+?);', tmp[8])
id = m.group(... |
e882342d70ce5932ebfa6e91b63d17f979253c15e3c41ee96bb73be8cd44f455 | Python | 11,005 | 298 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Created by Roberto Preste
from pkg_resources import resource_filename
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from mtoolnote.classes import Annotator, Field, Variant, Parser
from mtoolnote.constants import HUMAN_HEADERS
from mtoolnote... |
722a1d1cbb66ce68458f7c56fea9ad67f66bbff9706a53ad90efaac614faff19 | Python | 11,006 | 303 | """Test functionality of base model classes."""
import gc
import pytest
import torch
import torchvision
from lightning_pose.models.backbones import ALLOWED_BACKBONES
from lightning_pose.models.base import (
BaseFeatureExtractor,
LrNotImplementedError,
OptimizerNotImplementedError,
)
class TestLrNotImpl... |
73f7927102baac408712bf84128c0f03252d2be12bae97bd2c8258ab3e696b73 | Python | 11,006 | 336 | # 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... |
f09377ef6a2ec7c3057e36de03fdfff4a195c83cd1ebf0b127919dce99566a1e | Python | 11,007 | 237 | # -*- coding: utf-8 -*-
"""
Created on Sun Dec 20 17:02:31 2020
@author: Wladek
"""
import numpy as np
import matplotlib.pyplot as py
import matplotlib as mpl
from matplotlib.colors import LogNorm
from figure_properties import *
import matplotlib.patches as mpatches
from scipy.signal import welch, argrelmin, butter,... |
03ba5759e663d4397b5fafb0c3246fa9502468222d2dfef7eaa7c9b9a2e82487 | Python | 11,009 | 311 | # coding: utf-8
"""Collect statistics to use in the QC report.
"""
import re
from atropos.util import (
CountingDict, NestedDict, Histogram, Mergeable, Summarizable, ordered_dict,
qual2int)
DEFAULT_TILE_KEY_REGEXP = r"^(?:[^\:]+\:){4}([^\:]+)"
"""Regexp for the default Illumina read name format."""
class Pos... |
08a068403b45f350d985521f61d3c8fde90c1bc95afb770cd257eb024deb1d41 | Python | 11,013 | 318 | # 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... |
69fdb0b4e68d3b42eade432d8e9ea70ad1ea46c3bcbaf9f9e5d4d94a51dfe418 | Python | 11,014 | 295 | # 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... |
7ab2425c287ed77afe91a2034145191b3d0f578adcbad920478a111dcbbce277 | Python | 11,015 | 306 | # 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 ... |
e119207a0f2b8659423c25009286534088bf41abed4293d908336c6828d104aa | Python | 11,016 | 309 | """
Helpers - Mostly plotting functions
===================================
"""
from matplotlib import pyplot as plt
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem.Draw import rdMolDraw2D
from rdkit.Chem import rdDepictor
import numpy as np
import pandas as pd
import seaborn as sns
def _prepar... |
c4dd9ea0cabc16748a739bf13712266fedf3e6306dc1d6cf58120d6b5ca2ec00 | Python | 11,018 | 238 | 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",
... |
74ed710a2387712f6078726875cd303972b49c120cbb2fc5fd2f7f450733dea0 | Python | 11,024 | 291 | # Copyright 2022 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... |
97d4035dfbcb740a0dd8c230530a533ad67d590a3fd2e0ef3e1fd07775697b43 | Python | 11,027 | 247 | from __future__ import division
import numpy as np
from collections import OrderedDict
from model_variants import Model_Variant_Parameters
class params():
def __init__(self):
self.PREFIX = "TI" # Prefix for filename
self.jobname = "ti0/" # Directory
# Basics ... |
3b884899c143a8bf231d28f3a16a82d30d9fc818017ee7a7ea5c4e47526a736b | Python | 11,028 | 186 | from botocore.client import Config
import ibm_boto3
import re
import os
import sys
import json
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")))
from load_db.NKIRS import get_baseline_visit, open_subject_me... |
069d46a8ae50b2fd34dfafe21f49886d8d93d917efb9fd2200a23c1519e01c26 | Python | 11,031 | 408 | import io
import pytest
from scripts import validate_unwanted_patterns
class TestStringsWithWrongPlacedWhitespace:
@pytest.mark.parametrize(
"data",
[
(
r"""
msg = (
"foo\n"
" bar"
)
"""
),
(
"""
... |
ceae9a5b5b13806257bec241ccba9ab6e0f56ade6831814bd5b850129fd305f1 | Python | 11,038 | 372 | # 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... |
370dbbf319bac1b48b78690442e4a450ac2da89a3a279ca4c26dd264aa4cd3fa | Python | 11,039 | 290 | # Copyright 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 agre... |
63761b74181f57f0f67d05e0104bf12345c9c60773b3968b93590428c63c57e4 | Python | 11,043 | 300 | #######
# PMIpred was developed by Niek van Hilten, Nino Verwei, Jeroen Methorst, and Andrius Bernatavicius at Leiden University, The Netherlands (29 March 2023)
#
# This script is an offline version of the peptide module in PMIpred at https://pmipred.fkt.physik.tu-dortmund.de/curvature-sensing-peptide/
#
# When using ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.