sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
24f575c863e2787148d2417996437232ef50484f3b913b21c16848ec405fb767 | Python | 8,862 | 203 | from brian2 import NeuronGroup, StateMonitor, SpikeMonitor, ms, second, mV, run, get_device, Synapses, defaultclock, BrianLogger
import numpy as np
from numpy.testing import assert_array_equal, assert_allclose
from brian2lava.tests.utils import *
from brian2lava.utils.const import HARDWARE
# Uncomment the following to... |
588fc7ce92351c553fe5f1e0e0268e54c46454ea9a79e4c709fd9bb6ffb8f98e | Python | 8,863 | 206 | import fnmatch
import logging
import re
import types
from azure.storage.blob import BlobServiceClient
from core.utils.params import get_env
from django.conf import settings
from io_storages.utils import parse_range
logger = logging.getLogger(__name__)
AZURE_ACCOUNT_URL_TEMPLATE = 'https://{account_name}.blob.core.wi... |
409f3c43b68556301def0ea98db8368c6cc8363cf0ad79b5e0531a04ca2b93fc | Python | 8,867 | 314 | 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_surrogate import _surrogate_gradient
from .autograd import _check,... |
6ffefd64a896d175f6e3e19869e409f596aaed9158413d037034e4002208dc46 | Python | 8,868 | 274 | import itertools
import networkx as nx
from networkx.algorithms.approximation import (
treewidth_min_degree,
treewidth_min_fill_in,
)
from networkx.algorithms.approximation.treewidth import (
MinDegreeHeuristic,
min_fill_in_heuristic,
)
def is_tree_decomp(graph, decomp):
"""Check if the given tre... |
3ae72f42a99c758acc877871cc7d75c69bbe0cc10f2d93ef2eb7c54d9e60b155 | Python | 8,869 | 251 | import pyscf.gto
import numpy as np
from pyqmc.pbc.pbc import enforce_pbc
import pyqmc.wf.numba.gto as gto
import pyqmc.wf.numba.pbcgto as pbcgto
def _gradient(fval, fgrad, mol=None, delta=1e-5):
rvec = np.random.randn(500, 3) * 3
grad = fgrad(rvec)
val0 = fval(rvec)
assert np.amax(np.abs(grad[0] - val... |
0b6ae2c1e295f1791e1e64dd09e38110decd325b4fe9cf0e406c1d960a276bde | Python | 8,871 | 219 | #!/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 copy import deepcopy
from unittest import mock
import pandas as pd
from ax.adapter.base import D... |
dcd7836bb11ca584dfa5630cf5d52d8611451e77345ca815f3e126491ca98284 | Python | 8,873 | 260 | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 26 15:20:33 2021
@author: Estefany Suarez
"""
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import os
import itertools as itr
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib.pyplot as plt... |
ee44c7e8ce85cbe14e413b2bd924e0582e9c308da5dec0d29400be215749f815 | Python | 8,874 | 285 | """
Testing
=======
General guidelines for writing good tests:
- doctests always assume ``import networkx as nx`` so don't add that
- prefer pytest fixtures over classes with setup methods.
- use the ``@pytest.mark.parametrize`` decorator
- use ``pytest.importorskip`` for numpy, scipy, pandas, and matplotlib b/c of ... |
36066429b31662a4d66634ee9f0e1008e8b450ab8df9dd117b391bc037fdc9b6 | Python | 8,876 | 280 | import numpy as np
import torch
from torch.utils.data import DataLoader
from cogdl.data import Graph
class DataWrapper(object):
@staticmethod
def add_args(parser):
pass
def __init__(self, dataset=None):
if dataset is not None:
if hasattr(dataset, "get_loss_fn"):
... |
ffc9c7cae58fd2f18958bb156e10b969525ad027d74023b5ef9397ee166e3103 | Python | 8,877 | 215 | # % Statistical test for kernel conditional independence of X and Y given Z with
# % incomplete Cholesky factorization for low rank approximation of Gram matrices
# %
# % Arguments:
# % X n x p vector of data points
# % Y n x m vector of data points
# % Z n x r vector of data points
# % alph... |
fce44bf21f15ecbfd99ba46728d907b1ef162aef11831426f1770b593140c216 | Python | 8,881 | 203 | import torch
from torch import Tensor
import torch.nn as nn
from torch.nn import Linear
from lossFunctions import LossTargets
from activationFunctions import Tanh_shifted_and_scaled
from layers import SparseLinear, FullLinear
import numpy as np
from time import time as tm
class SRNN(nn.Module):
def __init__(self,... |
087dc138a5a6b9a2c61fcb37e3827ed748112ff2ae2027cfd9c6a53efe592f66 | Python | 8,882 | 225 | """Various helpers for plotting."""
import numpy as np
import pylab as pl
def truncate_colormap(cmap, minval=0.0, maxval=1.0, n=100):
"""Crop a piece from a cmap."""
# From https://stackoverflow.com/a/18926541
new_cmap = pl.matplotlib.colors.LinearSegmentedColormap.from_list(
'trunc({n},{a:.2f},{b... |
aa7e7171ef072ac5acb1613e9a6381ab0495da5eea09b6bd3a2b837a4c60e16e | Python | 8,884 | 255 | """
Edmonds-Karp algorithm for maximum flow problems.
"""
import networkx as nx
from networkx.algorithms.flow.utils import build_residual_network
__all__ = ["edmonds_karp"]
def edmonds_karp_core(R, s, t, cutoff):
"""Implementation of the Edmonds-Karp algorithm."""
R_nodes = R.nodes
R_pred = R.pred
R... |
44056c5644614b4f1fe218fe7c235188f6891ff366105f94414ad12b649ec81c | Python | 8,887 | 224 | """
Generate a connectivity matrix between barcodes with some minimum number of fragments,
connecting barcodes when two fragments from the barcodes are directly adjacent,
indicative of a shared cut site.
Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
"""
from __future__ import absolute_import, division, pr... |
2dd790abea9406ec396dc29353404a87df48a8c0c7b92147a73343d9d30c859a | Python | 8,892 | 211 | # -*- coding: utf-8 -*-
import pandas as pd
import os
import re
import copy
import numpy as np
import time
def goDeeper(props,this_path,a,max_a,conditions,folders):
a += 1
for newFolder in os.listdir(this_path):
print(newFolder)
if conditions[a-1] != "":
if newFold... |
e2120b9726ee9f3717c57268f049aceeb8cf5f6729a5317958c548ae55c2948c | Python | 8,892 | 278 | # Jordi Torrents
# Test for k-cutsets
import itertools
import pytest
import networkx as nx
from networkx.algorithms import flow
from networkx.algorithms.connectivity.kcutsets import _is_separating_set
MAX_CUTSETS_TO_TEST = 100
flow_funcs = [
flow.boykov_kolmogorov,
flow.dinitz,
flow.edmonds_karp,
fl... |
e36e2b169a641df80d0aa5e8ff65ab08adb8c1d61d91218f87eb0411936f7d01 | Python | 8,894 | 258 | # 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 re
from collections.abc import Sequence
import pandas as pd
from ax.analysis.plotly.color_constants impor... |
78a92ca4cb6b8e3301c2bc9682714ca0e835630cb586a9789271ad968110e9a9 | Python | 8,895 | 244 | import unittest
import _shared
from patch import p
from patch.exceptions import BroadcastError, ParallelConnectError
@unittest.skipIf(
p.parallel.nhost() != 1, "Single host tests should run only on 1 MPI node."
)
class TestSingleHostParallel(_shared.NeuronTestCase):
"""
Test parallel networ... |
1e524c2d62893796ece6aeb58b7c73130600ff201a8b2983cb77e6326025e8cf | Python | 8,899 | 212 | import argparse
import hashlib
import inspect
import json
import time
from pathlib import Path
import torch
import torch.nn.functional as F
from torch import nn
from torch.nn.utils import parametrize
from torch.utils.data import DataLoader, random_split
from torchvision import datasets, transforms
from .. import func... |
a9e02aec97be1d1c05866fc78cdf240edd13fdc175d3378f0219217bfcddac9a | Python | 8,899 | 227 | """
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 martian
import os
import numpy as np
import h5py
import pickle
import pandas as pd
from plots.plotly_tools import PL... |
db2f49241c6f7f3fd3944babbf6bb529480d74637890bf191fcd7109778bf701 | Python | 8,911 | 308 | """Node assortativity coefficients and correlation measures."""
import networkx as nx
from networkx.algorithms.assortativity.mixing import (
attribute_mixing_matrix,
degree_mixing_matrix,
)
from networkx.algorithms.assortativity.pairs import node_degree_xy
__all__ = [
"degree_pearson_correlation_coefficie... |
22add933aba78c7bf66f21e7519606776d98b8102f093ab9e6891d76f481655d | Python | 8,913 | 265 | """This module contains storage classes related to Azure Blob Storage (ABS)"""
import warnings
from numcodecs.compat import ensure_bytes
from zarr.util import normalize_storage_path
from zarr._storage.store import _get_metadata_suffix, data_root, meta_root, Store, StoreV3
__doctest_requires__ = {
('ABSStore', 'AB... |
1465d93260c26f69cba3083dbb74964f41e899f1130697557254a82ce2c44981 | Python | 8,914 | 252 | import torch
import torch.nn as nn
import torch.nn.functional as F
from .utils import init
class Flatten(nn.Module):
def forward(self, x):
return x.view(x.size(0), -1)
class CheckSize(nn.Module):
def forward(self, x):
print("final size is",x.size())
return x
class Conv2dSame(torch.nn... |
7e4ad0c037b2720e8caa76800393ccfe972f9cf04eb744c5e1fe595101af7e2b | Python | 8,919 | 229 | #!/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 ax.utils.common.string_utils import sanitize_name, unsanitize_name
from ax.utils.common.testutils... |
c7cce19aca0e881116a4ab5d8011f19532cd0254cebc622346088b3099e40359 | Python | 8,928 | 241 | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 22 10:46:47 2019
@author: Amelie Aussel
"""
from brian2 import *
defaultclock.dt = 0.01*ms
eq_HTC_buffer_mdPul='''
dV/dt=(-INa-IK-IL-IKL-IH-ITLT-ITHT-IAHP-IGJ-Iapp-Iapp2-J-Isyn)/Cm_HTC : volt
J : amp * meter ** -2
Iapp = randn() * gapp : amp * mete... |
e260695997f9ca19e1e1c1c2632f8225a2ce35e11622e11cdced008eac65851d | Python | 8,929 | 264 | # 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,... |
7f3f4e68987d8cb3cd971ca91e7967c556dfaceee1989ce0c8c0b438771352a9 | Python | 8,932 | 268 | import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from cogdl.layers import GATLayer, SELayer, GCNLayer, GCNIILayer
from cogdl.models import BaseModel
from cogdl.utils import spmm
def gcn_model(in_feats, hidden_size, num_layers, out_feats, dropout, residual, norm, activ... |
bca10e3f89a6a93cc0b9e0bbdeecab2fff88714ac5808210ba1cc3a4cebb8820 | Python | 8,933 | 206 | """Functions to compute inhibitory neuron density."""
from typing import TYPE_CHECKING, Dict, Optional, Tuple, Union
import numpy as np
from atlas_commons.typing import AnnotationT, BoolArray, FloatArray
from atlas_densities.densities import utils
from atlas_densities.exceptions import AtlasDensitiesError
if TYPE_C... |
d2912760dcc6ed9f3acd6ab215ed0e2fc1d39503bd3f08c3001cbfca90b7d3f0 | Python | 8,937 | 239 | """Shortest paths and path lengths using the A* ("A star") algorithm."""
from heapq import heappop, heappush
from itertools import count
import networkx as nx
from networkx.algorithms.shortest_paths.weighted import _weight_function
__all__ = ["astar_path", "astar_path_length"]
@nx._dispatchable(edge_attrs="weight"... |
3a97aa69e76a8e130546b417075f7d735edd860308fca22f08a1c7d1cbb32105 | Python | 8,938 | 218 | """
Galaxy FilesSource implementation for RSpace.
This module implements a FilesSource that interacts with an RSpace [1] instance. RSpace is an electronic lab notebook
(ELN) designed for documenting, managing and sharing scientific data. The central concepts in RSpace are the Workspace,
the Inventory and the Gallery.
... |
3260e9c0c4e2b44a9cd5844d683d1aa1272f01531c42bbfc929dd9d669e20b0a | Python | 8,946 | 279 | from cv2 import mean
import numpy as np
from scipy.optimize import minimize
from registration import transform, alignTo, align, contour_to_label
from representations import contour_cv2_mask_uniform
import matplotlib.pyplot as plt
def ssd(lambdas, y, meanshape, eigvecs):
"""
Sum of squared error function for op... |
7d9fea32a7a6e34bfd6dc5963a594a5831189e9e0f2b30b8759d2f9c9c9ae16a | Python | 8,952 | 221 | """The module describes the ``cgroup`` job metrics plugin."""
import logging
from collections import namedtuple
from typing import (
Any,
Dict,
List,
)
from galaxy.util import (
asbool,
nice_size,
)
from . import InstrumentPlugin
from .. import formatting
log = logging.getLogger(__name__)
VALID_... |
de04e85dc4ecf3c0e88ebed19920a5dc8d0912d2af967b251da2d570362c53e8 | Python | 8,952 | 220 | import hashlib
import networkx as nx
import numpy as np
import random
from .. import BaseModel
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from tqdm import tqdm
class Hin2vec_layer(nn.Module):
def __init__(self, num_node, num_relation, hidden_size, ... |
5988761561010e07336dfebd7a136ec8e7bab4cdc119c680f50bd20ffc736fb9 | Python | 8,954 | 216 | # 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... |
afd093644d2583e61cc2a9efadcc624b4c268c7319423b37bcfcc062584ca26d | Python | 8,958 | 262 | """Private forward arithmetic for bracketed first-spike roots."""
import torch
from spikingjelly.logger import logger
try:
import triton
import triton.language as tl
except (ImportError, OSError) as error:
triton = None
logger.info("First-spike Triton kernels unavailable: {}", error)
if triton is n... |
cbfe159d539acd747d657c21c3a5b7a754ebb5a5c857dd98484f7f99d4403b03 | Python | 8,960 | 224 | #### All original code is copyright of Graham King, Trinity College Institute of Neuroscience.
### Code to calculate the Spearman second order correlation
### Code to calculate fingerprint identification success
### Code to calculate mean within vs between subject correlation
### Fishers exact permutation test to deter... |
a791aa86007911c4e9c7c34f25a93a6f3010de25f6da744f8c83534f7dac4e42 | Python | 8,962 | 247 | """
velvet datatypes
James E Johnson - University of Minnesota
for velvet assembler tool in galaxy
"""
import logging
import os
import re
from galaxy.datatypes import (
data,
sequence,
)
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.protocols import (
DatasetProtocol,
Has... |
2c055d65b7b7b0868dc68cca5dcfb0656f5761b627cf3ff95abc42b92057c275 | Python | 8,967 | 279 | from cv2 import mean
import numpy as np
from scipy.optimize import minimize
from registration import transform, alignTo, align
from representations import contour_cv2_mask_uniform
from polynomials import contour_to_label
import matplotlib.pyplot as plt
def ssd(lambdas, y, meanshape, eigvecs):
"""
Sum of square... |
5d62d4debe9530086e4457375f80e4075ff2bb547cdb25eecf82bd43a8cc3130 | Python | 8,968 | 248 | # Copyright (C) 2021 Eugenio Piasini.
#
# This file is part of metex.
#
# Metex is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Met... |
6fbec2810527919d4dd0906a929fa854d12204d0589355ad3506473fc28fe364 | Python | 8,969 | 220 | # 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
from unittest.mock import patch
from ax.analysis.plotly.plotly_analysis import PlotlyAnalysisCard
from ax.analys... |
c1cc170554be3f4f5785153200a4ebafaaf00aac4d54d7d7a3d56fe2fa6c5260 | Python | 8,969 | 220 | # coding: utf-8
# 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"... |
0a04549705b5bc6b032b628d7d39542cd4c95712acf761acdf7073f3e01c34bc | Python | 8,972 | 225 | """Cut a new Human-GEM release: bump the version and regenerate the model exports.
Python/raven-toolbox port of ``code/io/increaseHumanGEMVersion.m``.
Reads ``model/Human-GEM.yml``, checks it against the annotation tables, then
regenerates every export in ``model/``:
* ``Human-GEM.yml`` and ``Human-GEM.mat`` from th... |
ff0fa0b443178b0d64106d6857789d3c581f6457b6f60e409724336e2a890f89 | Python | 8,975 | 209 | """
Copyright © 2025 Howard Hughes Medical Institute, Authored by Carsen Stringer , Michael Rariden and Marius Pachitariu.
"""
import numpy as np
from . import utils
from scipy.optimize import linear_sum_assignment
from scipy.ndimage import convolve
from scipy.sparse import csr_matrix
def mask_ious(masks_true, masks... |
8966d62a98edf6a0bd56e2092b44021af8f86c933af3e309973044331e037ab9 | Python | 8,978 | 202 |
import abc
from copy import deepcopy
import torch
import functools
import numpy as np
from typing import Text, Tuple
from torch_geometric import data
from MolRep.Evaluations.DatasetWrapper import Graph_data, MPNN_data
class Data(data.Data):
def __init__(self,
x=None,
edge_ind... |
a05e8217ba14ac6ab7ad528182832229022d19fda7e1d410cc45df0a5229b424 | Python | 8,978 | 367 | """
All experiments for the paper.
config: the baseline config.
config_ranges: the config items to be varied.
"""
from utils import vary_config
import numpy as np
import pprint
#from birdseye import eye
def co_vary9():
# only for b=9 N=1024; otherwise taking too much time!
beakers = [9]
seed_n... |
4fa43a8d9cfd98e9fd5584cfc5334494d45b65784ff9a74bc1915b825186dd56 | Python | 8,980 | 223 | """
Mask R-CNN
Base Configurations class.
"""
# Details: https://github.com/matterport/Mask_RCNN/blob/master/mrcnn/config.py
class mainConfig(Config):
"""Base configuration class. For custom configurations, create a
sub-class that inherits from this one and override properties
that need to be changed.... |
5737464a3252e8fc3a3ef00ccc043c0643b2cc94cee0cd06c244159ad1711c68 | Python | 8,981 | 228 | # Copyright 2020 DeepMind Technologies Limited.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
02e66694644a0370afa2982e5514bd36e9646999a436fc9ac23d70b211d4cfa6 | Python | 8,982 | 214 | from __future__ import annotations
import math
import geopandas as gpd
import numpy as np
import pytest
from shapely import MultiPolygon, Point, Polygon
from spatialdata import SpatialData
from spatialdata.models import ShapesModel
from spatialdata.transformations import Affine, Identity, Scale, Sequence, set_transfo... |
174cd767b4747973fc12de05de6ac2b5db5f135fad413181d804dc16f7835072 | Python | 8,989 | 254 | import pytest
import networkx as nx
from networkx.utils import pairwise
class TestAStar:
@classmethod
def setup_class(cls):
edges = [
("s", "u", 10),
("s", "x", 5),
("u", "v", 1),
("u", "x", 2),
("v", "y", 1),
("x", "u", 3),
... |
e45ce8401dd3fbf789ebdf910e285aae87488e4d2a0fc1e17d92709c220c179d | Python | 8,992 | 173 | """
build_rois.py - builds recon-all (FreeSurfer) ROI masks in charm/mesh space for the tDCS E-field
analysis, matching Olsson et al. 2025 (FreeSurfer 7.2). Registers recon-all orig.mgz to charm T1
(FLIRT 6-DOF rigid), assembles one integer ROI-label volume (cortical/WM lobes x4 each, corpus
callosum, Iglesias mesencep... |
b5cc9217cfa372f69114e9739170d2a3545f512ec9cc852a208d46180672eea7 | Python | 8,995 | 229 | # 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... |
234124146ede428602d21e9914bb64965554b621694be442cb2a01644cb5062b | Python | 8,998 | 208 | '''
The script to train PIGNPI and baseline to learn pairwise potential energy
'''
import os
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import numpy as np
import torch
torch.set_num_threads(2)
import pickle as pkl
from torch.optim import Adam
from tqdm import tqdm
import mat... |
164d69442058d399e45f57412e9d38a1525531a158811532495f94dc588842da | Python | 9,003 | 264 | import random
from typing import Optional, Tuple, Union
import numpy as np
import scipy.sparse as sp
import torch
from cogdl.operators.sample import coo2csr_cpu, coo2csr_cpu_index
def get_degrees(row, col, num_nodes=None):
device = row.device
if num_nodes is None:
num_nodes = max(row.max().item(), co... |
3276507c29e7192236b50aa13ce2ade2913d951628c7efe723dde4470e88ba43 | Python | 9,007 | 265 | import dataclasses
import random
import typing
from typing import TYPE_CHECKING, Mapping, Sequence
import errr
from .._util import get_arclengths, get_location_name
from ..constraints import Constraint
from ..definitions import CableProperties, Ion, Mechanism, MechId, mechdict
from ..exceptions import Trans... |
03a072fbed3151f07168ac33a742d0c08b76ac63d53a7ba0f68ef01db211ddd1 | Python | 9,008 | 221 | #!/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 math import isnan
from typing impo... |
1a78038021ec49d29e7a6122fa76514345ede6c9a11885968d3ecbb0a7e5aab1 | Python | 9,009 | 198 | import seaborn as sns
import matplotlib as mpl
from matplotlib.patches import PathPatch
import numpy as np
import itertools
class GroupPlot():
CONTINUOUS_X = False
def __init__(self, x, y, hue, data, x_order, hue_order, plot_colors,
size_factor, ax, plot_type, nb_x_vals=1, pair_unit_columns=N... |
f03e5b06bf4d0343ce976c43132a0b4de904c4240abe78c30df5bf2db7e9e2a5 | Python | 9,016 | 207 | import abc
import torch
from torch import nn
from torch.nn import functional as F
from utils import get_data_loader
import copy
import numpy as np
from models.cl.fromp_optimizer import softmax_hessian
class MemoryBuffer(nn.Module, metaclass=abc.ABCMeta):
"""Abstract module for a classifier that enables it to mai... |
b1c909b2858ee09f413aa21ce7a8cb3fcdd526000564925955a23d5646a18d72 | Python | 9,017 | 204 | """Pytorch Dataset object that loads perfectly balanced MNIST dataset in bag form."""
import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.utils.data as data_utils
from torchvision import datasets, transforms
class MnistBags(data_utils.Dataset):
def __init__(self, target_number=9, mean_ba... |
01462e5fdd77fcf66af68950f05cacd9b1092e438463d84d8efe10b2cb9f05ee | Python | 9,020 | 231 | """This module define an abstract class for reasoning about Galaxy's
dataset collection after jobs are finished.
"""
import abc
from typing import (
List,
Optional,
)
from galaxy.tool_util_models.tool_outputs import (
DatasetCollectionDescriptionT,
DiscoverViaT,
FilePatternDatasetCollectionDescrip... |
bde342de1a195e7271465ecd64503c77bd3b29d458c493fbb8cf4e7321431a14 | Python | 9,025 | 259 | import tempfile
import warnings
from pathlib import Path
import numpy as np
import numpy.testing as npt
import pandas as pd
import pandas.testing as pdt
import pytest
from voxcell import RegionMap, VoxelData # type: ignore
import atlas_densities.densities.mtype_densities_from_profiles as tested
from atlas_densities.... |
72d0b22b06a4d98cf90b06480b978504596d1ee4d996190e213b293ea5d40113 | Python | 9,026 | 288 | """ Cleft continuation IO for processing tasks """
import os
import re
import h5py
import pandas as pd
from sqlalchemy import select
from ... import io
from ..seg.continuation import Continuation, Face, ContinFile
from .. import colnames as cn
from . import filenames as fn
FACE_REGEXP = re.compile("f[0-2]_(hi|lo)"... |
837d09da7b17369fb83189b015005d1efdb965a1b93a35c9b104189f79d22afd | Python | 9,026 | 316 | import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib.colors import Normalize
from matplotlib.lines import Line2D
from .color import level_one_palette
from .contour import density_contour
from .text_anno_scatter import _text_anno_scatter
from .utilities import (
_auto_size,
_density_based_sampl... |
e4a5b8a76574e6f82f82958299a42acf01a2fe43e9d38b9d612f859735ddd71c | Python | 9,026 | 268 | # 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
"""
Metric classes for Ax benchmarking.
Metrics vary on two dimensions: Whether they are `MapMetric`s or not, and
whether th... |
aa4a7e2dca16591a0b11126bb980cdc321c22013ed65e380abc79e1ca0bdbeb6 | Python | 9,027 | 256 | #emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
#ex: set sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See the COPYING file distributed along with the smile package for the
# copyright and license terms.
#
### ### ### ### ### #... |
ae9adbef36bb26c9f64ff8f0c3b723f15bc469083980e8069b227b720f590b3c | Python | 9,030 | 196 | #!/local/cluster/bin/python
import numpy,csv,argparse
# for classifyExpression9_filter.py
# adapted from classifyGenes4.py
###########
## INPUT ##
###########
def readGeneGroupFile(geneGroupFile,printAll):
expressionInfo = {}
for line in open(geneGroupFile, 'r'):
if not line.startswith('ID'):
... |
27845f3293b92df2f9cffc08df13f6c1c6cadaf30512cc4042a05d74f770dd80 | Python | 9,033 | 264 | """
An algorithm for finding if two undirected trees are isomorphic,
and if so returns an isomorphism between the two sets of nodes.
This algorithm uses a routine to tell if two rooted trees (trees with a
specified root node) are isomorphic, which may be independently useful.
This implements an algorithm from:
The De... |
a439206ea67a9305e237ead8cc63a595d72c6496264c099c22517722a39f0f79 | Python | 9,039 | 239 | """Check the repository Loguru conventions with the Python AST."""
from __future__ import annotations
import argparse
import ast
import re
import string
from pathlib import Path
EXCLUDED_PARTS = {"example", "examples", "test", "benchmark", "docs"}
LOG_METHODS = {"debug", "info", "warning", "error", "exception", "cr... |
07bd0be95161f02376c12b9e7b7e0ca07e4695bd56ae333aa1cfea3b4737022e | Python | 9,040 | 229 | import os
import json
import numpy as np
from warnings import warn
from voluseg._tools.get_volume_name import get_volume_name
from voluseg._tools.parameters import save_parameters
from voluseg._tools.parameters_models import ParametersModel
import zarr
from voluseg._tools.nwb import open_nwbfile, find_nwbfile_volume_o... |
df6675abcb1c166d9adbbcd3e9002a14859dc9b171c05e2cf6c953ed6b4bc642 | Python | 9,046 | 262 | """
Plot Figure 2
"""
import numpy as np
import strinf as si
# # # PARAMETERS # # #
ZOOM = 1.5
SAVE = True
SHOW = True
PANEL = ("C", "D", "F", "G") # The sketches in A, B, E are always plotted.
johansson = {
"DSL" : "2021-08-17-18-30-38-392007_020_3_dots_Johansson_1973",
"lamTmax" : 20.,
"lamfilterfr... |
c80966bdf1daa9626dfbc99800dabc2694b6e80a89c4f85db7a9a369d279ded1 | Python | 9,056 | 231 | """BCI.
==================================================
Apply DOC-Forest recipe to single subject BCI data
==================================================
Here we use the resting state DOC-Forest [1] recipe to analyze BCI data.
Compared to the original reference, 2 major modifications are done.
1) For simplici... |
afee87280b1824db57ad4eb3eb2e7666661b6f901e15a58d03efa309f23aee98 | Python | 9,057 | 297 | """
Contains builtin commands.
"""
import contextlib
import itertools
import pathlib
from uuid import uuid4
import errr
from ..._options import ConfigOption
from ...config import parse_configuration_file
from ...core import Scaffold, from_storage
from ...exceptions import ConfigurationSyncError, NodeNotFoundError
fr... |
e8a995d9b67c2842e2cf543c0feee9526bcd7a97f009ee88665b19646580c635 | Python | 9,057 | 208 | #!/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 re
import sympy
DOT_PLACEHOLDER = "__dot__"
SLASH_PLACEHOLDER = "__slash__"
COLON_PLACEHOLDER... |
e9bd9a7d61ae4c86424bd977934d0652f8787ff5085c2f1c4ff43d599fc685c0 | Python | 9,057 | 237 | """
Evaluation test is performed for the following dataset.
https://www.clips.uantwerpen.be/conll2000/chunking/output.html
"""
import os
import random
import subprocess
import unittest
import numpy as np
import pytest
from sklearn.exceptions import UndefinedMetricWarning
from seqeval.metrics import (accuracy_score, c... |
f4056ff5ccc13d4b866330f8368e3e495cb5d175c73cddf69e4d2ff5f87f182e | Python | 9,058 | 261 | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 26 15:20:33 2021
@author: Estefany Suarez
"""
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import os
import itertools as itr
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib.pyplot as plt... |
7af63e3b9dfbd49bfe9376d4310b3ea8e4bcabceb9e4bf5e588b2b4cb5c96be4 | Python | 9,062 | 266 | """Correlate manifold eccentricity with functional connectivity measures"""
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from brainspace.gradient.utils import dominant_set
import bct
from neuromaps import stats
from surfplot import Plot
from adaptman.config im... |
92d6daab2a1672c07fb1c6f48be808627d191ece000a37054899549008121786 | Python | 9,063 | 196 | """
Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
Produces a websummary output as a single html page with embedded plots.
"""
from __future__ import division
import matplotlib
matplotlib.use("Agg")
matplotlib.rcParams['figure.figsize'] = (9.0, 6.0)
matplotlib.rcParams.update({'font.size': 12})
matplotl... |
f8c6b536dce1f2c1d2b979501ddd15df37bb2fd92262a6168e6d4447b4431b06 | Python | 9,064 | 245 | import os
from functools import reduce
import numpy as np
import pandas as pd
import xarray as xr
from tqdm.auto import tqdm
from alpineer import io_utils, misc_utils
import ark.settings as settings
def shannon_diversity(proportions):
""" Calculates the shannon diversity index for the provided proportions of a ... |
f9aec19cc591adc74ea4d78e44c29fd308af5d1571a435f863a0a6a7799747e3 | Python | 9,076 | 293 | # -*- coding: utf-8 -*-
"""
Tracking
========
Simple particle tracker based on liner programming.
Note
----
This module is used by :mod:`~ClearMap.Alignment.Stitching.StitchingWobbly`
to trace wobbly stacks.
"""
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Puli... |
0cb75cd3034b984f4db3eadeb809a6b3a887ef7dac37772d1056d4c493ddfcb7 | Python | 9,086 | 242 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# readGenoList.py
#
# Copyright 2019 Daniele Raimondi <eddiewrc@vega>
#
# 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 Free Software Foundation; either version 2 ... |
7f07375771e4c36dbf7074740a1a227dc56364229ac107a70f605d3e5a3b8f1c | Python | 9,091 | 263 | # 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
"""
Noise classes for benchmark problems.
Each `BenchmarkProblem` specifies a `Noise` instance that determines how
noise is ... |
97dd0fbc9e16d463ab0ba90df1ad25d1c6985f30c84625a26111d8fb6d97a36e | Python | 9,093 | 260 | import argparse
import os
import numpy as np
import math
import itertools
import scipy
import sys
import time
import datetime
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 Variabl... |
92c287496730545afe5f82e76f0ca25c90d48ac5cff5df55068cabf9d069fba7 | Python | 9,094 | 247 | """
The tables of an engine that are kept, to start it without finding them again.
Building the ``neurosynth`` engine takes 58 s natively and 112 s in a browser,
and most of it is finding what never changes for the same data: the studies
activating the regions of the atlases (48 s natively), and what nilearn is
asked ... |
98ea166c9f9441e57e75eb580edcca50057b3077bc2d2af506bbb7f00f4f03ce | Python | 9,094 | 214 | """Plot the training data amount analysis results.
Parameters
----------
project_dir : str
Directory of the project folder.
"""
import argparse
import os
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
# =============================================================================
# Inpu... |
ea5db5dcd81fd71842f17206d81765092635c242b90daf303510b4c9d88d45e7 | Python | 9,095 | 285 | # -*- coding: utf-8 -*-
"""
Plotting routines for overlaying labels, tilings, and sectioning of 3d data sets
Supported functionality:
* plot volumetric data as a sequence of tiles via :func:`plotTiling`
* overlay points on images via :func:`overlayPoints` and
:func:`plotOverlayPoints`
* overlay lab... |
0f8d0aea63aa00599f35bd8d95b6390a3b6f4de761457056810f63616b0cc2c4 | Python | 9,097 | 228 |
def train_recon_net():
image = r"C:\Users\biophys\PycharmProjects\ISTA\artificial_data\maxi_batch\coordinate_reconstruction_flim.tif"
truth = r"C:\Users\biophys\PycharmProjects\ISTA\artificial_data\maxi_batch\coordinate_reconstruction.npz"
gen = data_generator_coords(image, truth)
image = np.zeros((160... |
7a7a636da914620cba8dafec901d4cf6e2fff75ae6be9b8fed4fbb3fd7bb882c | Python | 9,099 | 250 | import os
import sys
from typing import (
Optional,
)
import alembic.config
from alembic.config import Config
from alembic.runtime.migration import MigrationContext
from alembic.script import ScriptDirectory
from sqlalchemy import create_engine
from sqlalchemy.engine import Engine
from galaxy.model.database_utils... |
57851468bc01f8ec24140dc47429c06eb396808518692b7e1fc1423867e94f27 | Python | 9,101 | 193 | # 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... |
f32e3de433d4b66df4e7f6c424907521e4395e1b819ec9319b3fa8b8e27a0878 | Python | 9,114 | 221 | #!/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 Callable
from datetime import datetime... |
ffc765a92b162b657d2a3f3d79705f174c5b77e165da98af42c017f379341ffe | Python | 9,114 | 245 | """
Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
Identifies barcodes with low targeting (highly likely to be from dead cells), with no
limitation to accessible regions.
Outputs a json of species-specific barcodes to be excluded from later cell calling.
"""
from __future__ import division
import json
im... |
aefb7b34c593798e07d1d41ea297e6ed06609da6727cc9b07d92de5f8a51ae8c | Python | 9,116 | 278 | def epoching(args, data_part, seed):
"""This function first converts the EEG data to MNE raw format, and
performs channel selection, epoching, baseline correction and frequency
downsampling. Then, it sorts the EEG data of each session according to the
image conditions.
Parameters
----------
args : Namespace
I... |
d35224f6a6326eabacd2c4a64d77bc62b9e7bab36cfe24fadf387d2e6afafb3a | Python | 9,117 | 200 | from __future__ import annotations
import warnings
import geopandas as gpd
import numpy as np
import spatialdata as sd
from scipy.spatial import cKDTree
from spatialdata.models import get_axes_names
from spatialdata.transformations import get_transformation
from squidpy._validators import assert_key_in_sdata
__all_... |
2c9b500c781d62525719c676ab973c999df6166a90291200b3508f56ebd3017d | Python | 9,119 | 214 | # -*- coding: utf-8 -*-
import pandas as pd
import os
import re
import copy
import numpy as np
import time
def goDeeper(props,this_path,a,max_a,conditions,folders):
a += 1
for newFolder in os.listdir(this_path):
print(newFolder)
if conditions[a-1] != "":
if newFolder... |
919d80183b1eacd7925fd691981e17ea0f50ffb17ba06162ae588863c724e775 | Python | 9,120 | 262 | import numpy as np
import pytest
import tensorflow as tf
from hidten.hmm import HMMConfig as HidtenHMMConfig
import tests.hmm.ref as ref
from learnMSA.config.hmm import PHMMConfig
from learnMSA.hmm.util.transition_index_set import PHMMTransitionIndexSet
from learnMSA.hmm.tf.transitioner import (PHMMExplicitTransitione... |
ce941f0c49e0f2487154421cb246a9605ee8cd70baa81136285cbae638f677c1 | Python | 9,120 | 250 | # 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... |
c34be9eb88c04ef8f31c7e7b1dcc4f3ce760a9e8dd3e65f2af71594fe586170c | Python | 9,123 | 285 | # -*- coding: utf-8 -*-
"""
Plotting routines for overlaying labels, tilings, and sectioning of 3d data sets
Supported functionality:
* plot volumetric data as a sequence of tiles via :func:`plotTiling`
* overlay points on images via :func:`overlayPoints` and
:func:`plotOverlayPoints`
* overlay lab... |
a3997a89745bb09d99ef749cf0b9adaa1d0deef4f435d46cb05f500351bdf045 | Python | 9,129 | 324 | import json
from enum import Enum
from typing import (
Annotated,
Any,
Literal,
Optional,
Union,
)
from pydantic import (
ConfigDict,
Field,
RootModel,
)
from pydantic.functional_validators import field_validator
from galaxy.schema.fields import (
DecodedDatabaseIdField,
Encode... |
48433c385749273e01e4b724f89ae86c9a97c475f250257a22595ae3938f1651 | Python | 9,130 | 217 | # coding=utf-8
# Copyright (c) DLUP Contributors
import json
from pathlib import Path
from typing import Tuple, Union
import h5py
import torch
import torch.nn.functional as F
from pytorch_lightning import LightningModule
from dlup_lightning_mil.utils.model import get_backbone
from torch import nn
import numpy as np
im... |
101fc355cd3cb3c72736ea5cc03a6f794f65a7ccc576b405df2b57f67d1ffdca | Python | 9,132 | 266 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 11 13:56:08 2020
@author: amelie
"""
from brian2 import *
from scipy import signal
from FEF_full3 import *
from LIP_full import *
from itertools import *
from joblib import Parallel, delayed
import multiprocessing
def save_raster(name,raster_i... |
0d49432b666a9ed735baea7b7f88b50e4862f9bd2de817399a6e3cfdfdc13052 | Python | 9,136 | 254 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 29 08:58:41 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_vis import *
def generate_visual_neurons(theta_phase,N_FS,N_RS,... |
7d05c67170a8d91d1e24d9d312ad99a4db02f2483c43054ce49c4a6d54ed584a | Python | 9,141 | 224 | #!/usr/bin/env python
import argparse
import os
import os.path as op
from collections import defaultdict
import nibabel as nb
import pandas as pd
import numpy as np
from collections import defaultdict
from tqdm import tqdm
import h5py
def flattened_image(scalar_image, scalar_mask, group_mask_matrix):
scalar_mask... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.