sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
48038383c4d696de85edc27bd49bd050c7aeac87f9b9afda49fa5405ade5f2aa | Python | 10,520 | 249 | import numpy as np
import pandas as pd
import pytest
from guppy.analysis.covariates import (
bin_edges_from_binned_metrics,
compute_binned_covariates,
compute_covariate_correlations,
)
@pytest.fixture
def bin_edges():
"""Three bins, the last one short: [0, 4), [4, 8), [8, 10]."""
return np.array(... |
d62a58ddfea697fb704ea75f60877c3c21a71f9481f2c7bc00dbd3e297295bd3 | Python | 10,522 | 350 | #!/usr/bin/env python
"""
MetaWIBELE: uniref_protein module
Extract proteins annotated by UniRef DBs
Copyright (c) 2019 Harvard School of Public Health
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 Sof... |
08e3b1c6715020397678ee25244e32b0eaeec93694206b332bbf299062497c60 | Python | 10,541 | 268 | # Copyright DST Group. Licensed under the MIT license.
import itertools
import sys
from typing import List, Dict, Tuple
from CybORG.Agents import BaseAgent, SleepAgent
from CybORG.Shared import CybORGLogger
from CybORG.Shared.Session import Session
from CybORG.Simulator.Host import Host
from CybORG.Simulator.Subnet im... |
758b367b5d2c64a485d6014ebb13addbc08439eacc78ff7ecfc161cde96837a8 | Python | 10,541 | 323 | ###########################################################################################
# Radial basis and cutoff
# Authors: Ilyes Batatia, Gregor Simm
# This program is distributed under the MIT License (see MIT.md)
###########################################################################################
import... |
a41ab2a3d1c6691b41ef035c78bc5eaffbfac5227d2c723b96e011f15dfee134 | Python | 10,552 | 258 | """
Configure tests so that pytest downloads testing data every time pytest is run
from the sct directory
Copyright (c) 2020 Polytechnique Montreal <www.neuro.polymtl.ca>
License: see the file LICENSE
"""
import os
import logging
from typing import Mapping
from hashlib import md5
import tempfile
from glob import glob... |
21f017fa9b4bbcc0fdd2af2156aa84d87cc39fec61eb199bd277a1b323373d8c | Python | 10,557 | 313 | ##
## JHCepas
import sys
import os
import time
import subprocess
from multiprocessing import Process
import signal
from ...common import HMMPGMD, TIMEOUT_LOAD_SERVER
from ...utils import colorify
from .hmmer_search_hmmpgmd import get_hits
from .hmmer_search import DB_TYPE_SEQ, DB_TYPE_HMM, QUERY_TYPE_SEQ, QUERY_TYPE... |
95d5f964aede6500d1de13773e0f0b87393bc35d66c923ac30df307b174fa9c0 | Python | 10,558 | 228 | import os
import time
import dask
import numpy as np
import pandas as pd
from dask.distributed import Client
from Nearl import data_io, features, log, savelog, trajloader, utils
# PDB codes later superseded by another entry; unknown for this legacy script.
SUPERSEDES = {}
class FeatureLabel(features.Feature):
d... |
4f44b2b77a365a2c10bf011a489f3afc11f712e4b28115f541352613bf36ca44 | Python | 10,565 | 229 | print('--------ISCXURL-2016 dataset----------')
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler, LabelEncoder
from sklearn.utils import shuffle
from tensorflow.keras.models import Model
from tensorflow.keras.layers impor... |
45824fa830365b465c75e2c1118e2c03ed7f2a69d165b27d1bf812b1a08478c0 | Python | 10,570 | 267 | # Copyright 2020 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... |
40311da0806a6dc66db42e0d0d60fc2025b44bf98145c399b86377599c768376 | Python | 10,574 | 342 | """
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 math
from typing import Optional
import torch
from ocpmodels.modules.scaling.scale_factor import ScaleFactor
from .atom_update_bloc... |
216c8b17079598aeadc8797c9f7270005fefe55e98549d7316cb3ea2c30e7442 | Python | 10,575 | 244 | import pymonetdb
import uuid
from prov.model import ProvDocument
from prov.dot import prov_to_dot
import os
import sys
import json
import argparse
def main():
parser = argparse.ArgumentParser(description="Generate W3C document")
group = parser.add_mutually_exclusive_group(required=True)
group.add_argumen... |
f300cca3e8815ffb76ee6289af3ff98b61af6f0d66555a11da91540670591084 | Python | 10,579 | 285 | #!/usr/bin/env python
"""
MetaWIBELE: uniref_annotator module
Annotate proteins to uniref DB and get UniRef90 and UniRef50 IDs
Copyright (c) 2019 Harvard School of Public Health
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Soft... |
34115d7b29ed82c3f1c92314d8791a8ccf28be7417925799bffb6ae79ae23db9 | Python | 10,588 | 260 | # Copyright (c) OpenMMLab. All rights reserved.import math
import math
import torch
import torch.nn as nn
from mmengine.model import ModuleList
from mmengine.model.weight_init import (constant_init, kaiming_init,
trunc_normal_)
from mmengine.runner.checkpoint import _load_checkp... |
dd4e7da807f7a06d61e47b1f98d12cd0af1e5ff0aa66b3ff3ef1a82b8d940d59 | Python | 10,589 | 327 | # -*- coding: utf-8 -*-
#
# picard documentation build configuration file, created by
# sphinx-quickstart on Mon May 23 16:22:52 2016.
#
# 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.
#
# Al... |
bcda6664481ce818ccaa75f6de39ad4cd4f18850ca2f9e4c1a24f70448e3476c | Python | 10,590 | 281 | #!/usr/bin/env python
"""
MetaWIBELE: abundance_annotator module
Summary the abundance for each taxon of each protein family across samples
Copyright (c) 2019 Harvard School of Public Health
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation fil... |
6379821bb8adc7904fd6378ee665a7cc8d3665059db9ded42935c53ddf1a706e | Python | 10,594 | 222 | import matplotlib.pyplot as plt
import numpy as np
import pod5 as p5
import sys
import struct
import os
import math, statistics
import pysam
import argparse
import pyarrow as pa
import pyarrow.parquet as pq
parser = argparse.ArgumentParser(description='Predicting the best modification threshold and dist from positive ... |
0c363ce801ded91a0ee09279415d384c0ea58eef6efea8e6c1ddfc44707c85e1 | Python | 10,595 | 288 | """
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 sympy as sym
from scipy import special as sp
from scipy.optimize import brentq
def Jn(r, n):
""... |
84cfccbd29f747ce62841d6b5f8f092a42c2ecb040f4a2e8ee8e90b809927c03 | Python | 10,597 | 320 | #!/usr/bin/python
"""
This file is for miscellaneous def
"""
import os
# type hint for readability
from typing import Tuple, Optional, Callable, Union
# R package check
def importr_tryhard(packname: str):
"""
It will check if the package is installed under rpy2. if not it will automatically install it from ... |
2e65c0462c6a3d71c5709f9e22d203b93514f485d6e2d26da6ea2ec42ffdad6d | Python | 10,601 | 229 | #!/usr/bin/env python
# coding=utf-8
# Copyright 2023 Statistics and Machine Learning Research Group at HKUST. All rights reserved.
"""A one-line summary of the module or program, terminated by a period.
Leave one blank line. The rest of this docstring should contain an
overall description of the module or program. ... |
acfdd4f6592fb1be0364e3ca135415745315dea4bee7422e1df80e4378290338 | Python | 10,601 | 320 | """TDD tests for new ZnDraw client API surface.
Tests for classmethods (list_rooms, login),
instance properties (locked, chat, screenshots, extensions, tasks).
"""
import warnings
import pytest
from zndraw import ZnDraw
from zndraw.schemas import MessageResponse
# ==================================================... |
d227b2b65996c80047341dac8a54ed9a24c12c81b2f77deb56370651d7b589ea | Python | 10,603 | 338 | """Optimisation class"""
"""
Copyright (c) 2016-2022, EPFL/Blue Brain Project
This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt>
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License version 3.0 as published
by the Fr... |
5dc00827bf5dcba75eb2077cbfcf7202f3f1d3b001f9e76944ef9673fe5bf57d | Python | 10,605 | 226 | # %% libraries
import os, glob, re
import shutil
import gzip
from os.path import join
import nilearn
from nilearn import image, plotting, masking
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import itertools
import pathlib
import argparse
# %% 1. grab numpy array
# %% ------... |
11421ccba84be6f0d6ef21ba2f2d59e8e8d39529f95f7c190cd5a07aa7a796c8 | Python | 10,607 | 264 | import re
import diffrax
import jax
import jax.numpy as jnp
import numpy as np
import pandas as pd
import sympy
import collections
from jaxkineticmodel.load_sbml.sbml_load_utils import construct_param_point_dictionary, separate_params
from jaxkineticmodel.utils import get_logger
jax.config.update("jax_enable_x64", Tr... |
433644ba6e45750c5494165e15c1f3ef21614edb117f50f785b7f905966ba9ab | Python | 10,619 | 224 | print('--------URL dataset----------')
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
import tensorflow as tf
from tensorflow.keras.layers import Reshape, BatchNormalization, LeakyReLU
from sklearn.preprocessing import StandardScaler, LabelEncoder
from sklearn.utils... |
8eb87a6e42e1a2c298e1616c37dc4e8bc7bf47a24910f204aff99e118eaa3961 | Python | 10,620 | 302 | """Validate inputs to BrainBuilder."""
import os
from typing import Union
import numpy as np
import pandas as pd
from joblib import Parallel, cpu_count, delayed
import brainbuilder.utils.utils as utils
from brainbuilder.utils.mesh_io import load_mesh_ext
from brainbuilder.utils.utils import get_logger
import nibabel ... |
2e96ec44f2180c18de0d4b931ba66cae725c77aafe8b6cc96dac472d5d8588e2 | Python | 10,628 | 211 | # %% libraries
import os, glob, re
import shutil
import gzip
from os.path import join
import nilearn
from nilearn import image, plotting, masking
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import itertools
import pathlib
import argparse
# %% ------------------------------... |
4bca9e0fcd22b6c3e656368f6b69779b11a96b587898f102b04861cff607f6fe | Python | 10,632 | 229 | print('--------Phishstorm dataset----------')
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
import tensorflow as tf
from tensorflow.keras.layers import Reshape, BatchNormalization, LeakyReLU
from sklearn.preprocessing import StandardScaler, LabelEncoder
from sklear... |
5d9f74a8fcc9eb7dc7cab8313a5afa11d2c4d73dae0ccd4d9ffe0591fba73b78 | Python | 10,636 | 241 | import shutil
from pathlib import Path
import h5py
import numpy as np
import pandas as pd
import pytest
from guppy.testing.api import locate_run_folder, step1, step2, step3, step4
from guppy_test_data import STUBBED_TESTING_DATA
def _is_float_label(column):
"""True for PSTH trial columns, which are event timest... |
b4afc4008c4c2002c14d04c21fa504dc9aaa105f80f488f9aadc087f7d5fae99 | Python | 10,649 | 510 | from typing import Dict, Optional, List, Generator, Any
class BaseGraph(object):
"""
BaseGraph that is a wrapper and provides methods to interact with a graph store.
All implementations should extend this BaseGraph class and implement all the defined methods.
"""
def __init__(self):
self... |
4533086e4d55bb23cdf9100223b4c7ff9f196c1a26036d1ccea29ba79c8af85c | Python | 10,651 | 323 | """t schedule used in diffusion process."""
from typing import Tuple
from functools import partial
import numpy as np
import torch
from torch import Tensor, nn
import torch.nn.functional as F
from ._utils import unsqueeze_xdim
def cosine_beta_schedule(timesteps, s=0.008, raise_to_power: float = 1):
r"""
cosi... |
be442f38a93fdbd14bcb04d0f3dfb910254354f728b1a0671300631c760aef00 | Python | 10,651 | 318 | #!/usr/bin/env python
"""
MetaWIBELE: format_protein_sequences module
Combine protein sequences from different samples
Copyright (c) 2019 Harvard School of Public Health
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), ... |
0546d8e856295284002e831a22161f11e87f7adeb938157cba02d48091a7feb7 | Python | 10,657 | 264 | #!/usr/bin/env python
#
# Motion correction of dMRI data.
#
# Inspired by Xu et al. Neuroimage 2013.
#
# Details of the algorithm:
# - grouping of DW data only (every n volumes, default n=5)
# - average all b0
# - average DWI data within each group
# - average DWI of all groups
# - moco on DWI groups
# - moco on b=0, u... |
5a0be1e3715d4e8ff4728fba5d0bfecd622712f8727e18697b020e58b792a741 | Python | 10,665 | 299 | import logging
from typing import Literal
import ase
import numpy as np
from ase.calculators.calculator import Calculator
from ase.neighborlist import natural_cutoffs, neighbor_list
from ase.optimize import LBFGS
from mace.tools import AtomicNumberTable
from simgen.element_swapping import (
collect_particles,
... |
2d2eab16016903670a5f15b4f6ce6f65142b916deb29bf826550be71c1e2c55d | Python | 10,681 | 294 | from typing import Tuple
from unittest import result
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os
import seaborn as sns
from lmfit.models import PowerLawModel
from sklearn import linear_model
from uncertainties import ufloat, unumpy
from uncertainties.umath import *
import lmfit
from... |
8163d0b528e2d62c88cec3d037f8e5797ad5c897990bda5d4b48701a566dc837 | Python | 10,684 | 335 | """
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 torch
from torch_geometric.nn import SchNet
from torch_scatter import scatter
from ocpmodels.common.registry import registry
from ocp... |
c9de34896c86dfe20402b5190152518af757455c8a901e546690dfb6a4b8bd82 | Python | 10,684 | 223 | import torch
import torch.nn as nn
from nnunet_mednext.network_architecture.custom_modules.custom_networks.UTNet.unet_utils import up_block, down_block
from nnunet_mednext.network_architecture.custom_modules.custom_networks.UTNet.conv_trans_utils import *
import pdb
class UTNet(nn.Module):
def __init__(se... |
cb2767212cdbf581c96c62ca8144a8993bb9fee2d352c7cd69f59f04b87a46d6 | Python | 10,688 | 232 | # pytest unit tests for spinalcordtoolbox.centerline
import itertools
from datetime import datetime
import pytest
import numpy as np
import nibabel as nib
from spinalcordtoolbox.centerline.curve_fitting import bspline
from spinalcordtoolbox.centerline.core import ParamCenterline, get_centerline, find_and_sort_coord
... |
10821067ec0f09b9526985cb2bdf078ac694165606beadcd43ea97853f616bae | Python | 10,695 | 257 | """Model-related utilities.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from . import backend as K
from .utils.generic_utils import has_arg
from .utils.generic_utils import to_list
from .engine.input_layer import Input
from .engine.input_layer import... |
dbb36ab9436ed480dd5791a3f9085e0010e80ce29f5a3b31af84653785efba0b | Python | 10,699 | 321 | # Author: Hauxu Yu
# A module for normalization
# There are two types of normalization:
# 1. Sample normalization - to normalize samples with different total amounts/concentrations.
# 2. Signal normalization - to address the signal drifts in the mass spectrometry data.
# imports
import numpy as np
from statsmodels.n... |
62da814a956ff104d06b1d0c44830815adbbe222f4b5e8ed4c0898b4806e44ba | Python | 10,720 | 323 | # NOTE: this code is taken directly from Willie Boag's mimic-tokenize github repository
# https://github.com/wboag/mimic-tokenize/blob/master/heuristic-tokenize.py commit e953d271bbb4c53aee5cc9a7b8be870a6b007604
# The code was modified in two ways:
# (1) to make the script compatible with Python 3
# (2) to remove the ... |
04d8d8408ebf275c982434efd98f38ddf363123fe867f6d10f4fc73ee0aba79c | Python | 10,722 | 317 | #!/usr/bin/env python
"""
MetaWIBELE: interproscan_pfam_protein_family module
Summary the results of Pfam annotation from InterProScan for families
Configuration settings
Copyright (c) 2019 Harvard School of Public Health
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software a... |
b9209836f9d58d8a946791677b4ee6471aa2d9a94a4fe2de65df78e04c094bb0 | Python | 10,738 | 303 |
import numpy as np
import scipy
import scipy.ndimage as ndi
from scipy import fftpack
import logging
def detrend_df_f(A, b, C, f, YrA=None, quantileMin=8, frames_window=500,
flag_auto=True, use_fast=False, detrend_only=False):
""" Compute DF/F signal without using the original data.
In gener... |
0036832caec6958f270268dea51184cfb0dd5ab5117ab6b059f377cd5b420469 | Python | 10,740 | 311 | from typing import Any, Dict, List, Tuple
from arango import ArangoClient
from kgx.config import get_logger
from kgx.error_detection import ErrorType
from kgx.sink.sink import Sink
log = get_logger()
class ArangoSink(Sink):
"""
ArangoSink is responsible for writing data as records
to an ArangoDB instan... |
739501fb5a4f7e2f6ec9b6761734e6489345603d034d3e306654a26169b1d445 | Python | 10,741 | 277 | """
Loads a pre-trained VGAE, obtains latent representations,
and trains a ridge regression model on the latent representations.
Author: Hanna Tolle
Date: 2025-11-19
License: BSD-3-Clause
"""
import sys
sys.path.append('graphTRIP/')
from sacred import Experiment
from experiments.ingredients.data_ingredient import *... |
4455a6109b0de010906f175a64e0cbe4ac92efd88ef3d6a61503c416f3846422 | Python | 10,742 | 279 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import GINEConv, GATConv, GINConv
from pyhealth.models import RETAINLayer
from torch_geometric.nn.inits import reset
from typing import Callable, Optional, Union
import torch
import random
from torch import Tensor
from torch_g... |
dfc9ac356dfcc1ba2cb3d302212a9bd445659032d47954599b1adfa5029e5020 | Python | 10,743 | 279 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import GINEConv, GATConv, GINConv
from pyhealth.models import RETAINLayer
from torch_geometric.nn.inits import reset
from typing import Callable, Optional, Union
import torch
import random
from torch import Tensor
from torch_g... |
f1d6b0b158682f801b0063e6a5c0e51b6864684601ff125bbba775d19df77df6 | Python | 10,748 | 366 | #!/usr/bin/env python
"""
MeteWIBELE: filter_prioritization.py module
1) Filter subsets using binary annotation (sequence-based annotation, interested genes, etc) as prioritization factor
2) Narrow down prioritized candidates
Copyright (c) 2019 Harvard School of Public Health
Permission is hereby granted, free of c... |
43266fc7b5684d1f355e2d15ad0f3cd9b0606a1fcba73075f8e89cbd5da443fc | Python | 10,758 | 321 | """
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 math
from typing import List, Optional, Union
import numpy as np
import numpy.typing as npt
import torch
import torch.nn as nn
from s... |
cda19052331e775190ce8b1159efcb828a4632d931a6d8bd4d47109f121782f1 | Python | 10,761 | 311 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import math
from functools import partial
from typing import Tuple, Type
import torch
import torch.nn.functional as F
fro... |
3fed771f55d5b0c079fcc6c22d0ccd5de181d72a4db1d8ad5fd9d10c23266f27 | Python | 10,769 | 275 | from unittest import TestCase
from unittest.mock import patch
import numpy as np
import torch
from DiastereomericResolutions.main.data_loading import reps_to_torch
from DiastereomericResolutions.main.network import (
SeparationNetworkClassifier,
SeparationNetworkRegressor,
)
from DiastereomericResolutions.mai... |
05e22bbb6df471e7e9366be154651e6400732b674afbac86b6f54bc57a6a65f0 | Python | 10,780 | 279 | import torch
import os
import torch.nn as nn
from nnunet_mednext.network_architecture.mednextv1.MedNextV1 import MedNeXt as MedNeXt_Orig
from nnunet_mednext.training.network_training.nnUNetTrainerV2 import nnUNetTrainerV2
from nnunet_mednext.network_architecture.neural_network import SegmentationNetwork
from nnunet_med... |
77435ce86ce278aa719e32fc7747744f5ad4fba6883a15da6ce2a782df0f1741 | Python | 10,781 | 280 | # This is a main file to run the diceseq software, which will return the
# isoform proportions ratio for each gene at all time points.
import os
import sys
import time
import pysam
import numpy as np
import multiprocessing
from optparse import OptionParser, OptionGroup
# import pyximport; pyximport.install()
from ..... |
3991c6fd9a488141887d151c0ee7c89725611333546eda335ee70b8d74c738e3 | Python | 10,782 | 240 | #!/usr/bin/env python
import argparse
import os
import sys
import datetime
from parse_config import parse_json_config, print_config
from parse_gene_anno import parse_gff_tree
from sc_longread import blocks_to_junctions, remove_similar_tr, get_gene_flat, get_gene_blocks, group_bam2isoform
from gff3_to_fa import get_tra... |
c63f8b676d5d76f33cf005ff95b0c6f58ff0238681431cf9541ad7f262139791 | Python | 10,782 | 274 | #!/usr/bin/env python
#
# This program straightens the spinal cord of an anatomic image, apply a smoothing in the z dimension and apply
# the inverse warping field to get back the curved spinal cord but smoothed.
#
# Copyright (c) 2013 Polytechnique Montreal <www.neuro.polymtl.ca>
# License: see the file LICENSE
# TOD... |
9676a04faa5a5d29335db9d8e14b06b2b3bcf2b7b12d205c16b6759dff02474f | Python | 10,789 | 276 | #!/usr/bin/env python3
"""Test zstd interoperability between versions"""
# ################################################################
# Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under both the BSD-style license (found in the
# LICENSE file in ... |
558afb99152a451b4e370796f4b32f4e2efe7ccbe7a0de34756a2eaf0a173f1b | Python | 10,804 | 278 | # Copyright (C) 2020-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Utilities modeule for PyTorch related Task Runners"""
# NOTE: this might want to be its own PR to openfl
from copy import deepcopy
import torch as pt
import numpy as np
from openfl.utilities.split import split_tensor_dict_for_holdo... |
086dab260909b2505739aa6f4b7041e320bbeff747205b22d611c891b2c916d4 | Python | 10,807 | 185 | #!/usr/bin/python
# SPDX-License-Identifier: Apache-2.0
#
'''
This script contains label names, original ids, modified train ids and color maps for the categories in the cityscapes dataset.
Used in the duc-inference.ipynb and duc-validation.ipynb
'''
from collections import namedtuple
#-----------------------------... |
c68e1238873d5bf52d0a5b390267a32ce5532220d870559ae7d69ff44d7e7f8c | Python | 10,807 | 325 | import os
import math
import random
import pickle
import collections
import torch
import lmdb
from typing import Mapping, List, Dict, Tuple, Optional
from torch.utils.data import Dataset
from tqdm.auto import tqdm
from joblib import Parallel, delayed, cpu_count
from Bio.PDB.MMCIFParser import MMCIFParser
from Bio.PDB.P... |
08e38b71d983d47db4e932dd9b1928a2caa12271a55393719e04f1e6f06f29d6 | Python | 10,808 | 310 | # This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 Andrew Collette and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
"""
Demonstrates use of h5py in a multi-threaded... |
192d717df0a63a846f6a4677910f85fb2f57fbbddfde1c04bfa6ad3d686c6d01 | Python | 10,809 | 251 | print("It works!")
import pandas as pd
import scanpy as sc
import numpy as np
import os
import json
import anndata as ad
### reading the data that we want to apply the clock to
adata = ad.read('./external_data/velmeshev_fc_adult.h5ad', backed='r')
# reading dictionary mapping gene ids to gene names
mapping_df = pd.r... |
efc1ba1ff6d4791df1f607012a3cb92b20e3ce441bbccc8325b1fa62b6376c76 | Python | 10,815 | 227 |
from collections import defaultdict
import msgpack
import progressbar
import psycopg2
import time
from timeit import default_timer as timer
from typing import Dict, List
import ujson
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.db import connection
f... |
cafae8b08a8b401b6d2ffe263df8fe00efe64db24d52a566841edbb0f480a7ec | Python | 10,818 | 268 | """Unit tests for src/synonyms/filter.py."""
import logging
import pytest
import yaml
import src.synonyms.filter as lf_module
from src.synonyms.filter import SynonymFilter
# ---------------------------------------------------------------------------
# Helpers
# ------------------------------------------------------... |
3a47c39079cf2da09c2a53736a6af786df283d82e13c0c628feceed526b288be | Python | 10,819 | 301 | # -*- coding: utf-8 -*-
# encodermap/trajinfo/load_traj.py
################################################################################
# EncoderMap: A python library for dimensionality reduction.
#
# Copyright 2019-2024 University of Konstanz and the Authors
#
# Authors:
# Kevin Sawade
#
# Encodermap is free softw... |
7423bbb4e4ac6347a49a68d419d7c2463f5eb7136277762f4d3537d388c61b7d | Python | 10,819 | 267 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
from mmcv.cnn import ConvModule
from mmcv.cnn.bricks import Conv2dAdaptivePadding
from mmengine.model import BaseModule
from mmengine.utils import is_tuple_of
from torch.nn.modules.batchnorm import _BatchNorm
from mmseg.registry import MODELS
from ..util... |
b935b19e38a6203ab6e959f9d265b888ea5ab918e3d0aaff3cf33a20480a84bb | Python | 10,820 | 307 | import re
import os
import shutil
import pathlib as pl
import subprocess as sp
try:
import matlab.engine as me
except ImportError:
me = None
# Constants
kilosortInstallFolder = None
numpyInstallFolder = None
matlabExecutableFile = None
def locateSoftwareDependencies(
matlabAddonsFolder=None,
kilosortV... |
d7ad87a2b75923383f3623d158d892f4470c0bfa0e71c000dfc32f80f61296a9 | Python | 10,823 | 320 | #!/usr/bin/env python
#
# Copyright 2006, Google Inc.
# 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... |
0bf35eb3f6b714273b76d945b836535d527ee726f189a95aa2ae55f5deaee654 | Python | 10,829 | 315 | #!/usr/bin/env python
"""
MetaWIBELE: interproscan_signalp_protein_family module
Summary the results of SignalP generated by InterProScan
Copyright (c) 2019 Harvard School of Public Health
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files... |
a8c172a70597eacf5fac1bf1e12b84daf6363a8081a3f2dceef7595e0bea96ad | Python | 10,829 | 257 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from CoTr.network_architecture import CNNBackbone
from nnunet_mednext.network_architecture.neural_network import SegmentationNetwork
from CoTr.network_architecture.DeTrans.DeformableTrans import DeformableTransformer
from CoTr.network... |
89088409e613cb17c1a1030ec2ae00f99d6f372c070b235cff147095e4667c63 | Python | 10,834 | 252 |
# This file is part of the Firmware project to interface with small Async or Neuromorphic chips
# Copyright (C) 2023 Ole Richter - University of Groningen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the... |
a329d398f33378dacd5d3279924edd8ebd688504f14c1d1137a4422c99f49168 | Python | 10,836 | 252 | """Label Groups page: define a group of output runs to average, without computing anything.
The page writes only ``group_members.json`` into ``<destination>/<name>_group/``, mirroring how
Label Stores writes only ``storesList.csv`` into a new run folder. Averaging into the group is
the separate Group Analysis step, wh... |
8bab43f2c1ecddc037a2d178d9fe15d8e9ceb78e783634f9ea8707c8951d3d9f | Python | 10,845 | 281 | #!/usr/bin/env python3
"""Analyse in Fourier transformation based continuous optical imaging."""
from typing import Tuple
import colorsys
import math
import numexpr as ne
import h5py as h5
import numpy as np
from tqdm import tqdm
from uifunc import FileSelector
FRAMES_PER_PULSE = 6 # default sync signal
__author__ =... |
565a0a3007613323720e2ec3ab06e84043b6970a6a150234222123cee9979c0f | Python | 10,850 | 291 | from __future__ import annotations
import gc
import sys
import warnings
from typing import TYPE_CHECKING
import numpy as np
import torch
from torch import nn
from chgnet.graph.crystalgraph import CrystalGraph
from chgnet.graph.graph import Graph, Node
if TYPE_CHECKING:
from typing import Literal
from pymat... |
6062d9bed3fe2ee062ac120af1f04d089aa1b5a81a5fccc89150220246da5005 | Python | 10,855 | 288 | import tkinter as tk
from tkinter import ttk
import pandas as pd
import matplotlib
matplotlib.use("TkAgg")
from matplotlib.figure import Figure
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import os
###############################################################################
## CONFIGU... |
f51479b2f0275d67bbe3200e09cb39739051b00a25400d18666a23b5c3f47920 | Python | 10,857 | 357 | from scipy import special, stats as sstats
from sklearn.neighbors import KernelDensity
import numpy as np
from joblib import Parallel, delayed
from scipy.spatial.distance import correlation
from netneurotools import stats
from neuromaps import compare_images
def compare_maps(src, trg, metric='pearsonr', ignore_zero=Tr... |
cf91227ce409054dfc0462bd411db6967703e894def2d381979aa2d9edb2d85a | Python | 10,865 | 321 | # -*- coding: utf-8 -*-
"""Layers that act as activation functions.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .. import activations
from .. import initializers
from .. import regularizers
from .. import constraints
from ..engine.base_layer imp... |
cec0e76313e74db316b37fd08595eef9c87885f5c54555a395277e97677dca1a | Python | 10,869 | 317 | import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import numpy as np
from scipy.stats import ttest_rel
import warnings
# Suppress specific warnings
warnings.filterwarnings(
"ignore",
category=FutureWarning,
message="Passing `palette` without assigning `hue` is deprecated.",
)
warnin... |
cec2e4ce59c7177876099b30b6dead3784545bc4b7fa1e6d158cad7dbf471067 | Python | 10,871 | 290 | """Phase 3B cascade behavior tests.
Verifies the per-source closest-ev_lca + type-priority donor cascade
implemented in `AnnotationEngine._summarize_annotations`. Each test
constructs a minimal synthetic ortholog_meta + annot_data and asserts
the cascade output and confidence labels.
Cascade sort key per ortholog (sm... |
d5b0b68cc629000437dbffc80dad7b0c4092184e7656fa39cbcee13eec1bc0dc | Python | 10,874 | 315 | from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import urllib
import pathlib
import os
import sys
import requests
import numpy as np
import warnings
warnings.filterwarnings("ignore")
from torchxrayvision.models import model_urls
class _DenseL... |
416eb5da19e265c0fa1728d068e2e3c45b5c2470ef906ee86f90f2eca864c26b | Python | 10,883 | 241 | # Copyright 2020 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... |
f458a1892f6698fc44d1c0c4614f44b8a6360cdc037089ce3298c214b3450fb2 | Python | 10,888 | 254 | # -*- coding: utf-8 -*-
from collections import defaultdict
from itertools import combinations
from django import forms
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.http import HttpRequest, HttpResponse, JsonResponse
from django.shortcuts import render
from ... |
c7a95d26e8ea321250e5c217f231eb26a7da4942c83d1c1596346312062f84bb | Python | 10,892 | 284 | from qtpy.QtCore import *
from qtpy.QtGui import *
from qtpy.QtWidgets import *
import numpy as np
from scipy.ndimage.interpolation import shift
from flika.window import Window
import flika.global_vars as g
import pyqtgraph as pg
from time import time
from distutils.version import StrictVersion
import flika
from flika ... |
69ec352b96fcac12121fb39d8fc215774d457594570b7e81b767df313ae7f2dc | Python | 10,899 | 248 | import pytest
from pprint import pprint
from CybORG import CybORG
from CybORG.Simulator.Actions import (
Sleep, DiscoverRemoteSystems, AggressiveServiceDiscovery, StealthServiceDiscovery, PrivilegeEscalate, DegradeServices, Impact, ExploitRemoteService, DiscoverDeception,
Monitor, Analyse, Restore, Remove, De... |
0fb0e2b55f12cf6c3e623691e88be28d35fd70c186fb8862d21bc6048a9da966 | Python | 10,902 | 312 | # Standard Library Imports
from math import cos, pi, sin
# Third Party Imports
import MDAnalysis as md
import numpy as np
import tensorflow.compat.v1 as tf
from MDAnalysis.analysis.base import AnalysisFromFunction
from MDAnalysis.coordinates.memory import MemoryReader
# Local Folder Imports
from .misc import rotation... |
43a0d5be3fc3d9b1197bf92b161bb0841f09f009fe229bd35a86c338b16e34f0 | Python | 10,903 | 298 | import matplotlib.pyplot as plt
import numpy as np
import matplotlib.patches as mpatches
def quick_imshow(img, title=None, cmap="gray", vmin=None, vmax=None, dim=0,
colorbar=False):
""" Quickly show an image with optional title.
If the image is 3D, it creates subplots for all slices along th... |
20debed92750a8f8bc620caa753e73afad84bbff515696bbfe18c9b57e6a7aef | Python | 10,905 | 272 | '''
Unsupervised training of VGAE models for feature reconstruction.
VGAE models are newly initialised, no pre-trained model loading.
Authors: Hanna M. Tolle
Date: 2025-01-08
License: BSD 3-Clause
'''
import sys
sys.path.append('graphTRIP/')
import matplotlib
matplotlib.use('Agg')
from sacred import Experiment
from... |
a613f9069176732798552541f18ec4ea1d2ceb011a4304d7995fa70fd9e6db9a | Python | 10,908 | 254 | #!/usr/bin/env python
#
# Inference of DL-based motion correction for dMRI/fMRI
#
# Copyright (c) 2025 Polytechnique Montreal <www.neuro.polymtl.ca>
# License: see the file LICENSE
import os
import time
import textwrap
import numpy as np
from shutil import copyfile
from spinalcordtoolbox.image import add_suffix, gene... |
75e10b01f5c084c2bf40b23431608d785574c671c63dc8378ccb36d3825dccdb | Python | 10,909 | 325 | #!/usr/bin/env python
#
# Create mask along z direction.
#
# Copyright (c) 2014 Polytechnique Montreal <www.neuro.polymtl.ca>
# License: see the file LICENSE
# TODO: scale size in mm.
import sys
import os
from typing import Sequence
import textwrap
import numpy as np
from scipy.ndimage import center_of_mass
from s... |
5e8adcba2173767888507470509d5abca1b9fb4577e563770d5ea9d5de5c8770 | Python | 10,911 | 298 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
###
# File: /home/richard/projects/pepcorsser/models/core.py
# Project: /home/richard/projects/biology_llm_platform/mlm/pepland/model
# Created Date: Sunday, April 28th 2024, 12:03:00 am
# Author: Ruochi Zhang
# Email: zrc720@gmail.com
# -----
# Last Modified: Tue Dec 24 20... |
84a9bc5c7896d1386fe3d763a60a34d5fe1157a711e5e11400493889c691a272 | Python | 10,914 | 318 | # tests/test_router_events.py
"""Tests that router endpoints emit Socket.IO events."""
from unittest.mock import AsyncMock
import pytest
from conftest import make_room_address
from fastapi.testclient import TestClient
from zndraw_joblib.events import JobsInvalidate, TaskAvailable, TaskStatusEvent
@pytest.fixture
d... |
6079a7a2d6188500fd5f80f1607fe953fedc8fe90d769509a7454275852c639a | Python | 10,915 | 275 | """Stores class definition of ResearchObject and WritableBagFile."""
import copy
import datetime
import hashlib
import os
import shutil
import uuid
from array import array
from collections import OrderedDict
from collections.abc import MutableMapping
from io import FileIO, TextIOWrapper
from mmap import mmap
from path... |
0ddc9eaba583b8c496dc039147a96fd7508db89c52d7893edcf0cb769b09eb08 | Python | 10,924 | 222 | """Unit tests for the DrugBank food-and-extract retype (issue #828).
Covers datahandlers.drugbank.write_drugbank_food_extract_types (which DRUGBANK ids become
biolink:Food vs biolink:ComplexMolecularMixture) and the UNII flag reader it and write_unii_ids rely
on (read_unii_flags).
"""
import pytest
from src.categori... |
e502d8a96b4f127a661ebaab82ed9040e127fa3268af75748438f276f36a1b17 | Python | 10,936 | 238 | import numpy as np
import pandas as pd
import torch
import networkx as nx
from torch_geometric.nn import GCNConv, GATConv, SAGEConv
import networkx as nx
from sklearn.metrics import roc_auc_score
import warnings
warnings.filterwarnings("ignore")
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-... |
bf9b5ec823583cd690afdfc05b005f67cf587de4bdea4c70659182d8c05d6677 | Python | 10,942 | 203 |
"""
In cases where a BOLD file exists but the corresponding events.tsv file is missing,
there are several scenarios to consider:
1. Incomplete Behavioral Data with TEMP Files Available:
TEMP files, which are trial-by-trial backups that don't rely on a final "save,"
may exist even if the behavioral data wasn't fully... |
18eaed1735500a596a908d2ee8902c4233d3eae55e1122779323833e2e165f1d | Python | 10,953 | 743 | import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('Datasets/ISCXURL-2016/ISCXURL-2016.csv')
df['new_label'] = df['type'].apply(lambda x: 'Non-Phishing' if x == 'benign' else 'Phishing')
original_counts = df['new_label'].value_counts()
benign_count = original_counts.get('Non-Phishing', 0)
mali... |
1fc5e1c28bf75e5ea12462f159be88f977f587094bf5c38d8fac41fa2c6a0c09 | Python | 10,954 | 278 | from data.bert_dataloader.load import BertDataModule
from transformers import (
BertTokenizer,
BertConfig,
BertForPreTraining,
BertModel,
BertForMaskedLM
)
from pytorch_lightning import (
LightningDataModule,
LightningModule,
loggers,
Trainer,
)
from pytorch_lightning.c... |
d7b9f1e4b4828eb65e071b7be144bf26db7044680d7d3097f9f047ec5fede6f3 | Python | 10,954 | 302 | import numpy as np
import statsmodels.api as sm
from sklearn.decomposition import PCA
import scipy.stats as stats
from grid_cell.linear_regression import BayesianLinearRegression
from global_setting import *
def select_arr_by_t(arr, t, session='open_field_1', file_name='rat_q_grid_modules_1_2.npz'):
if file_name =... |
fd44c833e3669d3827d5d847adaff39d0814f6412a482647ac951d8329ef8081 | Python | 10,955 | 255 | # coding=utf-8
# Copyright 2021 The IDEA Authors. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by a... |
1d02eed2187a41a67ca4b19364f10c05a5899b2cdf235aeb52691c8214a00bfe | Python | 10,963 | 400 | import pytest
import pandas as pd
import numpy as np
from bmt import Toolkit
from kgx.curie_lookup_service import CurieLookupService
from kgx.utils.kgx_utils import (
get_toolkit,
get_curie_lookup_service,
get_prefix_prioritization_map,
get_biolink_element,
get_biolink_ancestors,
generate_edge_... |
ee0217dbfc591c34888963af09d6ab9c0ca927984affaaf42851c3a3e99070d4 | Python | 10,964 | 309 | import tempfile, subprocess
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader, TensorDataset
# from nearl.static import cos_sim
from nearl.static import cos_sim_g as cos_sim
import time, os
import numpy as np
import matplotlib.pyplot... |
0d789d3c4d2d0fa13fda5b2ee97109df968c0e72bebb42b88760bd1e3498a2e9 | Python | 10,973 | 234 | import cv2
import numpy as np
from scipy.ndimage import binary_fill_holes
from skimage import feature, morphology
from skimage.measure import block_reduce
def comp_gunnar_farneback(img_prev, img_curr, **kwargs):
"""Wrapper for Gunnar Farnebäck algorithm for Maia
img_prev :: first 8-bit single-channel input i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.