sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e59cd2a3d87710e67be1a485a6f9ded0c8764dc840df14db945488c22c61d5fd | Python | 28,985 | 674 | """Tests for mibidata.mibi_image
Copyright (C) 2021 Ionpath, Inc. All rights reserved."""
import datetime
import os
import shutil
import tempfile
import unittest
import warnings
import numpy as np
from skimage import io as skio, transform
from mibidata import mibi_image as mi
TEST_DATA = np.arange(12).reshape(2, ... |
8a939538eba390f3327fb43da95671701c66b3cfa9e25929b313a8eb11c0db22 | Python | 28,998 | 699 | import time
from collections import deque
from itertools import chain
import numpy as np
import torch
import sys
import os
import copy
from scipy import stats
import torch.nn as nn
from src.utils import get_argparser
from src.encoders_ICA import NatureCNN
import pandas as pd
import datetime
from src.lstm_attn import s... |
087ffe82d0a9fd29a7e674466e71cd454ab92c7b0d256fe9b3313628aa5ca46d | Python | 29,048 | 644 | import torch
from torch import nn
from . import functional
__all__ = ["Tempotron", "SRM", "CubicSRM", "CubicConv2d"]
class Tempotron(nn.Module):
def __init__(
self,
in_features: int,
out_features: int,
duration: float,
tau: float = 15.0,
tau_s: float = 3.75,
... |
ce6b217b41b0579a64545b893f28a44df31d79b39404b7f999920c10c0fbfb9a | Python | 29,059 | 702 | import os.path
import pytest
from fanc.construct.seq import Reads, FragmentMappedReadPairs,\
FragmentRead, InwardPairsFilter, UnmappedFilter, OutwardPairsFilter,\
ReDistanceFilter, FragmentReadPair, SelfLigationFilter, PCRDuplicateFilter,\
LazyFragmentRead, ContaminantFilter, AccessOptimisedReadPairs
from f... |
2347e1ed40ce6010c2c9199454a1cf91f56e158797327b19c26ab52aa11354e4 | Python | 29,060 | 812 | """Functions shared between scripts."""
import json
import pathlib
import warnings
import click
import mne
import numpy as np
import pandas as pd
import scipy.special
from numba import njit
from config import CHOICE_MAP, DEFAULT_RNG_SEED, STREAMS
def get_sourcedata(sub, stream, data_dir):
"""Return path to sou... |
5c396d28f9842fb0b49988c9ab8858b12398c97c6b3b6e54da03543989669c5c | Python | 29,073 | 679 | import os
import warnings
import numbers
from functools import partial
import numpy as np
from ..backend import get_backend
from ..backend._utils import _dtype_to_str
from ..progress_bar import bar
from ..scoring import l2_neg_loss
from ..validation import check_random_state
from ..validation import check_cv
from ._s... |
74dfdf2ab02b6189109cf3febf68025c48ad556039db89151956eb92724a260b | Python | 29,075 | 858 | """Perform cluster permutation test of RSA data.
The RSA signal is a unidimensional signal of the correlation between an
empirical RDM and a model RDM (either the "numberline" or the "extremity"
model).
This RSA signal (for each model) is analyzed for each condition in a 2x2 mixed
design experiment with the following... |
f826759a4c1f61651cdb1ccba675cae7605cbf6a62ba5f6fb4b11681e5b55336 | Python | 29,083 | 716 | """Metrics to assess performance on sequence labeling task given prediction
Functions named as ``*_score`` return a scalar value to maximize: the higher
the better
"""
from __future__ import absolute_import, division, print_function
import warnings
from collections import defaultdict
from typing import List, Optional... |
c16cf9dbbde6e4a6f06218a14869d192ea790265294b570f2da5e9f41c58301f | Python | 29,085 | 450 | import argparse
from utils import load_architecture, evaluate, ArgsStruct, deterministic
import torch
import os
import json
import random
from attention.explain_prediction import explain_prediction, show_attention_matrix, show_relevant_graph_features
from torch.nn.utils.rnn import pad_sequence
from training.covid_torch... |
7187b5fec54828d58f6ac77258766afda4105730b8dc9872f08a0423dc11d27d | Python | 29,089 | 742 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
d32bc45389f5c6981ade20f1ccf6a3212ae559d4a9ee45cf5173fea9e8511e9d | Python | 29,096 | 800 | # -*- coding: utf-8 -*-
"""
Applies the model to the images and display the results in a 2x4 image.
Also generates CSV describing performance.
raw image : true disk : true cup : true rim
: pred disk : pred cup : pred rim
"""
import cv2
import numpy as np
import pandas as pd
import tensorflow as tf
print(tf... |
141914197b18d5280618af34f02ecd390286067a383fcde629d431dab2e56aaf | Python | 29,134 | 739 | """This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license."""
import logging
import os
import traceback as tb
from datetime import datetime
from urllib.parse import urlparse
from core.feature_flags import fla... |
a98e717d135d5afbb724dcf281f9bcb0e4dbc5e4528177a7575a49838e296e5d | Python | 29,137 | 840 | import itertools
import math
from random import Random
import pytest
import networkx as nx
from networkx import convert_node_labels_to_integers as cnlti
from networkx.algorithms.distance_measures import _extrema_bounding
def test__extrema_bounding_invalid_compute_kwarg():
G = nx.path_graph(3)
with pytest.ra... |
bbad9afb31bfecda490f8061ea40596d49ed39154ce1764877dcc65fdc090464 | Python | 29,140 | 851 | """
Text-based visual representations of graphs
"""
import sys
from collections import defaultdict
import networkx as nx
from networkx.utils import open_file
__all__ = ["generate_network_text", "write_network_text"]
class BaseGlyphs:
@classmethod
def as_dict(cls):
return {
a: getattr(cl... |
7516b416637beb291fd58f5f8cc67784128441037e146a08f535a68092fe5973 | Python | 29,178 | 818 | # -*- coding: utf-8 -*-
"""PSF module
Generates an LSM point-spread function
"""
# Created on Wed Jun 17, 2020
# Contributions and Changelog accessed via a private git repository:
# https://github.com/philipwijesinghe/deep-learning-lsm.git
# philip.wijesinghe@gmail.com
# Copyright (c) 2020 Philip Wijesinghe@Univer... |
4aa15fab6c28ed8356fe200e9fca7c72e703462dfe233b08c61216e11b07a9e0 | Python | 29,187 | 769 | # -*- coding: utf8 -*-
"""
Autoencoder + SSI with tensorflow and keras
"""
import inspect
import os
import pickle
import collections
import re
import json
import random
import copy
import tensorflow as tf
import numpy as np
import sklearn.model_selection as SKMS
from . import custom_layers
from .blocks import BaseAr... |
b2dd2e036af1cddcb1f2f000a225794a87c3a418bcbe46dc474590a9f7f4a819 | Python | 29,206 | 785 | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 2 14:28:44 2019
@author: aaussel
"""
#import matplotlib
#matplotlib.use('Agg')
from brian2 import *
start_scope()
from scipy import signal
from cells.RS_LIP import *
from cells.FS_LIP import *
from cells.SI_LIP import *
from cells.IB_soma_LIP import *
from cells.IB_ax... |
6b050d3a2135ca72949e3940a83d36b2199797ea829045101883d3178b9d275d | Python | 29,254 | 796 | """Group centrality measures."""
from copy import deepcopy
import networkx as nx
from networkx.algorithms.centrality.betweenness import (
_accumulate_endpoints,
_single_source_dijkstra_path_basic,
_single_source_shortest_path_basic,
)
from networkx.utils.decorators import not_implemented_for
__all__ = [
... |
6225b1e370ccfec6997328b3c8a04b3cd1f89e8d8f914899cd9c2adbc04f63fe | Python | 29,280 | 761 | """
Manager and Serializer for HDAs.
HistoryDatasetAssociations (HDAs) are datasets contained or created in a
history.
"""
import gettext
import logging
import os
from typing import (
Any,
Optional,
TYPE_CHECKING,
Union,
)
from urllib.parse import quote_plus
from sqlalchemy import (
and_,
asc... |
fa72c8dc3a25e9f9c068db325f583dfd23e4d73f48d955fd30d6839ac7b3199b | Python | 29,284 | 788 | from gc_segment.utils import *
from VolumeAnnotator import *
import pickle
import time
import numpy as np
import threading
import time
import itertools
import argparse
import maxflow
import logging
import numpy as np
import SimpleITK as sitk
from funlib.segment.arrays import replace_values
from gc_segment import v... |
d14c6bb08009b34874f7ebcb535af71bc0ce6c85d395e71cf28ebd5d2bf83811 | Python | 29,294 | 850 | """
Tests for HDBSCAN clustering algorithm
Shamelessly based on (i.e. ripped off from) the DBSCAN test code
"""
import numpy as np
from scipy.spatial import distance
from scipy import sparse
from scipy import stats
from sklearn.utils.estimator_checks import check_estimator
from sklearn.utils._testing import (
asser... |
0e36c2a2d0d6eb1480681b236d6f8bf25e0dd147309abc553604ab6602231963 | Python | 29,332 | 770 | # -*- coding: utf-8 -*-
"""
requests.session
~~~~~~~~~~~~~~~~
This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
"""
import os
import sys
import time
from datetime import timedelta
from .auth import _basic_auth_str
from .compat import cookielib, is_py3, Ord... |
b02b27c671218ab218638e53de15d3cc56e351a433896f46660cd7b14711328d | Python | 29,333 | 733 | from oct.utils.psUtils import *
from ..load.metadata import Metadata
import math
import logging
cp, np, convolve, gpuAvailable, freeMemory, e = checkForCupy()
class Polarization:
""" Polarization contrast OCT reconstruction"""
def __init__(self, mode='sym'):
acceptedModes = 'rt+classic+sb+sym+mm'
... |
b467a61a4c24f96d3b4304e65d199e1d1528329fd1a6d9bcf8a04f0a0bc07f6d | Python | 29,333 | 851 | # -*- coding: utf-8 -*-
"""
Script to generate a DDLS grade for each fundus image in the dataset.
First calls the segmentation model on the image and calculates minimum
rim to disc ratio or angle of missing rim.
This information is then combined with the predicted disc size to generate a
DDLS grade.
We are not making... |
ee382dd75b36ed58ecb85f2dff4781074b7454d3183843d47f0eb302aa80aa9c | Python | 29,343 | 686 | # Copyright (c) MONAI Consortium
# 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 agreed to in writing, so... |
ce1ea45c303a845926ffc0e449c3bc290373ea3bf871b976467a051ba76b832b | Python | 29,371 | 870 | # -*- coding: utf-8 -*-
"""
Module to Postprocess skeletonized vasculature data
"""
__author__ = 'Christoph Kirst <ckirst@rockefeller.edu>'
__license__ = 'MIT License <http://www.opensource.org/licenses/mit-license.php>'
__copyright__ = 'Copyright 2017 by Christoph Kirst, The Rockefeller University, New York City'... |
37ef1cbf5bbc934dbd6517e94e3d288f9c6f32b064a9c0f7f1c3edf2e1730276 | Python | 29,410 | 738 | '''
'''
#
# Adapted from MATLAB code written by S. Nishimoto (see Nishimoto, et al., 2011).
# Anwar O. Nunez-Elizalde (Jan, 2016)
#
# Updates:
# Anwar O. Nunez-Elizalde (Apr, 2020)
#
import itertools
from PIL import Image
import numpy as np
from moten.utils import (DotDict,
iterator_func,
... |
c88a0cc3737c98725aa1fe892d807bbf3feec4e32cd0c9ef88e49929e7091eb2 | Python | 29,525 | 740 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import unittest
from unittest import mock
import datumaro as dm
import numpy as np
from cvat.apps.dataset_manager import data_model as cdm
from cvat.apps.dataset_manager.data_model.adapters.datumaro import adapt_... |
ad06086c5f6326213cd35cc0be1ffe293f941dc13f05dcd9257b7312eac911fa | Python | 29,564 | 753 | from copy import deepcopy
import torch
import torch.nn as nn
from .. import functional, layer, neuron, surrogate
from .ms_resnet import MSResNet, _MSBlock, _conv1x1
__all__ = [
"MASNN",
"AttMSResNet",
"masnn_dvs128_gesture",
"att_ms_resnet18",
]
def _ma_lif(**overrides) -> neuron.LIFNode:
"""De... |
7cd47a38eb2cce70b61615d3bda4d23fa8ccd486119bbd7a971489cdda197589 | Python | 29,623 | 587 | """
qc_harness.py - post-pipeline per-subject QC: one qc_summary.csv row per subject with sanity
metrics, a PASS/FLAG per stage, and an overall verdict. Beyond the absolute thresholds, any
metric > 3 MAD from the cohort median is also flagged. An outlier is a signal to inspect/fix.
Usage:
simnibs_python analysis/qc_... |
30b527cafcda18a8902558dec93065d89e8c8425a2bd86812d7fef1b9d247398 | Python | 29,681 | 812 | #!/usr/bin/env python
"""Benchmark himalaya backends: speed and correctness of RidgeCV, KernelRidgeCV,
and MultipleKernelRidgeCV across numpy, torch (CPU), torch_cuda, and torch_mps.
Usage
-----
python benchmarks/benchmark_backends.py [OPTIONS]
Options
-------
--n_samples INT Number of samples (default:... |
07a66cd0184aaf645fe73d940b3b9a7fb0669d61e90eb59eb60041bc7b448966 | Python | 29,725 | 710 | from collections.abc import Sequence
import numpy as np
import tensorflow as tf
from hidten import HMMMode
from hidten.tf.hmm import TFHMM, T_shapelike
from hidten.tf.prior import TFCombinedPrior, TFInverseGammaPrior
from learnMSA.config import LanguageModelConfig, PHMMConfig, PHMMPriorConfig
from learnMSA.config.str... |
671efc839d26c25432225298b270e910a9e5a216f22884b3e612248f6754ff2f | Python | 29,733 | 680 | import cv2
import numpy as np
from cellpose import transforms, io, models, metrics, utils, denoise, vit
import torch
from pathlib import Path
from natsort import natsorted
import time
from tqdm import trange
import fastremap
dsets_all = ["deepbacs", "bact_phase", "bact_fluor", "tissuenet", "cyto2",
"monuseg"... |
427a933771dca3ab653dadde431c78a5ddfb12786256de2b6f9811820fcabd0d | Python | 29,749 | 697 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import warnings
from copy import deepcopy
from functools import partial
from math import sqrt
from typ... |
d8f8476e388748e7846f49b11e021b841ee228ee8565a921c097723ea7f85e1c | Python | 29,799 | 952 | from typing import Any
import sys
import pytest
from unittest import mock
from .. import CLI
import numpy as np
import nibabel as nib
from ..utils.default_parameters import default_parameters
import pandas as pd
import json
from pathlib import Path
SHAPE = (10, 10, 10, 10)
mockTR = 2
def get_data(image_type, TR=moc... |
895505dd0aaefbc1a0a9f3a2572fd9cde78b85aa94bf9cb4f6cf7a1398cb0ec4 | Python | 29,805 | 719 | import os
import random
import unittest
from itertools import chain as _ic
from itertools import count as _ico
import nrrd
import numpy as np
import voxcell
from bsb_test import (
DictTestCase,
NetworkFixture,
NumpyTestCase,
RandomStorageFixture,
get_data_path,
)
from bsb import (
MPI,
Bra... |
f9bd61d3c2529ba8988ac241f51813db7159c4f31c0ade3b5bbd95bb8cc02c05 | Python | 29,809 | 810 | # Copyright (C) 2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import io
import json
from functools import partial
from http import HTTPStatus
from typing import Any
import pytest
from cvat_sdk.api_client import ApiClient, models
from cvat_sdk.api_client.api_client import ... |
5d97a33ce2e7d2431176a333c4342b6149c6d089d42b6a7c499a3747f1294a66 | Python | 29,825 | 776 | """
Created on Oct 13, 2022.
@author: voodoocode
"""
import numpy as np
import scipy.sparse
import mpmath
import os
import sklearn.neighbors
import ctypes
import mne
import csv
def read_eeg_pts(system = "1020"):
"""
Read EEG channel names and locations from file.
Parameters
----------
system... |
5e982c6c17ef8a310d2fccee477bf30d037ff94117111546b635521feddd079e | Python | 29,848 | 547 | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 5 09:51:49 2019
@author: schelskim
"""
from .sortpoints import sortPoints
from .somatools import SomaTools
from .generaltools import generalTools
import numpy as np
from skimage import morphology as morph
from scipy import ndimage
from skimage import measure
import co... |
4e816174f891af0fe10468be8fdd10e6575d6544a10ec1402f909b31f212b550 | Python | 29,909 | 698 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from time import sleep
from unittest import mock
from unittest.mock import patch, PropertyMock
import... |
730d4b561f380febab6dda80402bb612ebbd1b14dd6c433c37cece47f91f5401 | Python | 29,912 | 988 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
ArrayProcessing
===============
Tools for parallel processing of large arrays.
Note
----
This module provides an interface to deal with large numpy arrays and speed up
numpy routines that get very slow for data arrays above 100-500GB of size.
The implementation bui... |
4719ddd1c11cdbf0cf7e3d195dd86ae2dc10c043445bde810ae2d7393a6702a8 | Python | 29,918 | 636 | from genomic_regions import GenomicRegion, RegionBased
from .maxima_callers import MaximaCallerDelta
from .helpers import RegionScoreMatrix
from ..regions import RegionsTable
from ..tools.matrix import apply_sliding_func, trim_stats
from ..tools.files import write_bed, write_bigwig, write_gff
from ..tools.matrix import... |
1929c0ff4913ec37fc6a3559d1978e6d96ef8f880431a4159572a713661a531f | Python | 29,959 | 788 | import warnings
from collections import OrderedDict
from concurrent.futures import ProcessPoolExecutor, as_completed
import anndata
import joblib
import leidenalg
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
import seaborn as sns
from imblearn.ensemble import BalancedRan... |
5c08a81fe2f4dfcb468a02e811ea8c0e9e0f293f46549943993bf88c511636ce | Python | 30,006 | 782 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import warnings
from collections.abc import Iterable
import numpy as np
import numpy.typing as npt
im... |
a353e11b28a42748b12582eee5b428d42b25fdf06e1f8ce9871a4a27c13416e9 | Python | 30,032 | 714 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
2ed3c9d5d6fa9897dfd932522562a2eeb069ce33d2de648eae30bdcd18680f70 | Python | 30,049 | 977 | # -*- coding: utf-8 -*-
"""
requests.utils
~~~~~~~~~~~~~~
This module provides utility functions that are used within Requests
that are also useful for external consumption.
"""
import codecs
import contextlib
import io
import os
import re
import socket
import struct
import sys
import tempfile
import warnings
import... |
fd2302ba59882a78ebc48aebcae8e18cbaa4e9f475a5374e1d682f0fcd28018d | Python | 30,120 | 699 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import itertools
from collections import Counter
from contextlib import closing, suppress
from copy import deepcopy
from django.db import transaction
from django.db.models import OuterRef, Subquery, prefetch_relat... |
1b8f5f4f326e4711ba158870f448841673563a870efba18339c894d06ffe66cd | Python | 30,138 | 849 | import datetime
import decimal
import re
import warnings
from collections import defaultdict
from pathlib import Path
import rdflib
from rdflib import BNode, Literal, URIRef
from rdflib.util import guess_format
from rdflib.extras.infixowl import EnumeratedClass
from rdflib.namespace import OWL, RDF, RDFS, SKOS
from n... |
8a4465f7664b2e2874e4e84b2e283129329af08fb5bcc0092e25b259f18f3cb8 | Python | 30,161 | 757 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
803623b3b3061b5bbb99ffd616a8b2ac4cbfff77ac2e9a8ac6a3fd5cf9e1f2c4 | Python | 30,170 | 620 | """Build the model-quality report: a full detail file and a condensed pull-request comment.
data/testResults/model_qc_summary.md is the full, per-check breakdown (every row,
MEMOTE's per-section and per-test scores, everything) -- committed, so it is always
browsable on GitHub regardless of size. data/testResults/mode... |
5f02009c25e1346ad0bf89bca296070c1461dfc71c918cdddb4c34fab242ea37 | Python | 30,182 | 715 | import matplotlib
import matplotlib.colors as colors
import matplotlib.pyplot as plt
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
import networkx as nx
import numpy as np
import sklearn.metrics as metrics
import torch
import torch.nn as nn
from torch.a... |
ebc4b812be90ac4864ceca29a3dabcef8d674918774662b66d47e28e55b3b476 | Python | 30,213 | 711 | """Utilities for converting between request states."""
import logging
from copy import deepcopy
from typing import (
Any,
Callable,
cast,
Dict,
List,
Optional,
Sequence,
Union,
)
from galaxy.tool_util_models.parameters import (
BooleanParameterModel,
ConditionalParameterModel,
... |
0cceeb7b3a24e447c706892d85ebe4fc1bf42d001f07e8933ed856680c944dcd | Python | 30,270 | 819 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from typing import Any
import numpy as np
import numpy.typing as npt
import pandas as pd
import plotl... |
b042df1001c50e4ded32ba49f5be20725fc4d0d771ff08ad4f0c06330b95c853 | Python | 30,295 | 602 | import abc
import numpy as np
import torch
from torch import nn
from torch.distributions import Categorical
from torch.nn import functional as F
from utils import get_data_loader
from models import fc
from models.utils.ncl import additive_nearest_kf
class ContinualLearner(nn.Module, metaclass=abc.ABCMeta):
'''Abs... |
06a5d294284df7f86309683237a25d720bc151d737ed00825f8bb7ffccc4ffda | Python | 30,309 | 804 | """
SecureTranport support for urllib3 via ctypes.
This makes platform-native TLS available to urllib3 users on macOS without the
use of a compiler. This is an important feature because the Python Package
Index is moving to become a TLSv1.2-or-higher server, and the default OpenSSL
that ships with macOS is not capable... |
228ffa1cf2e9fc5d3b940237021349fa5283eceacddfa7813380545d5f394998 | Python | 30,381 | 1,003 | r"""
Query Builder Base, Region and Neurosynth Mixins
================================================
Base classes to construct Datalog programs.
Capabilities to declare, manage and manipulate symbols.
Mixins provide capabilities related to brain volumes and
Neurosynth metadata manipulation
"""
from contextlib import ... |
80d0297411e163381db0b18807c3475c63850d94881c660c2db0b900bebd859b | Python | 30,394 | 547 | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 5 09:51:49 2019
@author: schelskim
"""
from .sortpoints import sortPoints
from .somatools import SomaTools
from .generaltools import generalTools
import numpy as np
from skimage import morphology as morph
from scipy import ndimage
from skimage import me... |
a79199b5a2c825f7623204b0b529b613f29724015ead1b362fe618f1f6c94075 | Python | 30,428 | 563 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sept 25, 2020
@author: chris3arcadia
@description: script to review a composite library sourceplatesheet and to optionally
generate a mass list and Echo recipe for that library
Composite Library Style #6... |
9b3178a3822c33649ab42a76706823c48c39cca5ca943a128a903678f7cd37b8 | Python | 30,467 | 886 | """Generate graphs with a given degree sequence or expected degree sequence."""
import heapq
import math
from itertools import chain, combinations, zip_longest
from operator import itemgetter
import networkx as nx
from networkx.utils import py_random_state, random_weighted_sample
__all__ = [
"configuration_model... |
cf63cb71eadae99f1cf41a18b916472b2591926a49f45d2756d1700f0ed7bf73 | Python | 30,519 | 665 | import os
import time
from sklearn.metrics import f1_score, precision_score
from sklearn import ensemble
from sklearn import tree
from sklearn.model_selection import RandomizedSearchCV
from sklearn.naive_bayes import GaussianNB
from sklearn.neural_network import MLPClassifier
from sklearn.svm import SVC
from sklearn.li... |
3f9473f2ac61319c15945f76f5389e4153b8249518f1ee21a24f08a1414065ad | Python | 30,529 | 825 | import pytest
from pathlib import Path
from pydantic import ValidationError
from learnMSA.config import (AdvancedConfig, Configuration,
InitMSAConfig, InputOutputConfig, LanguageModelConfig,
TrainingConfig, VisualizationConfig, get_value)
class TestConfigurat... |
95750ce0c89fbfc7b210d663f97528ae4afd9668400bc9c59bc3263a3be9130b | Python | 30,548 | 831 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
2fc2e09722489d9af9754d9b60d00fc9576368f2f1b623a85e73fd9b865b7020 | Python | 30,619 | 851 | import matplotlib.pyplot as plt # To plot
from scipy.optimize import curve_fit
from pylab import *
import numpy as np
import data_treatment as datr
import random
import math
import time
import os
import glob
import copy
def rmsd(x,y):
Nx = len(x)
Ny = len(y)
if Nx!=Ny:
... |
bb066f0dfe21381ff5679291256e79afb09a8e27c6aa6c34b623c1a1449f78d0 | Python | 30,637 | 894 | """
The main brainbow classes.
Here we have two classes, one for generating synthetic images and
one for analysing images.
"""
from __future__ import print_function
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib.pa... |
14299f7709cb6c3bff9d9e21dd24148c6a343c115e6b9e0311c6cc54cd969a78 | Python | 30,656 | 758 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
"""
DerivedMetric: A metric computed from other metrics.
``DerivedMetric`` is a base class for metric... |
e1c6b63dc44dad2469cf528828ce9bf0120b4ace8906471c70add175b2e7304b | Python | 30,688 | 733 | """Base module for working with MIBI images.
Copyright (C) 2021 Ionpath, Inc. All rights reserved."""
import datetime
import os
import warnings
import numpy as np
from skimage import io as skio, transform
# The format of the run xml.
_DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%S'
# The attributes to include in the metadat... |
cae8f2a977ab61d977c56c8ac0dc20c40a77aa3d18c861b9478844c79cb860f8 | Python | 30,725 | 779 | import importlib
import inspect
import itertools
import math
import pytest
import torch
from spikingjelly._ops.layout import _empty_like, _layout_args
from spikingjelly.activation_based import functional, neuron, surrogate
try:
import triton
import triton.language as tl
except ImportError:
triton = None
... |
f8d33346b33709c66fd43814bb9469872cecbd1640d7f4c2579bc8cce1f06b31 | Python | 30,733 | 570 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thur September 05 2018
@author: chrisarcadia
@description: script to review a composite library sourceplatesheet and to optionally
generate a mass list and Echo recipe for that library
Composite Library Style #2
... |
4ba4ecb502ffa602adff9071fcd14a2edcede6ccf029b581be3a99a818525633 | Python | 30,754 | 807 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import math
import warnings
from collections.abc import Callable, Sequence
from dataclasses import dat... |
99a38c8b14f10e26ef04bd8191571a633d42a3fd3d8e0f1dec3a405b66e53676 | Python | 30,776 | 981 | """
Threshold Graphs - Creation, manipulation and identification.
"""
from math import sqrt
import networkx as nx
from networkx.utils import py_random_state
__all__ = ["is_threshold_graph", "find_threshold_graph"]
@nx._dispatchable
def is_threshold_graph(G):
"""
Returns `True` if `G` is a threshold graph.
... |
52f426514270f0900afb5dfbd772c8a1edf66ee2ddc505452d42a1da34e4d4a3 | Python | 30,838 | 1,110 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
ArrayProcessing
===============
Tools for parallel processing of large arrays.
Note
----
This module provides an interface to tools to deal with large numpy arrays
and speed up numpy routines that get very slow for data arrays above
100-500GB of size.
"""
__author__ ... |
8427f3ab79a50d2c62f96b0e52a68bf4305f66691889a939fd0afe0742b948f0 | Python | 30,899 | 729 | from dataclasses import dataclass
from typing import Sequence
import numpy as np
from learnMSA.config.hmm import PHMMConfig
from learnMSA.config.language_model import LanguageModelConfig
from learnMSA.config.structure import StructureConfig
from learnMSA.config.training import TrainingConfig
from learnMSA.config.util... |
9ab76c5ca9c5ae65ca41f632379d1a4b53717437a6a0cc939311eed2a4340afb | Python | 30,946 | 779 | """
Tools for generating ATAC-specific plots from terminal pipeline outputs.
"""
from __future__ import division, print_function
import pandas as pd
from itertools import izip
from plots import downsample_scatterplot_by_density
from utils import get_purity_info
import numpy as np
from scipy import stats
from barcodes... |
06ddcf9e2ad95a91ff8ac9d6f15c17951dc79c228b93c82054bf5f1e378013a3 | Python | 30,957 | 755 | from __future__ import annotations
import geopandas as gpd
import numpy as np
import pandas as pd
import spatialdata as sd
import xarray as xr
from dask.base import is_dask_collection
from shapely.geometry import Polygon
from spatialdata._logging import logger
from spatialdata.models import ShapesModel
from spatialdat... |
c89cac3d9ad8fcd70a74a982733ee691a26ad598d8d0ed7ab16248429fa9d671 | Python | 30,980 | 1,079 | """Tests for the Polars Relational Algebra Set backend.
Verifies that all core operations produce identical results
to the pandas backend on the same inputs.
"""
from typing import AbstractSet, Tuple
import pytest
import polars as pl
import numpy as np
from ..relational_algebra_set import (
RelationalAlgebraColu... |
d077722474c20d2e113ba4ae9533c0846df9128cff43f42a1d3bd81714283c9c | Python | 30,989 | 912 | #!/usr/bin/env python
#
# Copyright (c) 2015 10X Genomics, Inc. All rights reserved.
#
import collections
import csv
import h5py
import itertools
import json
import numpy as np
import os
import random
import re
import tenkit.bam as tk_bam
import tenkit.fasta as tk_fasta
import tenkit.log_subprocess as tk_subproc
import... |
e15032fd1b6d732a525c5026617069bd3ef452dbd8b03e7c6341574a196fba40 | Python | 31,075 | 797 | # Support various prediction methods for predicting cluster membership
# of new or unseen points. There are several ways to interpret how
# to do this correctly, so we provide several methods for
# the different use cases that may arise.
import numpy as np
from joblib import Parallel, delayed
from joblib.parallel imp... |
41235dfb78a8770f6af34b429d402d2eccc8024c95c6d489740bffa8ff43ae0e | Python | 31,082 | 794 | """Tests for the interactive brain viewer page that ``.view`` writes."""
import base64
import gzip
import json
import os
import re
import shutil
import subprocess
import zlib
from pathlib import Path
import nibabel as nib
import numpy as np
import pytest
pytest.importorskip("prompt_toolkit")
pytest.importorskip("ric... |
f240934b50cd44650d3d760c6d1638d2bc747e2f1cb8ada5f0415c3665dc9d86 | Python | 31,092 | 966 | from heapq import heappop, heappush
from itertools import count
import networkx as nx
from networkx.algorithms.shortest_paths.weighted import _weight_function
from networkx.utils import not_implemented_for, pairwise
__all__ = [
"all_simple_paths",
"is_simple_path",
"shortest_simple_paths",
"all_simple... |
e1df95d94e354c3ec10d490d14b7f355c89c369edb066ced3d1cdc89a667469d | Python | 31,101 | 817 | """
Manager and Serializers for Pages.
Pages are markup created and saved by users that can contain Galaxy objects
(such as datasets) and are often used to describe or present an analysis
from within Galaxy.
"""
import logging
import re
from collections.abc import Callable
from html.entities import name2codepoint
fro... |
f7795c558a90eea2a1fbe4fb8559c382f599d9c3f8e4c867aa48a4e6bf6562d6 | Python | 31,137 | 666 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from __future__ import annotations
from collections.abc import Sequence
from copy import deepcopy
fro... |
6d68cfa5db9bbe788963456bf979e0d178aa6269543a2387374de25cf4838989 | Python | 31,143 | 743 | """
Copyright © 2025 Howard Hughes Medical Institute, Authored by Carsen Stringer , Michael Rariden and Marius Pachitariu.
"""
import os
import cv2
from cellpose import transforms
from scipy.ndimage import find_objects, center_of_mass, mean
import torch
import numpy as np
import tifffile
from tqdm import trange
import ... |
458488145be05ba358e5be99c29849750876f7db4fd507cee0940e9b85ccb021 | Python | 31,180 | 894 | from collections import deque
from itertools import combinations, permutations
import pytest
import networkx as nx
from networkx.utils import edges_equal, pairwise
# Recipe from the itertools documentation.
def _consume(iterator):
"Consume the iterator entirely."
# Feed the entire iterator into a zero-lengt... |
0e248c9805de597e87a8f067f548a8daad6084643f689f44163b779fc2dab120 | Python | 31,192 | 703 | import json
import re
import urllib.request
from typing import (
Any,
cast,
get_args,
Optional,
)
from urllib.error import HTTPError
from urllib.parse import quote
from typing_extensions import TypedDict
from galaxy.exceptions import (
AuthenticationRequired,
MessageException,
ObjectNotFou... |
0eb48ada6968230e9cf1a47bf1bd92f9eff2674ab6441665e543aa79ee4b3ac0 | Python | 31,210 | 959 | #!/usr/bin/env python
#
# Copyright (c) 2014 10X Genomics, Inc. All rights reserved.
#
import os.path
import h5py
import numpy as np
import tenkit.pandas as p
import itertools
import pprint
pp = pprint.PrettyPrinter()
CHUNK_SIZE=2**16
vlen_string = h5py.special_dtype(vlen=str)
COMPRESSION = 3
LEVEL_GROUP = "_levels"... |
4fdabd93c2d157b8d89cc2d79e67a6e2f0a4308e0ff6790258ac4fc8a4a89247 | Python | 31,243 | 797 | """
Agents translating a question into a NeuroLang query with an LLM.
Two strategies are offered, following the text-to-SQL and text-to-SPARQL
literature:
* :class:`IclAgent`, in-context learning: the prompt holds the syntax of
the language, the predicates of the engine and the examples closest to
the question; t... |
e0c7f20f4d29d44bcec8762f9e0d08ab3ff93013403a56846f8e33f8242d52e3 | Python | 31,291 | 649 | """
Query router agent that answers directly or hands off to specialists.
Uses pydantic-ai output functions to either:
- Answer general Galaxy questions directly (returns str)
- Hand off to error_analysis for job debugging
- Hand off to custom_tool for explicit tool creation requests
- Hand off to tool_recommendation ... |
5e48e5b41d1b90b0fb788c51652a0cad0bddcac23312f74c726bbc1dd1133846 | Python | 31,318 | 617 | """Regenerate an animal GEM (Mouse, Rat, Worm, Fruitfly, Zebrafish) from Human-GEM.
Python/raven-toolbox replacement for the ``masterScript<Species>GEM.m`` scripts that
each Animal-GEM repository carried (see Human-GEM issue #421). The five scripts differed
only in the species name, so the species is an argument here ... |
b2827bff072a1c2cedd1808cce43f4ddc8e63d2b21e6e1df6c82f34a1e1c507b | Python | 31,331 | 871 | """
Module for the plots and reports related to the simulation analysis of BSB scaffold.
"""
from os import listdir
from os.path import isfile, join
from typing import List, Tuple, Union
import numpy as np
from bsb import Scaffold
from elephant.kernels import GaussianKernel, Kernel
from elephant.statistics import ins... |
b19d81dce32901fd90e07576f24e020b86479bcec1c98cb6b622cadae9157bd7 | Python | 31,349 | 820 | """The shared device operator is the public execution seam."""
import importlib
from importlib import metadata
import pytest
import torch
from torch._subclasses.fake_tensor import FakeTensorMode
FAMILIES = (
"if_",
"lif",
"plif",
"qif",
"eif",
"izhikevich",
"ilif",
"activation_aware_... |
52b0d1dd1495efd2be7d288c19357327fca529c0ed08be309a44222007ce0862 | Python | 31,361 | 876 | """Qwen2.5 dense/SNN WikiText-2 and zero-shot quality evaluation."""
from __future__ import annotations
import argparse
from datetime import timedelta
import hashlib
import json
import math
import os
import sys
import time
from contextlib import contextmanager
from importlib import metadata
from pathlib import Path
f... |
ce8c1c7bc9caa3a28c2dc20668245a2e1ca4710206d9d33ecd62afe052af9d72 | Python | 31,366 | 713 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
ffecf23e9ba8ab851b3142704169f9990fa55fa2b9c7c88ce8bbeb49d425dd2c | Python | 31,368 | 852 | # -*- coding: utf-8 -*-
"""
Modified version of dataloader from:
https://github.com/HasnainRaz/SemSegPipeline
A TensorFlow Dataset API based loader for semantic segmentation problems.
"""
import random
import cv2
import numpy as np
import tensorflow as tf
class DataLoaderDataset():
def __init__(self,
... |
a84f304b6893230f264e382afdd63e519bed7b827c1da5661385f4cf2ea6eae0 | Python | 31,385 | 815 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
TubeMap
=======
This script is the main pipeline to generate annotated graphs from vascualture
lightsheet data [Kirst2020]_.
See the :ref:`TubeMap tutorial </TubeMap.ipynb>` for a tutorial and usage.
.. image:: ../Static/cell_abstract_2020.jpg
:target: https://d... |
8c015cb4508e21e8fdbcefb52da70cafda33850c17cd4d7b07f3915ec294c199 | Python | 31,443 | 910 | """Tests for the session commands of the interactive REPL."""
import gzip
import io
import re
import pytest
pytest.importorskip("prompt_toolkit")
pytest.importorskip("rich")
from rich.console import Console # noqa: E402
from nl_expr.expressions import Symbol # noqa: E402
from neurolang.frontend import NeurolangP... |
3b2c0568982ce3cce8f1808005fa66f197d32be48bac8f409ea1a00df888696b | Python | 31,451 | 544 | # Partially inspired by https://github.com/jordiae/DeepLearning-MAI
import torch
import logging
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
import time
import argparse
from utils import load_architecture, evaluate
from training.covid_torch_dataset import CovidDataset, Covid... |
c006ae6686d4f13d2c1da9b0d047f65d697872768660e79bb53fc5e95011e76e | Python | 31,485 | 796 | """Permutation test function as described in CellPhoneDB 2.0."""
from __future__ import annotations
from abc import ABC
from collections.abc import Iterable, Mapping, Sequence
from itertools import product
from types import MappingProxyType
from typing import TYPE_CHECKING, Any, Literal, NamedTuple
import numpy as n... |
ef0e87cff80221e9a826a8eb9af60d2a81320a40d0f7239cc46d330e65673f8e | Python | 31,488 | 683 | import os
from dataclasses import (
dataclass,
replace,
)
from re import compile
from typing import (
Any,
cast,
Dict,
FrozenSet,
List,
Optional,
Set,
Tuple,
)
from packaging.version import Version
from typing_extensions import Literal
from galaxy.tool_util.parser.interface imp... |
ac7591a258b4074e3a3404e25d608d25e2b9a8f4590543752998569bb55c9356 | Python | 31,511 | 747 | """
LSO FSM Workflow Tests
Tests FSM state tracking through realistic user workflows using the SDK/API.
Validates that FSM correctly tracks state changes during actual user journeys.
This test file focuses on LSO-specific functionality:
- Project lifecycle: CREATED -> IN_PROGRESS -> COMPLETED
- Task lifecycle: CREATE... |
26436688f92ebf8a914741f53f339c7f552817b6be43a0cda3db775ea21d0de8 | Python | 31,554 | 764 | """
Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
Produces the final customer-facing web_summary.
"""
from __future__ import division
from websummary import summarize
import json
import pandas as pd
import martian
import numpy as np
import os
import h5py
from tools import ReferenceManager
from metrics... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.