sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c53eb727f427c456c1b40940944da85c7cde9a496dc717e753a3cf11be585d32 | Python | 9,491 | 329 | """This module defines Galaxy's custom exceptions.
A Galaxy exception is an exception that extends :class:`MessageException` which
defines an HTTP status code (represented by the `status_code` attribute) and a
default error message.
New exceptions should be defined by adding an entry to `error_codes.json` in this
dir... |
400222e00d0837fa101954e212d5a997b7a887f14c220561a7c6637250e67558 | Python | 9,493 | 190 | # -*- coding: utf-8 -*-
# Copyright (C) 2015, Egor Zindy <egor.zindy@manchester.ac.uk>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# 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 Soft... |
188bcad9dd12652da63759183ff47bbc58edf11be4c6f82cc0fd0299f8f1add3 | Python | 9,498 | 306 | """Hubs and authorities analysis of graph structure."""
import networkx as nx
__all__ = ["hits"]
@nx._dispatchable(preserve_edge_attrs={"G": {"weight": 1}})
def hits(
G,
max_iter=100,
tol=1.0e-8,
nstart=None,
normalized=True,
*,
method="power_iteration",
):
"""Returns HITS hubs and a... |
b93eea8cad21dde8da689c448edf05cae06b6269350d07f4b7c3cd63b7c46502 | Python | 9,499 | 253 | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 23 11:00:55 2022
@author: marcomau
"""
import os
import time
import copy
import datetime
import json
import torch
import collections
from sklearn.model_selection import train_test_split
import numpy as np
def var_data(features, mean_val):
if len(fe... |
f5f4f590d8c21389982399e886a816d32360e1af0c14cb83bd23564aff46e88e | Python | 9,514 | 215 | #### tests for MeldCohort ####
# tested functions:
# full_feature_list (2 tests)
# get_subject_ids
# get_sites
# split_hemispheres
# cortex_label attribute
# NOTE:
# these tests require a test dataset, that is created with get_test_data()
# executing this function may take a while the first time (while th... |
b1d4e2f649aac414666e7bc4d4f2c080b808e670626336881a83505a4725a8d1 | Python | 9,515 | 272 | import typing
import pytest
from ...datalog.expressions import Fact
from ...datalog.magic_sets import probabilistic_symbols
from ...datalog.wrapped_collections import (
WrappedNamedRelationalAlgebraFrozenSetMixin,
WrappedRelationalAlgebraSetMixin,
)
from nl_expr.exceptions import UnexpectedExpressionError
fro... |
8f24e72b510b12d43c5809fe80a9c5bfc89631294718b4b528ab0275415244de | Python | 9,519 | 274 | import logging
from core.permissions import ViewClassPermission, all_permissions
from core.utils.common import load_func
from django.conf import settings
from django.db.models import CharField, Count, Q
from django.db.models.functions import Cast
from django.utils.decorators import method_decorator
from django_filters... |
6ddf45bfa69c0a921cf9827ae70f84bb66281941862528e4ad3458b66d159c87 | Python | 9,520 | 244 | """
Job runner plugin for executing jobs on the local system via the command line.
"""
import datetime
import logging
import os
import subprocess
import tempfile
import threading
from time import sleep
from typing import (
TYPE_CHECKING,
)
from galaxy import model
from galaxy.job_execution.output_collect import d... |
80a2e3789fc81e787ec376cc00e8fd5fa214dc12f20839a32a3bdf1f18c9c935 | Python | 9,520 | 251 | # -*- coding: utf-8 -*-
"""
Example script to set up the parameters for the image processing pipeline
"""
######################### Import modules
import os, numpy, math
import ClearMap.Settings as settings
import ClearMap.IO as io
from ClearMap.Alignment.Resampling import resampleData;
from ClearMap.Alignment.Elas... |
34b8b28f595b31efdbd193b44fe294838314e90d059f41403fd4a687ccf6c35d | Python | 9,528 | 295 | #%%
import numpy as np
import os
import sys
import time
import pandas as pd
from tqdm._tqdm_notebook import tqdm_notebook
import pickle
from keras.models import Sequential, load_model
from keras.layers import Dense, Dropout
from keras.layers import LSTM
from tensorflow.keras.callbacks import ModelCheckpoint... |
41499ebbc959cce8b6f917134442427e29686f0a6bef0d83c8c0d6e6dec99766 | Python | 9,534 | 261 | """Unit tests for PyGraphviz interface."""
import warnings
import pytest
import networkx as nx
from networkx.utils import edges_equal, graphs_equal, nodes_equal
pygraphviz = pytest.importorskip("pygraphviz")
class TestAGraph:
def build_graph(self, G):
edges = [("A", "B"), ("A", "C"), ("A", "C"), ("B",... |
71f90a13ec00e5a33f491d4a1919c0aff1d28f9b1c2826b1b6c42b1103e44ca9 | Python | 9,540 | 295 | import numpy as np
import os
import sys
import time
import pandas as pd
from tqdm._tqdm_notebook import tqdm_notebook
import pickle
from keras.models import Sequential, load_model
from keras.layers import Dense, Dropout
from keras.layers import LSTM
from tensorflow.keras.callbacks import ModelCheckpoint, Ear... |
b04dad8cc2525b83a6a67c37a97c6112a97f6781817413e5b7304b8d6dccb161 | Python | 9,543 | 218 | # 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... |
fdb062cbeb4549da1402a497cee4f5ed785b8355e040a9172939635ff5aab527 | Python | 9,544 | 175 | from brian2 import NeuronGroup, StateMonitor, ms, second, mV, run, Synapses, defaultclock, seed
import numpy as np
import pytest
from brian2lava.tests.utils import *
from brian2lava.utils.const import HARDWARE
# Uncomment the following to run tests with standard model repo.
#@pytest.mark.parametrize("config", [{"hardw... |
67a2636b21cb0d4b5defc7507999bf94d524cc074603177175ab4808a207fc81 | Python | 9,562 | 212 | """generateAnimalGEM: ortholog filtering, GPR rewriting, species network, annotation merge.
Everything here runs on small hand-built tables and models, without Human-GEM or a solver.
"""
import cobra
import pandas as pd
import pytest
import generateAnimalGEM as gen
def _write_alliance(path, rows):
header = "fr... |
dd8f4ed859783f8854b0b608fa8821f0b37dca8183570a66d8545f637a6af639 | Python | 9,562 | 259 | """This module defines the job metrics collection framework for Galaxy jobs.
The framework consists of two parts - the :class:`JobMetrics` class and
individual :class:`JobInstrumenter` plugins.
A :class:`JobMetrics` object reads any number of plugins from a configuration
source such as an XML file, a YAML file, or a ... |
2fb5874f2cd6c9c5fe7e194681390d61903d25daf41555404d742f09ffd46ee7 | Python | 9,568 | 253 | from __future__ import annotations
from collections.abc import Mapping, Sequence
from pathlib import Path
from typing import Literal
import dask.array as da
import numpy as np
import xarray as xr
from dask import delayed
from PIL import Image
from scanpy import logging as logg
from skimage.io import imread
from tifff... |
69c6f3049fc94d23bbaea0b5e88def8e068ebe1aceec17388f94650f236a1ab9 | Python | 9,568 | 276 | from __future__ import annotations
import os
import warnings
from contextlib import contextmanager, nullcontext
from importlib.util import find_spec
from pathlib import Path
from types import MappingProxyType
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
import zarr
from scipy import sparse
... |
eac713c40be65c6681717a1d7b29974bb50652c15cd2265875c2bdae4a8fef7d | Python | 9,569 | 257 | # 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... |
ac75f8c6f6f8ff820d98221e6ae3bcc753464f95d06dcb001af6cba7ce61d0d5 | Python | 9,572 | 284 | from __future__ import annotations
import argparse
import csv
from pathlib import Path
if __package__:
from .plot_distributed_inference import PLOT_RC
else:
from plot_distributed_inference import PLOT_RC
def _load(path: Path) -> list[dict[str, object]]:
with path.open(encoding="utf-8", newline="") as fi... |
33bb5ee8615be2cf9da6238b172686bc3a14e02a81e3ebcf245ae677fb6b518d | Python | 9,578 | 232 | #!/usr/bin/env python
import numpy as np
import argparse
import tensorflow as tf
import vcf
parser = argparse.ArgumentParser(
description="single cell RNAseq mixed genotype clustering using sparse mixture model clustering with tensorflow.")
parser.add_argument("-a","--alt_matrix",required=True, help="alt matrix o... |
9df099a204bcb7def11f60726b5afbed79be13f00d9f781476f530b60a357b24 | Python | 9,580 | 276 | import os
import argparse
import random
import yaml
import logging
from functools import partial
import numpy as np
import torch
import torch.nn as nn
from torch import optim as optim
from tensorboardX import SummaryWriter
from cogdl.data import Graph
from cogdl.utils.graph_utils import add_self_loops
logging.basi... |
c54f12e51b038ce0c19949a625bfdb94c85ba1624b742482e6c5461eae648fe3 | Python | 9,583 | 250 | """
This file contains the outline of an implementation to load environment modules
(http://modules.sourceforge.net/).
This is a community contributed feature and the core Galaxy team does utilize
it, hence support for it will be minimal. The Galaxy team eagerly welcomes
community contribution and maintenance however.... |
d15d3bd69d9c567def42c38aef47ad0f868c5b27fab51d05513f3c8421204eb8 | Python | 9,584 | 239 | import copy
import os
import numpy as np
import pandas as pd
from alpineer import image_utils, io_utils, load_utils, misc_utils
from skimage.measure import regionprops_table
from skimage.morphology import remove_small_objects
from skimage.segmentation import find_boundaries
import ark.settings as settings
from ark.ut... |
b5cb826419f7ccee38365b5350b4aacf118956758373d6ebad01e28fb34b90e3 | Python | 9,586 | 249 | #!/usr/bin/env python3
# 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
# "... |
e986b20bf34c3f140732702bd7a267fe510e1808c82981709a8b68891e2dd2ee | Python | 9,596 | 263 | # MIT License
#
# Copyright (c) 2019-2024 The PyQMC Developers
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, m... |
2ba691af31638d527eac5d7d07b9a4a8f8c2eecd40d4742c158ee67b22976472 | Python | 9,599 | 266 | """
Resolves package, mechanism and variant constraints into asset names that can be
requested from the Glia library.
"""
from contextlib import contextmanager
from ._fs import read_preferences, write_preferences
from .exceptions import (
AssetLookupError,
NoMatchesError,
TooManyMatchesError,
... |
a1be556406130bd2747cd4462080027499f8160bf0e0324f5f84104e218bf61b | Python | 9,602 | 247 | """Community detection and quality functions for bipartite graphs."""
import networkx as nx
from networkx.algorithms.community.community_utils import is_partition
from networkx.algorithms.community.quality import NotAPartition
from networkx.utils.decorators import not_implemented_for
__all__ = ["modularity"]
@not_i... |
1689aff40637ca0f224a79333ce3129393ee4feeb69f8785cff41b6826c89259 | Python | 9,611 | 344 | # -*- coding: utf-8 -*-
"""
Inteface to Illastik for pixel classification / object detection
This module allows to integrate ilastik into the *ClearMap* pipeline.
To use ilastik within *ClearMap* use the followng steps:
* start ilastik interface (e.g. manually or using
:func:`~ClearMap.Imageprocessing.Ilastik... |
96dd108d92e6df06b9ea776b49872e4df22ab8d19e2f3edf50b9b67b839a589d | Python | 9,613 | 299 | from typing import Optional
import torch
import triton
import triton.language as tl
from ..triton_layout import (
_block_minor,
_neuron_grid,
_neuron_indices,
_spatial_offsets,
_time_offset,
_triton_layout_args,
)
from ..triton_runtime import use_static_range_for_triton_neuron_kernel
from ..tr... |
4376e2fdcd0ba7167ed15a291d4e8bcb391bfc92ac7954f5e87e39a83b9ac7d0 | Python | 9,619 | 266 | import pytest
import networkx as nx
from networkx.utils import nodes_equal
class TestCore:
@classmethod
def setup_class(cls):
# G is the example graph in Figure 1 from Batagelj and
# Zaversnik's paper titled An O(m) Algorithm for Cores
# Decomposition of Networks, 2003,
# http... |
a469762e79e039ef6ffb75c713e98f29cb259cceade281c19023e186ffde1113 | Python | 9,620 | 283 | """Reference creation and analysis module"""
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import cmasher as cmr
from surfplot import Plot
from adaptman.utils import load_table, load_gradients, get_surfaces
from adaptman.config import Config
from adaptman.analys... |
bec6231104ec50879cbdc9656364c62de13780d7fabfc7be700982186776278a | Python | 9,624 | 257 | # 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... |
eb554c485339fb8478f60b62ce75ca92420afb22201542aa01717e2acdae9cbe | Python | 9,629 | 298 | # -*- coding: utf-8 -*-
#
# SMILE documentation build configuration file, created by
# sphinx-quickstart on Thu Feb 4 13:17:50 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.
#
# All... |
d322e364961f2f9652bdd97487220d4bb0ae602a495cddc114c88b973a8b42ad | Python | 9,631 | 354 | """
orbit.utils.geometry
"""
import numpy as np
import numba as nb
from scipy.spatial.distance import cdist
from itertools import groupby
class Sphere(object):
_PDB_FORMAT_STRING = "ATOM{:>7} C SPH{:>6}{:>12.3f}{:>8.3f}{:>8.3f} 1.00 {:.2f}\n"
def __init__(self, center, radius, cluster=0):
sel... |
65ccb00c805e67d367d7756607b3872fe2b4abb956dddf403fe4d73b747df47c | Python | 9,632 | 278 | """Functions for point patterns spatial statistics."""
from __future__ import annotations
from typing import Literal
import numpy as np
import pandas as pd
from anndata import AnnData
from scanpy import logging as logg
from scipy.spatial import ConvexHull, Delaunay
from sklearn.neighbors import KDTree, NearestNeighb... |
149af12de834b34146f7b567fe8388feda02412edb8c15b4199f93e4b3d9539b | Python | 9,636 | 241 | # MIT License
#
# Copyright (c) 2019-2024 The PyQMC Developers
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, m... |
94e0dfe40e59cf668b10f2a33a9f6a563c8e0082fe315df79150bb3ec06af3b4 | Python | 9,648 | 252 | import unittest
import numpy as np
from bsb_test import FixedPosConfigFixture, NumpyTestCase, RandomStorageFixture
from bsb import (
CellParameter,
ConnectionParameter,
Constant,
DistanceDelayParameter,
Parameter,
PointParameter,
Scaffold,
config,
constant_parameter,
parameters... |
4279e900a158c90ac5f55d64abf2a6387595f8482e96a2e0a4a735438c4e1444 | Python | 9,658 | 260 | """Playwright element wrapper that implements WebElementProtocol.
This module provides PlaywrightElement, a wrapper around Playwright's ElementHandle
that implements the WebElementProtocol interface, making it compatible with code
written for Selenium's WebElement.
"""
from typing import (
Optional,
TYPE_CHEC... |
9799f1d22dc9e66d03380857720ec8663f15694183e50f91500ab01afc5ce1ec | Python | 9,660 | 195 | # -*- coding: utf-8 -*-
"""
Lay out the published-studies concept word cloud inside a coronal mouse-brain section.
The section has five areas -- cortex, hippocampus, thalamus, hypothalamus, amygdala. Each word is placed
entirely inside one area and is colored by it, so the layout traces the anatomy. Brain-region terms... |
498ad2c7fcb23741a3777abf0c5017c6c87a0f9c827dcb9b9ac443e39677011f | Python | 9,661 | 259 | import argparse
import os
import numpy as np
import math
import itertools
import datetime
import time
import sys
import torchvision.transforms as transforms
from torchvision.utils import save_image
from torch.utils.data import DataLoader
from torchvision import datasets
from torch.autograd import Variable
from model... |
54ffed39ce9a5e3f150d5abcd1cd1004a7455cfa89b58409353164a37b980bf3 | Python | 9,663 | 207 | import math
import torch
from torch import nn
__all__ = ["GaussianTuning"]
class GaussianTuning(nn.Module):
def __init__(
self,
n: int,
m: int,
x_min: torch.Tensor,
x_max: torch.Tensor,
) -> None:
r"""
**API Language** - :ref:`中文 <timing-GaussianTuning... |
41620efc3eca44da184d80a60530459c22e152f8927d43bde67abce09fe85ed2 | Python | 9,669 | 242 | """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."""
from core.label_config import replace_task_data_undefined_with_config_field
from core.utils.common import load_func
from data_export.models import ... |
e89f54737de207a9897a9d74affa7bbe5af3ca12f6ace8875e8ca237bcbbce4a | Python | 9,669 | 255 | """This module contains linting functions for general aspects of the tool."""
import re
from typing import (
Tuple,
TYPE_CHECKING,
)
from packaging.version import Version
from galaxy.tool_util.biotools.source import ApiBiotoolsMetadataSource
from galaxy.tool_util.edam_util import load_edam_tree
from galaxy.t... |
299a19342ea13b840c709195f0f75a8cacd440753d2b9cb3be4ffbacf9d60b83 | Python | 9,671 | 232 | import os.path as osp
import pickle as pkl
import sys
import pandas as pd
import numpy as np
import torch
from cogdl.data import Dataset, Graph
from cogdl.utils import remove_self_loops, download_url, untar, coalesce, MAE, CrossEntropyLoss
import os
import scipy.sparse as sp
from sklearn.preprocessing import StandardSc... |
57b029ae4b10b634d90b5e8777c48f3c92dca169297b7828682411d9b9b9f4f5 | Python | 9,672 | 288 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 5 11:24:49 2020
@author: amelie
"""
from brian2 import *
from scipy import signal
from cells.RS_FEF import *
from cells.FS_FEF import *
from cells.SI_FEF import *
from cells.VIP_FEF import *
from FEF_visuomotor_tests import *
from FEF_contrast_d... |
9d16abe52c154971d904a99da8f11e45509540683a504284d195ef75d637bde1 | Python | 9,672 | 233 | import os.path as osp
import pickle as pkl
import sys
import pandas as pd
import numpy as np
import torch
from cogdl.data import Dataset, Graph
from cogdl.utils import remove_self_loops, download_url, untar, coalesce, MAE, CrossEntropyLoss
import os
import scipy.sparse as sp
from sklearn.preprocessing import StandardSc... |
b7479c79708cfab72410c065f21ed2e334cce0792c07a3545cdc60ba0d8bdc75 | Python | 9,674 | 316 | """
*****
Pajek
*****
Read graphs in Pajek format.
This implementation handles directed and undirected graphs including
those with self loops and parallel edges.
Format
------
See http://vlado.fmf.uni-lj.si/pub/networks/pajek/doc/draweps.htm
for format information.
"""
import warnings
import networkx as nx
from ne... |
e1f1c3730e8c558712c88936cf14917f0f08a6908ab51de397a84da3116330eb | Python | 9,675 | 241 | import re
from enum import Enum
from logging import getLogger
from typing import (
List,
Optional,
Tuple,
TYPE_CHECKING,
Union,
)
from typing_extensions import (
Literal,
NotRequired,
TypedDict,
)
from galaxy.tool_util.parser.stdio import StdioErrorLevel
if TYPE_CHECKING:
from gal... |
e66390ad54033d4a1a2801de02d4d73a84f551b396007e56e21b24cd40de7d2d | Python | 9,677 | 330 | import operator
from typing import AbstractSet, Tuple
from unittest.mock import Mock
import pytest
from nl_core.datalog import Fact
from nl_core.datalog.expression_processing import extract_logic_atoms
from nl_core.datalog.expressions import AdornedSymbol
from nl_expr.exceptions import ForbiddenExpressionError
from n... |
d43f62481800cd6bdd13740b14190283b15a8a19a21e7dc59a2bf4a13d65efad | Python | 9,681 | 299 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.datasets
from spikingjelly.activation_based import neuron, surrogate, layer, functional
from torch.cuda import amp
import os
import argparse
from torch.utils.tensorboard import SummaryWriter
import time
import datetime
import sys
cl... |
ebd4408b81b47c790bbcce3f2b5119f9d8a16f8a110fa79e87255e9701511186 | Python | 9,684 | 224 | """ Use a trained GAN model to synthesize new images """
# import libraries
import os
import json
import numpy as np
from numpy.lib.npyio import save
import pandas as pd
import torch
from PIL import Image
from concurrent.futures import ThreadPoolExecutor
from utils.data_utils import get_noise, get_one_hot_labels, comb... |
33aca3b35de071fedc386fbd439dad55ffc6b29a503f07864a5771f436129383 | Python | 9,692 | 197 | import copy
import logging
import time
try:
from rucio.client.uploadclient import UploadClient
from rucio.common.exception import (
InputValidationError,
NoFilesUploaded,
NotAllFilesUploaded,
RSEWriteBlocked,
)
from rucio.common.utils import generate_uuid
from rucio.... |
fedf19ef99c2e194ca425d148be47e1603a67dcbb320bf4b5ebfadc31a3cba62 | Python | 9,704 | 237 | # import essential libraries
import os
import sys
sys.path.append("..")
import torch
import json
from torch import nn
from torchvision import transforms
from utils.data_utils import ImageDataset
import torch.nn.functional as F
from torch.utils.data import DataLoader
from tqdm import tqdm
from utils.utils import set_... |
7be8be43bd1e2513de08dceb1f5391cb652b66429b53b6127a911ab7893a8567 | Python | 9,706 | 251 | #!/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 logging import Logger
from typing import TYPE_CHECKING
impor... |
41638b3c84a6548a463da3f4aaa5e005e92427ce27cd0570859a4690f41c7ea5 | Python | 9,707 | 274 | from itertools import chain
import networkx as nx
from networkx.utils import not_implemented_for, pairwise
__all__ = ["metric_closure", "steiner_tree"]
@not_implemented_for("directed")
@nx._dispatchable(edge_attrs="weight", returns_graph=True)
def metric_closure(G, weight="weight"):
"""Return the metric closure... |
52072f798f0c225fa91c2a49428d59fddfc94cbfe235b0e3fb5ac3765c5c5960 | Python | 9,707 | 299 | import numpy as np
from ... import proc
from ... import seg_utils
from ... import io
from .. import overlap
from . import toolbox as tb
def auto_eval(train_set, val_set, test_set=None,
asynet=None, patchsz=(160, 160, 18), dist_thr=1000,
voxel_res=[4, 4, 40], merge_ccs=True,
... |
e94e8dba58dab41163b8b58c78ce944a461b44d4b18b0d82d5dc3e4a780e5ad7 | Python | 9,707 | 279 | import warnings
from argparse import ArgumentParser
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.cm
from matplotlib.axes import Axes
from matplotlib.figure import Figure
from typing import List
from data import Data, labels, re_path
from results import *
mpl.rcParams["font.sans-serif"] =... |
19dfa95e05215e52e109af621fb8e7e66c3caf47b204e5828e8c23f07b486904 | Python | 9,713 | 301 | """Tests for the transcript of the interactive REPL."""
import io
import re
import pytest
pytest.importorskip("prompt_toolkit")
pytest.importorskip("rich")
from rich.console import Console # noqa: E402
from neurolang.frontend import NeurolangPDL # noqa: E402
from neurolang_apps.utils.tui import ( # noqa: E402
... |
4c5ac56b92087d6e5361d6b1c920ee9ce07b7ad02caf076f64762586c1bc7e03 | Python | 9,717 | 217 | import pathlib
import shutil
import warnings
from typing import Union
import datasets
from alpineer.misc_utils import verify_in_list
from ark.settings import EXAMPLE_DATASET_REVISION
class ExampleDataset:
def __init__(self, dataset: str, overwrite_existing: bool = True, cache_dir: str = None,
r... |
636cf88239d4770eecf35a5f8e4609e4e1fb55b2a6b30c85b2122b9958e0466a | Python | 9,717 | 301 | import numpy as np
import scipy.ndimage
import scipy.optimize
from .centers import find_centers_cpp
def detection_scores(
truth,
test,
label_ids=None,
matching_score='overlap',
matching_threshold=0,
voxel_size=None,
return_matches=False):
'''Compute common d... |
bff5bd653deee124cdbd3e1823dcd89f56763c3321a9f878bdf86d3b88256880 | Python | 9,718 | 324 | """Operations on many graphs."""
from itertools import chain, repeat
import networkx as nx
__all__ = ["union_all", "compose_all", "disjoint_union_all", "intersection_all"]
@nx._dispatchable(graphs="[graphs]", preserve_all_attrs=True, returns_graph=True)
def union_all(graphs, rename=()):
"""Returns the union of... |
5630068502af9ae377b54a65c1a9871953107d9a0179f188ec6b6f9500cb5b68 | Python | 9,719 | 318 | from __future__ import absolute_import
import contextlib
import errno
import logging
import logging.handlers
import os
import sys
from pip._vendor.six import PY2
from pip._internal.utils.compat import WINDOWS
from pip._internal.utils.misc import ensure_dir
try:
import threading
except ImportError:
import du... |
7845e75ef27b73ac6e375aa104bd45abc037a659eb49308424d34bd5f2fd6b27 | Python | 9,721 | 268 | from __future__ import annotations
import argparse
import json
import os
from pathlib import Path
import sys
import torch
from torch.utils.data import Dataset, Subset
from spikingjelly.activation_based.distributed import vision
from spikingjelly.activation_based.model.sew_resnet import SEWResNet34Config
from spiking... |
8910bc1ef5ae99a62c46a237fe44462604ccdbe6c7df2c44303b21e9e2601cf2 | Python | 9,722 | 230 | """Class implementing meta-model for a Dense Layer."""
from collections import ChainMap
from typing import Dict, List
import numpy as np
from tensorflow.keras import regularizers
from .meta_layer import MetaLayer
from .dropout_meta_layer import DropoutMetaLayer
from ..utils import distributions
class RegularizedMet... |
135c0713a0017cbd8ee5920057555339fa3cb5e5a34d642a65a2a493a0c4c31e | Python | 9,723 | 270 | """
Threshold Graphs
================
"""
import pytest
import networkx as nx
import networkx.algorithms.threshold as nxt
cnlti = nx.convert_node_labels_to_integers
def test_threshold_graph_invalid_creation_sequence():
bad_creation_sequence = [2.0, 2, 1, 0] # floats are not allowed
with pytest.raises(Valu... |
576510bf54d267d2a91d1565a8067c2fd14810c4a9fca46399dfb75e363f752c | Python | 9,723 | 253 | import os
from typing import (
Callable,
Dict,
Iterator,
List,
Optional,
Tuple,
Union,
)
from pydantic import (
BaseModel,
ConfigDict,
model_validator,
)
from galaxy.util import (
asbool,
Element,
)
DEFAULT_VALUE_TRANSLATION_TYPE = "template"
VALUE_TRANSLATION_FUNCTION... |
687c7dc3c7f64f6c1409f99b1d26fec8d9b188c8f8dac63b5317d26de733638c | Python | 9,724 | 230 | ## make a plot of a single patient, lesional hemisphere
import os
import json
from meld_classifier.network_tools import build_model
from meld_classifier.experiment import get_subject_ids
from meld_classifier.meld_plotting import trim,rotate90
import meld_classifier.hdf5_io as io
from meld_classifier.paths import MELD_P... |
31750dcfa6492aa469697e6409cc39b0083c841c8981aa032df25ddc3ab179d7 | Python | 9,725 | 272 | # This work originally developed by Stavros Sachtouris <saxtouri@grnet.gr>
# as part of the effort committed GRNET S.A. (Greek Research and Technology
# Network) in the context of the OpenMinTeD project (openminted.eu)
import logging
import os
try:
from kamaki.clients import (
astakos,
Client as K... |
0076ee7539c950032830031e318c9ae1349177533ac71a233172a8e3ff2f3c79 | Python | 9,732 | 268 | """
Configuration of the LLM query assistant.
The providers and the settings of the assistant are read from a YAML
file (see ``llm.example.yaml``, next to this module). It is looked up,
in order, at the path given explicitly (``--llm-config``), at the path
of the ``NEUROLANG_LLM_CONFIG`` environment variable, at
``~/.... |
1da218b5330d2087f513440b26d83499bd2774dd61258e438a9086a59408ec66 | Python | 9,743 | 255 | """
SPECTER2's query encoder in numpy, for where torch is not: a browser.
SPECTER2 embeds a query as the state of the [CLS] token in the last layer
of BERT (SciBERT) with its ad-hoc query adapter, a sequential bottleneck
adapter after the feed-forward block of each layer (``seq_bn`` of the
``adapters`` library). This ... |
4a340274ca5de5d1eb434e4f0125eee8b88fb92e4ec203d41eb52f2dc4d73d39 | Python | 9,747 | 258 | import abc
import os
import sys
import typing
import uuid
from contextlib import ExitStack
from time import time
from tqdm import tqdm
from bsb import AttributeMissingError, SimulationResult, options
from ..services.mpi import MPIService
if typing.TYPE_CHECKING: # pragma: nocover
from ..storage import Placemen... |
89c036274ba0ccc3e4e273613dee77e361206a8479e3eb8eb9cd454bcabcb81c | Python | 9,749 | 349 | # Author: David Burns
# License: BSD
import numpy as np
import pandas as pd
import pytest
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import Ridge
from sklearn.model_selection import cross_validate
from sklearn.preprocessing import StandardScaler
from seglearn.base import TS_Data
fro... |
0e351b62c09fca5a9c7550eb4e361fe1b2b1c098838223c91c12c70ea98261f9 | Python | 9,753 | 346 | # -*- coding: utf-8 -*-
"""
Interface to read/write image stacks saved as a list of files
The filename is given as regular expression as described
`here <https://docs.python.org/2/library/re.html>`_.
It is assumd that there is a single digit like regular expression in the file
name, i.e. ``\\d{4}`` indicates a place... |
ee51cdae02f9607d9c2358fec999f357f27c8c195155d98585068dc8cd7fd9bf | Python | 9,757 | 242 | from __future__ import absolute_import
# The default socket timeout, used by httplib to indicate that no timeout was
# specified by the user
from socket import _GLOBAL_DEFAULT_TIMEOUT
import time
from ..exceptions import TimeoutStateError
# A sentinel value to indicate that no timeout was specified by the user in
# u... |
f1ca4056e4063139d49a4db45fd0dc39872acf87e1d60ecd583d4acf9d820400 | Python | 9,759 | 265 | """
History data access helpers for the page assistant agent.
Thin string-formatting wrappers over Galaxy managers (HistoryManager,
HistoryContentsManager, HDAManager, DatasetCollectionManager). The
manager layer owns pagination, visibility/deleted filtering, and the
implicit-conversion HID-uniqueness handling so this... |
fba16d7c1fa42ff55176f93092812bfedb7dcb4c3ea5e1e094c5263e7ca5d1e8 | Python | 9,761 | 317 | import numpy as np
import matplotlib.pyplot as plt
import theory_curve
import scipy as sp
import math
import scipy.special
import matplotlib as mpl
from cycler import cycler
from tqdm import tqdm
myaxis_font = 8
myfont = 6
mpl.rcParams['axes.prop_cycle'] = cycler(color='bgrcmyk')
plt.rcParams.update({'font.size': myf... |
0552cf2d1ff9c93b1721e065754a2181d5ffcf7f14a0432403b2b5692941693d | Python | 9,762 | 221 | """
Performs image operations needed for segmentation model.
"""
import numpy as np
import cv2 as cv
import tifffile as tf
import math
# Morphological operations on image nparrays
def Z_unravel(img):
"""Unravels 3rd or 4th dimension of a given nparray and returns a list"""
# Input - array, shape = xyz o... |
ed4e25b867554c44fb4d14dcd14ce4cd94db811f601ded50b4bb48cded1e983a | Python | 9,763 | 274 | from nl_expr.expression_walker import (
ReplaceExpressionWalker,
ReplaceSymbolWalker,
add_match,
)
from nl_expr.expressions import Symbol
from nl_expr.logic import Constant, Implication, NaryLogicOperator, Negation
from nl_expr.logic.expression_processing import ExtractFreeVariablesWalker
from nl_expr.logic... |
b88b7492244e59a5250aacbead0b0838c3bcc86d25503187b3e73567558d48ce | Python | 9,773 | 299 | import pytest
import torch
import torch.nn.functional as F
from spikingjelly.activation_based import functional, surrogate
from spikingjelly._ops.if_linear import if_linear
from spikingjelly._ops.lif_linear import lif_linear
pytestmark = pytest.mark.skipif(
not torch.cuda.is_available(),
reason="requires CUD... |
eb27738d219d65ca62724c3f323dec74827859fc3a9ee20399a1fb30ee0e7194 | Python | 9,774 | 280 | import sys
from collections.abc import Sequence
from typing import Any, ClassVar
from pydantic import (BaseModel, ConfigDict, PrivateAttr, field_validator,
model_serializer, model_validator)
class TrainingConfig(BaseModel):
"""Training parameters."""
model_config = ConfigDict(extra="fo... |
419c9659fb681196684130437eabcf3d426e135b05d4fe128fcedf5855a6fa4d | Python | 9,777 | 283 | """
Database Initialization Functions
NOTE: I use the database as a glorified file store with transactions,
so the schema isn't normalized at all.
The current reasons for this approach are:
(1) Matching the file IO interface as easily as possible (i.e. I'm lazy)
(2) Putting as little pressure on the database as possi... |
b5b91c562d02ff00bb34144cd204cf735d0aa4fd7a90a354beb62fcbbcf925c2 | Python | 9,778 | 281 | import json
import sys
import httpx
import pytest
from ..config import ProviderConfig
from ..providers import (
LLMError,
ToolCall,
make_client,
render_conversation,
)
TOOLS = [{
"name": "check_query", "description": "Check a query.",
"parameters": {
"type": "object", "properties": {"... |
7db8243fbdad44c8eba1edac94452c4a50b8fc38de0ff68f2962481eacdc3cfa | Python | 9,781 | 247 | # 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
# This should not include any torch dependencies!
from typing import Union
from ax.core.auxiliary_source import AuxiliarySo... |
3bfe16668d9de3bbb0a221ea863779a83d3b2d961348b29e70fea011df584fac | Python | 9,784 | 223 | import importlib
import torch
import inspect
from cogdl.data.dataset import Dataset
from .customized_data import NodeDataset, GraphDataset, generate_random_graph
def register_dataset(name):
"""
New dataset types can be added to cogdl with the :func:`register_dataset`
function decorator.
For example:... |
3f007474ed5ddedb35e8a2ce2bb604eea460088ed7a0f7b0444001d23a6b6cd5 | Python | 9,789 | 220 | import logging
import math
import random
from time import time
from typing import Callable, List, Optional, Type
import numpy as np
from rlmolecule.mcts.mcts_problem import MCTSProblem
from rlmolecule.mcts.mcts_vertex import MCTSVertex
from rlmolecule.tree_search.dfs import dfs
from rlmolecule.tree_search.graph_searc... |
9bda832189d1e4d8e40428b84a0fe576b7345765a2e30d07d877545f0f4dcae7 | Python | 9,789 | 271 | """Generic Atlas files tools"""
from typing import Dict, Union
import numpy as np
import scipy.ndimage
import scipy.signal
from atlas_commons.typing import AnnotationT, BoolArray, NDArray, NumericArray
from voxcell import RegionMap # type: ignore
from atlas_densities.exceptions import AtlasDensitiesError
def load... |
af7a78e129f7c2a2e2acaa8d53f1a1193910cb4ca2cfa9af8abea0148c1f3b1b | Python | 9,791 | 346 | # -*- coding: utf-8 -*-
"""
Interface to read/write image stacks saved as a list of files
The filename is given as regular expression as described
`here <https://docs.python.org/2/library/re.html>`_.
It is assumd that there is a single digit like regular expression in the file
name, i.e. ``\\d{4}`` indicates a place... |
2f5799564e07464e9373276b0e1fb346588c040cfd90625aeb423518fb60295c | Python | 9,793 | 346 | """
3D Vector class.
Modified from the vec3d class on the pygame wiki site.
http://pygame.org/wiki/3DVectorClass
Kisuk Lee <kisuklee@mit.edu>, 2015-2016
Nicholas Turner <nturner@cs.princeton.edu>, 2018
"""
import math
import operator
class Vec3d(object):
"""
3d vector class, supports vector and scalar opera... |
a84c9761f4dcd30c4f2579a65aefed04551713e70076ae1e41153cc9393ce2f0 | Python | 9,793 | 228 | import argparse
from .constants import SEPERATOR
# parse_train_args
def parse_train_args():
"""
----------
Author: Damon Gwinn
----------
Argparse arguments for training a model
----------
"""
parser = argparse.ArgumentParser()
parser.add_argument("-input_dir", type=str, default=... |
aae958458f5fd208bea11a0624371aa341bd946815c870eb8e0e910e93ce80ae | Python | 9,805 | 227 | from unittest.mock import patch
from django.test import TestCase, override_settings
from django.urls import reverse
from django.utils import timezone
from django.utils.http import urlencode
from organizations.models import OrganizationMember
from projects.api import ProjectListAPI
from projects.models import ProjectMa... |
bffa2e25f14df9e0147a1bcc9122c2890040c0cbd4b26ac077035fd9b0d4c418 | Python | 9,810 | 235 | # 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... |
ac3fa6ecb550a6aace4c2509ae58b8de56297b36316a37e470d777c6f1a14e3f | Python | 9,811 | 299 | import pytest
import networkx as nx
class TestImmediateDominators:
@pytest.mark.parametrize("G", [nx.Graph(), nx.MultiGraph()])
def test_raises_undirected(self, G):
"""Check that `immediate_dominators` raises for undirected graphs."""
with pytest.raises(
nx.NetworkXNotImplemented,... |
3b17210ad143546ed40e4320620dba8324ed2d60980124dba6408cc54fac0dd2 | Python | 9,821 | 219 | # -*- coding: utf-8 -*-
from figureflow import figure
import seaborn as sb
import numpy as np
import os
import importlib
importlib.reload(figure)
Figure = figure.Figure
input_folder = os.path.dirname(os.path.abspath(__file__))
figure = Figure(input_folder,number="S14",dpi=600,width=4.75)
figure.cr... |
a9aa095dc768e57693a5ed9dc296e5400f0c5cc8f0a2cbcf0ed07ea92b180321 | Python | 9,821 | 296 | """Inspect the raw data.
In this script we go through each participant and prepare the data for preprocessing
with ICA. We will mainly prepare the BrainVision data to be in an MNE-Python accessible
format and screen it for bad channels and segments.
We can also run this in non-interactive mode, by setting `interactiv... |
9ec33dc43c2ee4a652fb29e67b91672b4247d8f9c45cf2bc0bc38190b2775de7 | Python | 9,823 | 321 | # -*- coding: utf-8 -*-
"""Docking_MC_Parallel.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/13sohHmkOWAWa5QIEAjIESIqJ8IZkOcHi
"""
import os
import sys
if len(sys.argv) != 8:
print('Wrong input parameters\n\n')
print(len(... |
3a5493d7008692f51f8625fc9a4f6e3e5c3092ec08455ff40f7aaa108f7dd5dc | Python | 9,831 | 221 | import tensorflow as tf
import numpy as np
import os
import learnMSA.legacy.Initializers as initializers
import learnMSA.legacy.Priors as priors
from learnMSA.util.sequence_dataset import SequenceDataset
from learnMSA.legacy.Utility import get_num_states, deserialize
# from learnMSA.protein_language_models.BilinearSymm... |
6d1ea92583a3f5dcebbbb72304bcc3dd9d3557ab387e5943681d4195dd9e800e | Python | 9,833 | 295 | import atexit
import shutil
import tempfile
from multiprocessing import Pool as ProcessPool
from multiprocessing import cpu_count
from multiprocessing.pool import ThreadPool
from tempfile import mkdtemp
import numpy as np
from numpy.testing import assert_array_equal
from zarr.attrs import Attributes
from zarr.core im... |
15538a672f1c0b6acd49d04b7dad1eddc11bfb604800f18d2cf397637daa17e8 | Python | 9,835 | 271 | # 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... |
9e53e979dd57912293c886d38ce54ccfb483a00a1ebb9287f87a587ec7f30d5c | Python | 9,837 | 282 | """PCA is performed on the DNN feature maps to reduce their dimensionality.
PCA is applied on either the feature maps of single DNN layers, or on the
appended feature maps of all layers.
Before applying PCA on the CORnet-S feature maps, run
'sort_feature_maps_cornet_s.py'.
Parameters
----------
dnn : str
Used DNN amo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.