sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
9fd1df77fc242728fd088e811082fb9c0b8f7ef189dbb7b1ece6dbfd3566d322 | Python | 5,162 | 151 | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
from torch.nn import init
import torch.nn.functional as F
import numpy as np
from torch_geometric.nn import GINConv, global_add_pool
class GraphConv(nn.Module):
def __init__(self, input_dim, output_dim,
dropout=0.0, bias=True):
... |
09e7b55e097ffce2f4ad20d1daa9fa1e7406d29f0762e850bc69c1744604cd86 | Python | 5,165 | 141 | import os, stat
from pathlib import Path
from .utils import get_logger, add_file_handler
from .config.options import ProjectOptions, DEFAULT_CONFIG_FILE_NAME
from .config.glm import GLMOptions
from .convert2bids import setup_dirs as setup_convert2bids_dirs
from .bids_validator import setup_dirs as setup_bids_validati... |
9a3475065d6992af04adbb3ef998d4ebc32c4b558750a784a60e51c6d8f59eb1 | Python | 5,165 | 154 | import os
from collections import OrderedDict
from typing import (
List,
Optional,
Tuple,
TYPE_CHECKING,
Union,
)
from packaging.version import Version
from galaxy.tool_util_models.untrusted import is_loading_untrusted_tools
from galaxy.util import (
in_directory,
string_as_bool,
)
from .p... |
b8bd9899b3b9e3dd080ec5fb38b15af3ef9933920b48d2d02b64cc3134c3e8ed | Python | 5,165 | 165 | from pylab import *
import matplotlib.pyplot as plt # To plot
import numpy as np
import math
#### STATIC ####
long = True
damp = 10
# Input parameters for file selection:
spacing = 4.5
psigma = 1
print('spacing:', spacing)
print('psigma:', psigma)
T = 3
confignrs ... |
b5e6afad8858be33eed714916cc8c395497eac6727cc94506fa0e69f529eefec | Python | 5,166 | 135 | from collections import defaultdict
import numpy as np
from scipy import sparse
from scipy import stats
from scipy.ndimage import gaussian_filter
from peakachu.utils import image_normalize, distance_normalize, calculate_expected
#from statsmodels.sandbox.stats.multicomp import multipletests
class Chromosome():
def... |
3a558cbe5d9a75103227520fa22732adad9bba75a2bd4ee973874d650b2d1841 | Python | 5,168 | 169 | import matplotlib.pyplot as plt # To plot
import numpy as np
import random
import math
onechain = False
# Set variables
N = 100 # Number of bond vectors = number of units - 1 # Per chain
if onechain==True:
M = 1 # Number of chains
L2 = 1 # Determining the s... |
514134e7e1ee85215c31bcb1d4c068b133df43edd51dda5a8f4d071570bc97e8 | Python | 5,170 | 157 | # -*- coding: utf-8 -*-
"""
Created on Sun May 29 09:30:46 2022
@author: Md Tauhidul Islam
"""
# To illustrate the imputation calculation of SERM, the cellular taxonomy dataset analysed in the
# manuscript will be automatically loaded. However, you can upload your own dataset, and impute the
# data by SERM. Here th... |
a4937caf04936949a594758f877150fba34ed366fcd5c0271a88ae8dba61f2a7 | Python | 5,170 | 153 | # -*- coding: utf-8 -*-
"""
StatisticsPointList
===================
Perform varous statistical measurements in local rregions around a list of
points.
See also
--------
:mod:`~ClearMap.Analysis.Measurements`
"""
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Pul... |
40affdc93c0c9e782e5cd569ccfb165e1aaccd1db3a704493d80cc7f90c59b8f | Python | 5,176 | 140 | import math
import pytest
import networkx as nx
from networkx.algorithms import bipartite
from networkx.algorithms.bipartite.cluster import cc_dot, cc_max, cc_min
def test_pairwise_bipartite_cc_functions():
# Test functions for different kinds of bipartite clustering coefficients
# between pairs of nodes us... |
c9354cd2e834f4fa03cf4e1f0370b390ba64299e0b1b92bc7bc902465265e669 | Python | 5,177 | 134 | # 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 pandas as pd
from ax.analysis.plotly.utils import (
get_arm_tooltip,
get_trial_statuses_with_fallback,
tri... |
56d040ecccda5d9ed92c95108e0626f0a3d8aa80cad853a6776151e2659b7dc9 | Python | 5,181 | 144 | # -*- coding: utf-8 -*-
"""
Template to run the processing pipeline
"""
import os,numpy, sys
#pre-execute to make sure that Clearmap modules can be loaded
#generic solution
#basedir = os.path.abspath(os.path.join(os.path.dirname(__file__),'../../..'))
#hardcoded for docker
basedir = os.path.abspath('/CloudMap/Frien... |
98c4e5ae7c97b5af31cc0dc8ba98092659ea1c2a353d6557af6420158f9d0db8 | Python | 5,181 | 121 | import tensorflow as tf
import numpy as np
import os
from data_reload import *
# REGULARIZER = 0.01
BATCH_SIZE = 10
def compute_accuracy(v_xs, v_ys):
global prediction
y_pre = sess.run(prediction, feed_dict = {xs: v_xs, keep_prob: 1})
correct_prediction = tf.equal(tf.argmax(y_pre, 1), tf.argmax(v_ys, ... |
e43ef8d91e7d66d3c06e0a3814ab09e8ab7a92bed4ad8a0b3c14ce18f0eefc8c | Python | 5,181 | 132 | # 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.analysis.plotly.plotly_analysis import PlotlyAnalysisCard
from ax.analysis.plotly.utility_ranking import UtilityRanki... |
b9e7f5d8ed123ac33d2d4bc3c7062507e5c4b20b13675c83a8e26060ef5f990c | Python | 5,182 | 110 | # -*- coding: utf-8 -*-
from figureflow.figure import Figure
import seaborn as sb
import os
# get the path to the data of the respective figure or movie
# the data is in the data folder in a folder with the same
# name as the folder that the script is in
# the input_folder can also just be the folder in which the scr... |
d7289c5c7b2d6a6da837bb9f9513c8fb678a46768bfd4cca5036b3e087c8a4ea | Python | 5,183 | 140 | #!/usr/bin/env python
#
# Copyright (c) 2018 10x Genomics, Inc. All rights reserved.
#
"""
Library functions for performing batch correction
"""
from collections import Counter
from itertools import izip
import struct
import numpy as np
from sklearn.metrics.pairwise import rbf_kernel
import sklearn.neighbors as sk_nei... |
f7d6d205eb0a432822ad0441b65acf250ffdf93b5b49fb705e8addff1e6031b1 | Python | 5,184 | 144 | import urllib.parse
from typing import (
Optional,
Union,
)
try:
from fs.ftpfs import FTPFS
except ImportError:
FTPFS = None # type: ignore[misc,assignment]
from galaxy.files.models import (
BaseFileSourceConfiguration,
BaseFileSourceTemplateConfiguration,
FilesSourceRuntimeContext,
)
fr... |
dd201fe5f62a9fb18405b57a715b724c062e709f8b347b7b4e74dcfdbb28cc05 | Python | 5,185 | 139 | import numpy as np
import random
import sys
import math
## Placing the bead in the brush
# System info
spacing = 100
charge = -1
T = 3
# Number of files out, etc.
Nfiles = 1000
seed = 23
# Technicalities: Placement of bead
tol = 0.2 # The closest we'll allow the bead to be to a brush... |
42636967d59142b174b5a54a9fc7a9d07309682c328149ef4dd7e5b361385528 | Python | 5,186 | 116 | import sys
import os
from glob import glob
import json
from statistics import mean
import pandas as pd
from scipy.spatial import distance_matrix
import matplotlib.pyplot as plt
import logging
MIN_ACC = 90
METRIC = 'accuracy'
assert METRIC in ['accuracy', 'f1']
VISUALIZE = False
def select_diverse_models(experiments_... |
898504734355e0c350c988e2b1bf9dded5815ff0fb3ebb264b5be5fbcb7e1a62 | Python | 5,188 | 130 | import pytest
import torch
from torch import nn
from spikingjelly.timing_based.encoding import GaussianTuning
from spikingjelly.timing_based.neuron import Tempotron
def test_continuous_events_keep_receptive_fields_and_index_order():
encoder = GaussianTuning(1, 4, torch.tensor([0.0]), torch.tensor([1.0]))
ass... |
e4c68a296afde86320435dd369a83d27af1674df36afd83cef27fff2ac6c8ab5 | Python | 5,192 | 111 | #!/usr/bin/env python
#
# Copyright (c) 2016 10X Genomics, Inc. All rights reserved.
#
import collections
import ctypes
import itertools
import re
import striped_smith_waterman.ssw_wrap as ssw
# A single reference sequence and associated metadata
SSWReference = collections.namedtuple('SSWReference', ['name',
... |
80893a7d31bd28cafc45bb8a483c305c1d65c1e91a628968777d2f4545ac8206 | Python | 5,200 | 145 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 16 22:37:53 2020
@author: shreyasaxena
"""
import matplotlib.pyplot as plt
from sklearn.cross_decomposition import CCA
import numpy as np
import os
def parse_areanames(areanames_):
areainds=[]; areanames=[];
for i,area in enumerate(areaname... |
7d77e511df44d80c32954f22a71a7d08a09982bad441df28d79a99a5e4d325a1 | Python | 5,201 | 16 | import MDAnalysis as mda
import MDAnalysis.analysis.rms
import numpy as np
ref = mda.Universe ('./pca_2_ref.pdb')
traj_u = mda.Universe ('ionized.psf','sum.xtc')
ref_sel = "name CA and resid 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 8... |
54f6d875981bbfaa2e68fb59f4d4cb901c8a6172db9ede74de0357a0cb26682a | Python | 5,204 | 118 | # -*- 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
# get the path to the data of the respective figure or movie
# the data is in the data folder in a folder with the same
# name as the folder that t... |
bdcafaf77264197a7319849413a951f033b65fc316b77f206d9796848416f68a | Python | 5,204 | 121 | import torch
from torch import nn
import torch.nn.functional as F
from torch.nn import BatchNorm1d
from torch.nn import Sequential, Linear, ReLU
from torch_geometric.utils import degree
from torch_geometric.nn import GINConv, global_add_pool, global_mean_pool
class GIN(torch.nn.Module):
def __init__(self, dim_fe... |
203ab65b96292f9f1456c09782ebd3db14bf101cd3d00550836ef9f25895d9e3 | Python | 5,215 | 151 | # 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... |
523ba7e6759b55130df082d4c1dd6966bdcc73594435fb379d4ae1225cee088a | Python | 5,217 | 167 | import json
import logging
import os
import pickle
from functools import partial
import numpy as np
import pandas as pd
from sklearn.pipeline import Pipeline
from divik.core import configurable, visualize
_SAVERS = set()
def saver(fn):
"""Register the function as handler for saving model and related summaries
... |
d5a088c2fee0d39a341adde85738edcaee6d8b6e48f77224ccd79a28f17597b7 | Python | 5,217 | 141 | #!/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 unittest.mock import patch
import numpy as np
from ax.exceptions.core import UnsupportedError
fr... |
0b18037effbba101b216da2b91b468571729a6aaa7d15de272e77e7de185a872 | Python | 5,218 | 126 | #!/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 unittest.mock import patch
import jax.numpy as jnp
import torch
from ax.adapter.registry import ... |
ccfd3b7bb43a064823410f3fe56433f80e951e0b3f44ee4b0d88922c6418c1ba | Python | 5,221 | 132 | import typing
import errr
import numpy as np
import scipy.stats.distributions as _distributions
from .. import config
from ..exceptions import DistributionCastError
from . import types
if typing.TYPE_CHECKING: # pragma: nocover
from ..core import Scaffold
# Scan the scipy distributions module for all distribut... |
487784c48509addc7bd6a50ecd7094e5093b83b309f2aa332d8d97e7946be4bc | Python | 5,223 | 160 | import os
import itertools
import random
import numpy as np
import h5py
import torch
from dataprovider3 import DataProvider, Dataset
class Sampler(torch.utils.data.IterableDataset):
def __init__(self, datadir, spec, vols=[],
mode="train", aug=None, seed=None):
assert mode in ["train", ... |
e9774ada5c39e74025dab54c65e5c2d51fbb7dc6e098866044d4831b92bb60f5 | Python | 5,225 | 161 | # -*- coding: utf-8 -*-
"""
MeasureRadius
=============
Measures intensity decays at spcified points in the data.
"""
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE)'
__copyright__ = 'Copyright © 2020 by Christoph Kirst'
__webpage__ ... |
59ac92afa0f930ea1f3296b46ec5409465721a800729b3a0b523bc83a355feec | Python | 5,228 | 154 | # 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... |
07e78cd0c018f86e236bcad198147a6b53ca5bb04737ffa0c7ddd59b17ddbe4b | Python | 5,229 | 106 | #!/usr/bin/env python
import pandas as pd
import numpy as np
from collections import defaultdict
from itertools import combinations
from itertools import chain
import pickle
from pas_utils import *
from feature import *
if __name__=="__main__":
OUTPUT_DIR="./APA_ML/processed"
if not os.path.exists(OUTPUT_DIR):... |
120a140877fa55f7009b9d3aed5043e75ce50b24efefc389e6a9db7eeb45d128 | Python | 5,229 | 147 | """
A comment line explaining each rule of the assistant's query.
Once the agent has an accepted query, :func:`comment_rules` asks the
model, in one more request, for a line explaining each of its rules
(:func:`split_rules`), and :func:`commented_query` writes the query with
each line as a comment above its rule: ``% ... |
5f6fed45815319891209f486b81585b76e0894b47b06bfe1c1d2005621284d0e | Python | 5,229 | 169 | import os
import fanc
from fanc.tools.general import mkdir
# start snippet logging
import logging
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(message)s')
# end snippet logging
output_folder = 'api_output'
# start snippet import map
import fanc.map as map
# end snippet import ma... |
fa57c911b469d65d6404a25e25551f90d577f64aba1533b18d09445b92f2d6be | Python | 5,229 | 164 | from typing import (
Any,
Literal,
Optional,
)
from typing_extensions import (
Protocol,
)
Impact = Literal["minor", "moderate", "serious", "critical"]
# Axe tests we want to actively pass in Galaxy, the next list controls tests.
BASELINE_AXE_PASSING_IDS = [
"aria-roles",
]
# check all violation... |
1424a97d79f2e9e8cfbcad1e1c000d256307a7fe99d3d97552f554645366f42c | Python | 5,230 | 160 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from cogdl.utils import spmm
from cogdl.data import Graph
class History(torch.nn.Module):
r"""A historical embedding storage module."""
def __init__(self, num_embeddings: int, embedding_dim: int):
super().__in... |
4cb0a2f1f858aa6bd21425c75aa2ebba7dc59d22dba1c9c695df68a9feb7462d | Python | 5,230 | 114 | # -*- 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
# get the path to the data of the respective figure or movie
# the data is in the data folder in a folder with the same
# name as the folder that t... |
59aaf414d169602533de31b42123fcab0fe2696a6930657bea0c091788dd653d | Python | 5,230 | 154 | # -*- coding: utf-8 -*-
"""
Topology2d
==========
Defines basic 2d discrete topology utils.
"""
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE.txt)'
__copyright__ = 'Copyright © 2020 by Christoph Kirst'
__webpage__ = 'http://idisco.... |
bbd4a9745da27cf274d241847a20cdf33dfbd0d57b53243fb36a9fb249b73870 | Python | 5,230 | 147 | # 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... |
f444a5b0a4fa2c817b015df84741422f7c4c3596ef75366514910e62f0eb072b | Python | 5,230 | 158 | """Private anndata pytest plugin.
This file exists
1. to allow ignoring warnings without test collection failing on CI
2. as a pytest plugin/config that applies to doctests as well
It lives outside of the anndata package in order to avoid importing anndata too early.
"""
from __future__ import annotations
import re... |
149caec73739785dbd7f65333a7366a5e0de0eec40b625be76634520d672130d | Python | 5,232 | 89 | # 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... |
15e29ce4ac52dc1be40dd62a8b767f6a3f2de190f7232addb130789b29e332bf | Python | 5,233 | 134 | # -*- coding: utf-8 -*-
"""
Converts point data into voxel image data for visulaization and analysis
"""
#:copyright: Copyright 2015 by Christoph Kirst, The Rockefeller University, New York City
#:license: GNU, see LICENSE.txt for details.
import numpy
import math
import pyximport;
pyximport.install(setup_args={"incl... |
ba2012a0a32f16b98845df1d35a347458e4a58bbd65319d48e01a4b5aeb55cef | Python | 5,234 | 140 | # -*- coding: utf-8 -*-
"""
LightsheetCorrection
====================
Module to remove lightsheet artifacts in images.
"""
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE.txt)'
__copyright__ = 'Copyright © 2020 by Christoph Kirst'
__we... |
fbb3abc26d6fb7fd90a51898d3bdbe85f8e9801d9544277d2e695424499a7af4 | Python | 5,237 | 114 | '''
Created on Aug 7, 2020
@author: voodoocode
'''
import numpy as np
import matplotlib.pyplot as plt
import finnpy.cfc.pac as pac
import csv
def generate_high_frequency_signal(n, frequency_sampling, frequency_within_bursts, random_noise_strength,
offset, burst_count, burst_len... |
f8af4b48e6ca6a0ea23012719306452452ce86c636b3964c1785274eb0e07506 | Python | 5,239 | 135 | #!/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
import numpy as np
from ax.adapter.transforms.metrics_as_task import Metric... |
f3e6229fa0d164ba66aa721c26dc5db248d0876770d75f8496d487ff23dca489 | Python | 5,245 | 163 | """Implementation of PCA with data-driven variance explanation limit"""
import warnings
import numpy as np
from kneed import KneeLocator
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.decomposition import PCA
from divik.core import configurable
def knee(explained_variance) -> int:
"""Find... |
0b31ce7394d6d045e930bd0d175361859e783b1b58a000995dcb76f6da8a4cf1 | Python | 5,247 | 141 | # Authors: Nicholas C. Firth <ncfirth87@gmail.com>
# License: TBC
import numpy as np
from matplotlib import pyplot as plt
colors = ['C{}'.format(x) for x in range(10)]
def greedy_ascent_trace(greedy_dict):
fig, ax = plt.subplots()
for key, value in greedy_dict.items():
scores = [x.score for x in valu... |
d08f77547d5297f164854c03714809e52fc180d51ac26a560956631406c09dac | Python | 5,250 | 130 |
import pandas as pd
from uff.ic.mell.sentimentembedding.utils.datawrangling_utils import DataWrangling
from uff.ic.mell.sentimentembedding.datasets.dataset import DataSet
from ekphrasis.classes.preprocessor import TextPreProcessor
from ekphrasis.classes.tokenizer import SocialTokenizer
from ekphrasis.dicts.emoticons i... |
9e7af16333f38ae0f01aebc9385ccb99608c2be34782762017ef417d46bc1cca | Python | 5,252 | 102 | from copy import deepcopy
from collections import defaultdict
from typing import List
import pandas as pd
import numpy as np
import re
from pymatgen.analysis.phase_diagram import PhaseDiagram, PDEntry
from pymatgen.core.composition import Composition
from pymatgen.core.periodic_table import Element
from rlmolecule.c... |
01f51aec64ef7b4517e9039d045e98322a66a3e80a8720aee9a4fc38249ff307 | Python | 5,254 | 186 | import math
import pytest
import networkx as nx
np = pytest.importorskip("numpy")
pytest.importorskip("scipy")
class TestEigenvectorCentrality:
def test_K5(self):
"""Eigenvector centrality: K5"""
G = nx.complete_graph(5)
b = nx.eigenvector_centrality(G)
v = math.sqrt(1 / 5.0)
... |
6b109b0e7b2681eb5a73b19c7faf7519ff0728df7988ae625e7ce1903493ec93 | Python | 5,256 | 137 | #!/usr/bin/env python3
# -*- 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 Licen... |
ae6557836076529f55ed161038087b8e82d3da16b305cb03434832e931003391 | Python | 5,260 | 149 | import importlib.resources as resources
import gc
import os
from functools import partial
import numpy as np
import tensorflow as tf
from learnMSA.model.context import LearnMSAContext
from learnMSA.protein_language_models import common
from learnMSA.protein_language_models.bilinear_symmetric import \
make_scoring... |
61168357f6467db889166f8532f0c3dadbc774f11ecb839e0539ccafe14002fd | Python | 5,262 | 134 | # -*- coding: utf-8 -*-
"""
Converts point data into voxel image data for visulaization and analysis
"""
#:copyright: Copyright 2015 by Christoph Kirst, The Rockefeller University, New York City
#:license: GNU, see LICENSE.txt for details.
import numpy
import math
import pyximport;
pyximport.install(setup_args={"incl... |
0dabc2b6b25f47b32c9e1967cbd52fd1808d12b4c7d3ef29a22d1c79a50d8d5e | Python | 5,264 | 159 | import os
import logging
import sys
import torch
import numpy as np
from sklearn import preprocessing
from sklearn.linear_model import LogisticRegression
from sacred import Experiment
from sacred.observers import FileStorageObserver, MongoObserver
from sacred.utils import apply_backspaces_and_linefeeds
from sklearn.... |
3cd3c9bd4d6a11a0f3dfda65e689100a0c109d0134a42cb40c9dbe7f27bf5f84 | Python | 5,269 | 169 | #TODO: integrate fully in ClearMap
__author__ = 'Sophie Skriabin, Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE.txt)'
__copyright__ = 'Copyright © 2020 by Christoph Kirst'
__webpage__ = 'http://idisco.info'
__download__ = 'http://www.github.com... |
9454ecddb9f03abbafa5b87c3d9d8c5d82a5306e850ff30e31b5e788d09f11fd | Python | 5,269 | 129 | from math import fabs as fabs
from math import floor as floor
from math import sqrt as sqrt
from scipy.special import erfc as erfc
from scipy.special import gammaincc as gammaincc
class FrequencyTest:
@staticmethod
def monobit_test(binary_data:str, verbose=False):
"""
The focus of the test is ... |
424c56478e0bb89096585f43963e1076f66e9863e5e311bbf72346d2575d6565 | Python | 5,270 | 102 | # -*- coding: utf-8 -*-
from figureflow.figure import Figure
import seaborn as sb
import os
input_folder = os.path.dirname(os.path.abspath(__file__))
figure = Figure(input_folder,number=2, dpi=600, width=5)
figure.create_panel("A",increase_size_fac=1, hor_alignment="left",
padding=[0.... |
df2bebcce4895f3cbdc1028a5aa6ff08688042b3689e9f02fd4241d731a12e63 | Python | 5,271 | 167 | import argparse
import os
import numpy as np
import math
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
import torch.nn as nn
import torch.nn.functional as F
i... |
e80e2eb993b41e9182e945f2ed7c227e706c6888883c1b91e1bc16b00c849aa6 | Python | 5,272 | 131 | """
Module responsible for the combination of different annotation files.
An annotation file is a volumetric nrrd file (voxellized 3D image) whose
voxels are 'annotated', i.e., voxels are assigned integer identifiers defining brain regions.
The hierarchy of brain regions and their identifiers are described in the onto... |
b96f47e6ce928174de17a38b90c1f47e2166ec142691e6b4095e2e4b2cf092e8 | Python | 5,273 | 109 | # 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... |
f246e94b5be6074df0e10ff43b35dd205dd56c5aae42e3e12bddf4e54de44583 | Python | 5,273 | 122 | # -*- coding: utf-8 -*-
"""
Daily top-up for the use-case pages, run by CI before the generators:
* institutions new to the sheet are geocoded (geocode_institutions.main(fill=True)) and written
into institution_coords.py, so they appear on the globe the same day;
* country strings none of the lists recognise are loo... |
e56fd1b539846b9d93fc7b5a2a85f7f5ca996558bfa2f1aab1ac29ed110d17c7 | Python | 5,275 | 142 | """Functions related to graph covers."""
from functools import partial
from itertools import chain
import networkx as nx
from networkx.utils import arbitrary_element, not_implemented_for
__all__ = ["min_edge_cover", "is_edge_cover"]
@not_implemented_for("directed")
@not_implemented_for("multigraph")
@nx._dispatcha... |
98ba34529f58460935f63ca399e97b568dc3d584ac16bec017ba83dd56ab97de | Python | 5,277 | 176 | # import os
# import argparse
# import json
# import webbrowser
#
# import numpy as np
# import neuroglancer
#
# from funlib.persistence import Array, open_ds, prepare_ds
# from funlib.geometry import Roi, Coordinate
# import daisy
# from funlib.show.neuroglancer import add_layer
#
#
# parser = argparse.A... |
3225c67db2078711a9447f3185c39c07a8f3689f546b873d79f70e30e4a3cec6 | Python | 5,278 | 130 | from glob import glob
from nilearn.image import resample_to_img, resample_img
from nilearn import datasets, plotting
import matplotlib.pyplot as plt
import nibabel as nib
import numpy as np
import os.path as op
import os
def get_imlist(images):
'''
Search for the list of images in the repository "images" that ... |
176bfabdda480cd863154ab14a2de3adb914738c0ab026b25f671fd6e063e6ea | Python | 5,280 | 121 | # -*- 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=5,dpi=600,width=5)
figure.create_pa... |
50c69058a064399d19802f311ade5f5c4cfc38bd6b830623b76cca6ca12aa1f2 | Python | 5,282 | 160 | import networkx as nx
__all__ = ["average_neighbor_degree"]
@nx._dispatchable(edge_attrs="weight")
def average_neighbor_degree(G, source="out", target="out", nodes=None, weight=None):
r"""Returns the average degree of the neighborhood of each node.
In an undirected graph, the neighborhood `N(i)` of node `i`... |
a151ab6cedd25e243e9c6883ddb65a09849c07e9913c1118af40f3103a220b00 | Python | 5,282 | 140 | import numpy as np
import random
import sys
import math
## Placing the bead in the brush
# System info
spacing = 3.5
charge = -1
T = 3
# Number of files out, etc.
Nfiles = 1000
seed = 23
# Technicalities: Placement of bead
tol = 0.2 # The closest we'll allow the bead to be to a brus... |
ff3dbc2e9d117ba728ff0d044afce2196f165ce1bc65557c252c5041741ee1df | Python | 5,282 | 115 | """
Workflow report agent for generating markdown reports from Galaxy workflows.
"""
import logging
from pathlib import Path
from typing import Any
from galaxy.model import Workflow
from .base import (
AgentResponse,
SimpleGalaxyAgent,
)
log = logging.getLogger(__name__)
class WorkflowReportAgent(SimpleGal... |
c987cf06369d5493d64045352038f34f2b7b5f3fdb62ccea1c9ee2752db77652 | Python | 5,284 | 168 | import argparse
import os
import numpy as np
import math
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
import torch.nn as nn
import torch.nn.functional as F
import torch... |
d2ead51a15a412bb44c79c0fb38536b3f8d5a5a764af1bd8bb0546fa641d8b65 | Python | 5,287 | 158 |
from operator import mod
from numpy.lib.arraysetops import isin
import torch
from torch import nn
from torch.nn import functional as F
from torch_geometric.nn import NNConv, Set2Set
class GraphNet(nn.Module):
def __init__(self, dim_features, dim_target, model_configs, dataset_configs):
super().__init__(... |
13c6ec891598ef21b49c3a3f6ca1d19f3eaeee0a55495e797493f66bfc1af0d4 | Python | 5,288 | 177 | import gc
from ... import io
class EvalDataset(object):
def __init__(self, *args):
self.vols = []
for arg in args:
if isinstance(arg, EvalDataset):
self.vols.extend(arg.vols)
elif isinstance(arg, EvalVol):
self.vols.append(arg)
... |
9b6edb0c48a56c5b46baf087307dd571b24c38b073d3a4b2f2e0bb678f8a93d0 | Python | 5,288 | 122 | """
Select train, validation and test sets
"""
import random
from collections import namedtuple
from collections import Counter
from typing import List, Union, Optional, Tuple, Dict,NamedTuple
from sklearn.model_selection import train_test_split
# namedtuple to reorder datasets based on 'exlusive_on' attribute
VarIdSe... |
fb8093cf5fdc653ab888241a325cef6bf2b4e68f8ce12db0632a59f5823769cd | Python | 5,293 | 126 | #### All original code is copyright of Graham King, Trinity College Institute of Neuroscience.
###Step1: Loading predicted SNR-Headposition txt files and saving as numpy array
###Step2: Loading BOLD fmri txt files, removing QC ROIs, filtering, determining the functional connectivity (first order pearson), and saving a... |
bde710098f11cae4111a2bf0c8c495b111c3906759ca349e60cbb9d18c6db41f | Python | 5,296 | 155 | # 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.adapter.base import Adapter
from ax.analysis.analysis import Analysis
from ax.analysis.graphviz.graphviz_analysis imp... |
8f221fdc9633691438aeaf3056701b5e1efc4b8bfeccfc1cf3c46b17f24da3e0 | Python | 5,297 | 159 | # 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... |
12026c5fdcf69715890a917934f6d811b1341880136b30a6823ef015878e6c33 | Python | 5,298 | 146 | import pytest
import networkx as nx
import networkx.algorithms.approximation as approx
def close_cliques_example(d=12, D=300, h=24, k=2):
"""
Hard example from Harb, Elfarouk, Kent Quanrud, and Chandra Chekuri.
"Faster and scalable algorithms for densest subgraph and decomposition."
Advances in Neura... |
9c379c0b7bc91d975772a928679115b099a18f2f045f54783b2cdd2ab969a755 | Python | 5,302 | 158 | # 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... |
924dc5f3fe5c6b3a2521e48bfde0dd673435e5a0776f99476b379ff6433534dc | Python | 5,303 | 198 | """
Utilities for generating random numbers, random sequences, and
random selections.
"""
import networkx as nx
from networkx.utils import py_random_state
__all__ = [
"powerlaw_sequence",
"is_valid_tree_degree_sequence",
"zipf_rv",
"cumulative_distribution",
"discrete_sequence",
"random_weight... |
577865eb766994e822e67ffeeddfa692ad48f5ebb0ffcbb39d4ec685cb8d4594 | Python | 5,304 | 112 | """Functions to compute the overall mouse brain cell density.
"""
from __future__ import annotations
import numpy as np
from atlas_commons.typing import AnnotationT, BoolArray, FloatArray
from voxcell import RegionMap # type: ignore
from atlas_densities.densities import utils
from atlas_densities.densities.cell_coun... |
be48ae5809733e8166d4051c714f8975901133788bee0706a1f66e0918e44b8b | Python | 5,304 | 166 | import numpy as np
import matplotlib.pyplot as plt
import math
from scipy.optimize import minimize
from scipy.ndimage import binary_erosion
import tensorflow as tf
def getCoeffs(curve,t,numcoeffs):
re = curve[:,0]
im = curve[:,1]
irange = int((numcoeffs-1)/2)
i = np.array([int(x) for x in np.linspace... |
ed564f24bec13943d1b8d8b4f3262d95f92e77f26eaca65ba18b5d584b5aee02 | Python | 5,305 | 134 | import numpy as np
import pandas as pd
import os
import csv
import scipy
import torch
import torch.nn as nn
from torch_geometric.data import Data, Batch
from torch_geometric.nn import graclus, max_pool
from sklearn.preprocessing import StandardScaler
from sklearn.impute import SimpleImputer
from scipy import... |
b8f0c7dda38839a4edd503f2ac2676ef36b7f18f3875c77ab1a6cb9028badd00 | Python | 5,306 | 168 | import json
from copy import deepcopy
from pathlib import Path
import numpy as np
import pandas as pd
import pytest
import yaml
from numpy import testing as npt
from pandas import testing as pdt
from voxcell import RegionMap, VoxelData # type: ignore
from atlas_densities.densities import mtype_densities_from_composi... |
ff9bf6c3e259bd33d22c70cc10f4fa79270bf50c4c285af97e0a7392199e2483 | Python | 5,307 | 127 | from __future__ import annotations
import os
from functools import partial
from importlib.metadata import version
from typing import TYPE_CHECKING
import legacy_api_wrap
from legacy_api_wrap import legacy_api
from packaging.version import Version
from scanpy.get import obs_df
if TYPE_CHECKING:
import numpy as np... |
11be0bcbc5e1f71fbaed4df3c67fa8470e2f50cd3093719dac318c2165358b7b | Python | 5,318 | 164 | import numpy as np
from natsort import natsorted, ns
import matplotlib as mpl
#mpl.use('Agg')
import matplotlib.pyplot as plt
import os, fnmatch
import re
print('imported')
def find(pattern, path):
result = []
for root, dirs, files in os.walk(path):
for name in files:
if fnmatch.fnmatch(na... |
cafb2edbfcc3d7cfe7d78e5beca58474a4d91d11ec60ab7c9b3ec734726cf53a | Python | 5,318 | 161 | from pathlib import Path
import tensorflow as tf
import numpy as np
import os
SCORING_MODEL_PATH = "scoring_models"
PRIOR_DEFAULT_COMPONENTS = 32
class ScoringModelConfig():
def __init__(
self,
lm_name="protT5",
dim=16,
activation="sigmoid",
use_aa=False,
scaled=F... |
354c4c15498ad8285ea28b17a837ba8128f745b3e4b9ff011f34c0044d596854 | Python | 5,323 | 141 | from meld_classifier.paths import BASE_PATH, EXPERIMENT_PATH, MELD_DATA_PATH
from meld_classifier.meld_cohort import MeldCohort, MeldSubject
from meld_classifier.data_preprocessing import Preprocess, Feature
import os
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import nibabel as nb
import GPy... |
ae81beccf1eeec839620d95ef088af7bc61a3e13505eb21ae3f814cae7b49bce | Python | 5,323 | 163 | import torch
import math
import torch.nn as nn
import torch.nn.functional as F
import scipy.sparse as sp
import numpy as np
# from sklearn.preprocessing import normalize
import random
# from transformer.Layers import EncoderLayer ####
from torch_geometric.nn import GINConv, JumpingKnowledge, global_mean_pool, SAGEConv... |
b10db89ed276f9e1fd19af70291b774695456d68fee4423d819fdf9a0ae43854 | Python | 5,323 | 131 | """
Created on Jun 3, 2025.
@author: voodoocode
"""
import threadpoolctl
import os
import numpy as np
import matplotlib.pyplot as plt
import finnpy.file_io.data_manager as dm # @UnresolvedImport
import finnpy.src_rec.sen_cov # @UnresolvedImport
import finnpy.src_rec.coreg # @UnresolvedImport
import finnpy.src_rec... |
97be1fd484f0833d8c53c5a086f1599c00e75fd61974da022a8ccaec843b82b2 | Python | 5,325 | 110 | import numpy as np
import common
import slowwavemodel
class SlowwaveReactivationDecrease(slowwavemodel.Slowwave):
"""
Used for the task simulation in which reactivation decreases
"""
def __init__(self, epoch_length, epoch_number, pre_w_initial, reac_state, reac_neuron, reac_rate, wake_epoch_numbe... |
f7b3f5f817e7b91d038c950e1c2a3ff894c0ec753e7438cceab72b788c2fc46d | Python | 5,326 | 123 | from typing import (
Annotated,
Any,
Optional,
)
from pydantic import (
ConfigDict,
Field,
)
from galaxy.schema.schema import Model
# Schema manually typed from https://docs.discourse.org/
# Discourse has an OpenApi schema (https://docs.discourse.org/openapi.json)
# but at the time of writing it ... |
8c62581bc70ff1121ac1c7ccfb147a159eed2935444b5996d78a5807c2fccebc | Python | 5,327 | 138 | """Export snapshot / converted format files are removed from storage when their rows are deleted."""
import logging
import os
from unittest import mock
import pytest
from data_export.models import ConvertedFormat, DataExport, Export
from django.core.files.base import ContentFile
from django.core.files.storage import ... |
111ace884bbd22d4848debf39b64bd313e632cb4bfd77ecfaeada15a6be7440d | Python | 5,329 | 158 | ###########################################################
# Adapted from: https://github.com/bagustris/deep_mlp_ser #
# (by Bagus Tris Atmaja, Masato Akagi) #
###########################################################
#%tensorflow_version 1.x
import numpy as np
import pickle
import pandas as p... |
bcba642311b52cc53f48798e73a52d3ae66e35aadb8366bbcd319719cd8fa82b | Python | 5,329 | 181 | """Trophic levels"""
import networkx as nx
from networkx.utils import not_implemented_for
__all__ = ["trophic_levels", "trophic_differences", "trophic_incoherence_parameter"]
@not_implemented_for("undirected")
@nx._dispatchable(edge_attrs="weight")
def trophic_levels(G, weight="weight"):
r"""Compute the trophic... |
51a6198453517a24c2f9e6ff614a58e59382dea2a77e574c8a73cd99590b2414 | Python | 5,331 | 155 | #!/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 typing import Any
impor... |
e6b9ba7dc552980d40757b53d95ae7b984b3f197128355947c1ce4ad5c24b8da | Python | 5,331 | 144 | #!/usr/bin/env python
#
# Copyright (c) 2018 10X Genomics, Inc. All rights reserved.
#
import os
import cellranger.library_constants as lib_constants
from cellranger.feature_ref import FeatureDef, FeatureReference
def save_features_bed_path(feature_ref, fullpath):
base_dir = os.path.dirname(fullpath)
filename... |
d64004c4b9b27ad2cfc1b89f55639ea386679d89e99dd11450693bf95a05dee5 | Python | 5,332 | 151 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Readers for the pke module."""
import logging
import spacy
from pke.data_structures import Sentence
# https://spacy.io/usage/linguistic-features#native-tokenizer-additions
from spacy.lang.char_classes import ALPHA, ALPHA_LOWER, ALPHA_UPPER
from spacy.lang.char_classe... |
cb6e29b10f2ae7e338842243fb4da6bc5fbcded9ba4cdc8085f060e872ef7d8a | Python | 5,337 | 170 | # tbc...
import pandas as pd
import numpy as np
import glob
import os
import matplotlib.pyplot as plt
from scipy import stats
import pingouin as pg
import statsmodels.api as sm
from labellines import labelLine, labelLines
import seaborn as sns
### SWITCHES:
full=True
split=False
# Load arrays:
if full:
withinfc=... |
21c4caddc94bb3099c752885d8a64409eb8dd88ad51a6515594bf0cd07df6692 | Python | 5,338 | 134 | # 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 pandas as pd
from ax.analysis.plotly.parallel_coordinates import (
_get_parameter_dimension,
ParallelCoordinat... |
a177601c86571b95bdd8ef037152d7f366119189454afbffe1d57d8cb305d6ba | Python | 5,339 | 210 | """
Module that handles FAN-C configuration files.
Generally, some FAN-C behaviour can be controlled using a "fanc.conf"
file in one of the following locations, in order of preference:
1. fanc.conf in current directory
2. File specified by environment variable fanc_CONF
3. fanc.conf in home folder
4. .fanc.conf in ho... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.