sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1c0adad25bbc1c70e1427a5b2c8a1a13cb1dff270ceaa6e335160a60d823cd0a
Python
5,694
153
import torch from .. import ModelWrapper import numpy as np import warnings class STGCNModelWrapper(ModelWrapper): def __init__(self, model, optimizer_cfg, **args): super(STGCNModelWrapper, self).__init__() self.model = model self.optimizer_cfg = optimizer_cfg self.edge_index = tor...
13ef49fa401a527efa58c6783e9cca5313380b7ca363b9a8a4ea5b3c8cb70eca
Python
5,700
156
"""The match_hostname() function from Python 3.3.3, essential when using SSL.""" # Note: This file is under the PSF license as the code comes from the python # stdlib. http://docs.python.org/3/license.html import re import sys # ipaddress has been backported to 2.6+ in pypi. If it is installed on the # system, us...
1f62cbfe898989c3d1dbba35139591750fd59b26b4b81d8d0a5651106da87618
Python
5,707
137
# 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...
977aaf1f0bbf3d006fa9f6d2ff40777ac98145cafab51d4708a00932003dd893
Python
5,707
145
""" Advanced example: querying the literature with brain maps ========================================================= In this example, instead of providing a text query to find related brain regions, we provide a brain map and discover which terms or studies in the literature are associated with similar activation p...
ec443bb97f349b4dcec40adee339470ff9353eca6aa05d7f69f01513f3cb15c3
Python
5,708
123
import unittest, os, sys, numpy as np, h5py, importlib sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from bsb.core import Scaffold from bsb.models import Layer, CellType from test_setup import get_test_network def relative_to_tests_folder(path): return os.path.join(os.path.dirname(__file__), ...
dbc04b2b39e97229563d21900d9dcaccd43af477895ec056266e0c4f0bb274ba
Python
5,713
178
from __future__ import annotations from collections.abc import Mapping, Sequence from types import MappingProxyType from typing import TYPE_CHECKING, Any, Literal import pandas as pd from anndata import AnnData from scanpy import logging as logg from squidpy._compat import old_positionals from squidpy._docs import d...
e5f444f89498fe1a002e139165360e096d273db0962e80e72b6614e5cbaf2d11
Python
5,716
200
from typing import Union, Callable import numpy as np import warnings import torch import torch.nn as nn from sklearn.metrics import f1_score def setup_evaluator(metric: Union[str, Callable]): if isinstance(metric, str): metric = metric.lower() if metric == "acc" or metric == "accuracy": ...
d059b71f2d9a180cbd98a5fc740c7d2035514246347a7bedb23136b7d188582e
Python
5,719
205
""" ######################################################################################################### Author: Álvaro Fernández García Date: 4 - Junio - 2019 Description: Entrenamiento y validación de modelos entrenados en imagenet y aplicados a la detección de las Glándulas. ###################################...
f99152f77da7e9afd46b00eb59c90f07ecfb4c02b289543721049ff439aa1420
Python
5,723
145
""" Copyright © 2025 Howard Hughes Medical Institute, Authored by Carsen Stringer , Michael Rariden and Marius Pachitariu. """ from qtpy.QtWidgets import QAction from . import io def mainmenu(parent): main_menu = parent.menuBar() file_menu = main_menu.addMenu("&File") # load processed data loadImg = Q...
7bd90116f4ce8ad82a47b2e3d007746793fe366c5ceb3763719379a64e9097aa
Python
5,724
135
#!/usr/bin/env python # -*- coding: UTF-8 -*- from __future__ import print_function """ python {} study.file population.file gene-association.file This program returns P-values for functional enrichment in a cluster of study genes using Fisher's exact test, and corrected for multiple testing (including Bonferroni, Ho...
60682eb2f17f4ae08d0fb87b3f5f9c6f62bc5cd2b1219420fb07d8ead21adb2f
Python
5,725
155
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Postprocessing functions, used for interpretation of fitted models Created on Wed May 19 10:03:53 2021 @author: townesf """ import numpy as np from copy import deepcopy from pandas import DataFrame from utils.misc import t2np,nan_to_zero from utils.nnfu import norma...
ab339a25812c38636ac5a985fcc61ec900f88b78cfed17aad9c24e202ee9170a
Python
5,726
155
from collections.abc import Sequence import numpy as np from pydantic import BaseModel, ConfigDict, field_validator from .util import NPArray class LanguageModelConfig(BaseModel): """Protein language model integration parameters.""" model_config = ConfigDict(arbitrary_types_allowed=True) use_language_...
9ced880667cfede73586f82658c50807f422aa1c801d9199ed20d1a3214eeb77
Python
5,730
104
''' CUDA_VISIBLE_DEVICES=2 python Train_Test_Examples.py --model_name GraphSAGE \ --data_path ../dataset/BBBP/BBBP.csv \ --dataset_name BBBP \ --smiles_col smile...
02c657fdbe6321668489c244b17bf05ccca58910861a37df1f10caedc65fcfe6
Python
5,731
169
from __future__ import print_function, unicode_literals, absolute_import, division import numpy as np import warnings from skimage.measure import regionprops from skimage.draw import polygon from csbdeep.utils import _raise from ..utils import path_absolute, _is_power_of_2, _normalize_grid from ..matching import _che...
8f1d5aa93a1844f90103239683d697851ff075f658fad5165243bbb4e68c02f9
Python
5,735
165
"""Dataset setting and data loader for MNIST-M. Modified from https://github.com/pytorch/vision/blob/master/torchvision/datasets/mnist.py CREDIT: https://github.com/corenel """ from __future__ import print_function import errno import os import torch import torch.utils.data as data from PIL import Image class MN...
55d7d1aa283165c4c78047d44cb07b7aeb4701a0c50a6cb597bfc1da25c4d630
Python
5,736
167
# 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...
624d44aa760bbd14227caa062f06bc89b0f9e01151b7cca9350c6fae5ca6dc9b
Python
5,736
238
import math from functools import partial from typing import Optional import torch from ..autograd import _higher_order_grad, _save_for_higher_order from ..layout import _fake_empty_like from ..validation import _check_gradients, _check_inputs def _check( x: torch.Tensor, v: torch.Tensor, w: torch.Tenso...
c0181c070bfd6c97a36b2a776b631a67b9ce56833fb91002292fcd05b61e8f1b
Python
5,738
132
# -*- 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...
c38653c3a4199bfc55edd10025f596624d7e10a1477b00e2c365860b855048f8
Python
5,739
123
import os import numpy as np import pandas as pd from src.utils import get_parcelwise_average_surface import wget import nibabel as nib from src.utils import load_schaefer_parc, load_glasser_parc from sklearn.metrics import pairwise_distances class BrainMapLoader: def __init__(self, computer='macbook', parc='schae...
7aa868e8eeab2c668b60eabc8ae5682da8fad9d27c6cd4431054e5cccef1c32d
Python
5,741
135
#!/usr/bin/env python # 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 # "L...
93400c43d1996bc333df29239083677f2cd0557b3d5db26f5a5c2ff39fea8804
Python
5,741
197
# -*- coding: utf-8 -*- """ MultipleComparisonCorrection ============================ Correction methods for multiple comparison tests. """ __author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>' __license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE.txt)' __copyright__ = 'Copyright © 2020 by Chri...
fffd6a5d84b1cf246a695b4388510b1e6acf555c7ec9ab57d6551d3ec0d85434
Python
5,744
118
#!/usr/bin/env python # # Copyright (c) 2019 10x Genomics, Inc. All rights reserved. # import martian import math import os import cellranger.analysis.constants as analysis_constants import cellranger.matrix as cr_matrix from constants import ALLOWED_FACTORIZATIONS, DEFAULT_FACTORIZATION __MRO__ = """ stage ANALYZER_...
8d3e263fbece6ac84feb4e736db237084d27a719493c639ffefd6cdf5b352447
Python
5,745
127
import matplotlib.pyplot as plt from matplotlib.pyplot import MultipleLocator r"""lr vs coeff""" plt.xlabel("lr") plt.ylabel("coeff") x = [1, 2, 3, 4, 5, 6, 7, 8] x_index = ['0.00005', '0.0001', '0.0002', '0.0005', '0.001', '0.005', '0.01', '0.02'] # std V: [0.028, 0.008, 0.005, 0.013, 0.012, 0.005, 0.005, 0...
f0eedd37bafdf2f5adeb15011f5a52c61e98e01b149457770f4be5c957882236
Python
5,747
142
import os import shutil import tempfile import unittest import numpy as np from bsb import MPI, Configuration, Scaffold, read_results from bsb.simulation.results import iter_recordings from bsb_test import ( NumpyTestCase, RandomStorageFixture, get_test_config, get_test_config_tree, ) def _population...
8e6d794a9d1f1530f456bc181e22e321958b0c7ad93963de46b4df66c5f450bd
Python
5,750
162
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ CellMap ======= This script is the main pipeline to analyze immediate early gene expression data from iDISCO+ cleared tissue [Renier2016]_. See the :ref:`CellMap tutorial </CellMap.ipynb>` for a tutorial and usage. .. image:: ../Static/cell_abstract_2016.jpg :t...
c3a6ae53387e163092c65ad029af1ed50949cfcb37c847da5f8ae266ae0fbbbb
Python
5,755
151
""" Copyright (c) 2019 10x Genomics, Inc. All rights reserved. Perform normalization of libraries """ # Imports import pickle import json import os import pysam from pybedtools import BedTool from tools.io import merge_keyed_bed, subsample_fragments from tools import ReferenceManager import cellranger.io as cr_io i...
822e35236b923999b2358ec6bcfd38ea6d76d6a9b48f3ce12119244fb64fc9ea
Python
5,756
189
import sys import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from sklearn.mixture import GaussianMixture from scipy import stats def quantile_norm(X): """ Normalize the columns of X to each have the same distribution. Given an expression matrix (microarray data, ...
02c12112ef1913f4eb21db622dae63077768d802c6be75aac7d6dfce24152f00
Python
5,757
169
import collections from typing import AbstractSet import problog.core import problog.logic import problog.program import problog.sdd_formula from nl_expr.expressions import Constant, FunctionApplication, Symbol from ...relational_algebra import ( NamedRelationalAlgebraFrozenSet, str2columnstr_constant, ) from...
b5e30082337dc94fc1cf81e34bb9f0d300b88fd7534d7e4afe563b805775681f
Python
5,758
144
import numpy as np import random import sys import math ## Placing the bead in the brush # System info radius = 1 spacing = 4.5 charge = -1 T = 3 # Number of files out, etc. Nconfigs = 100 Nplacements = 10 Nfiles = Nplacements seed = 23 # Technicalities: Placement of bead tol ...
42c050890938bcc9d70f9bbc7db7fc7b191bca342dc43f7b8ecd68560a6b8b29
Python
5,759
171
# 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 agre...
3c0789ed8b7c914a9b0e0bc16b3fd97d415983ec3ebdfd603c2d073ba828fd32
Python
5,762
142
"""Time dependent algorithms.""" import networkx as nx from networkx.utils import not_implemented_for __all__ = ["cd_index"] @not_implemented_for("undirected") @not_implemented_for("multigraph") @nx._dispatchable(node_attrs={"time": None, "weight": 1}) def cd_index(G, node, time_delta, *, time="time", weight=None):...
5a49bc4599e814552a15d36fc863ac532cf6ef181de0a8abcc83c9ab8244ff29
Python
5,763
148
import numpy as np import nibabel as nb import os import h5py def load_mgh(filename): """ import mgh file using nibabel. returns flattened data array""" mgh_file=nb.load(filename) mmap_data=mgh_file.get_data() array_data=np.ndarray.flatten(mmap_data) return array_data; def import_mgh(filename): ...
f7ebb829f7dec4f3049b9dab4da22310ec6c0807760cc072c73bf91f9eba40bc
Python
5,763
158
"""Build wheels/sdists by installing build deps to a temporary environment. """ import os import logging from pip._vendor import pytoml import shutil from subprocess import check_call import sys from sysconfig import get_paths from tempfile import mkdtemp from .wrappers import Pep517HookCaller log = logging.getLogge...
2d98a187bd3ae50ddc5501446720e30ffd551f2222cee13a7f335fd1cd8dfe04
Python
5,764
230
import os import unittest import numpy as np import numpy.testing as npt from parameterized import parameterized from sklearn.datasets import make_blobs import divik._matlab_legacy as ml def no_threshold(): np.random.seed(0) return np.random.randn(500) def single_th_between_0_and_100(): np.random.seed...
a595a7ddfe8d098fa51ad562290875d4d2790a7f9c5c12a1bda70cc9c837f38e
Python
5,764
188
import importlib import importlib.util import inspect import os import sys import types __all__ = ["attach", "_lazy_import"] def attach(module_name, submodules=None, submod_attrs=None): """Attach lazily loaded submodules, and functions or other attributes. Typically, modules import submodules and attributes...
df88a30e0d00e7f0608c06f30012734eef46f69d3f79e29682aba613a0438df3
Python
5,764
165
# -*- coding: utf-8 -*- """ GraphVisual =========== Module providing Graph visuals for rendering graphs. Note ---- This module is porviding vispy visuals only. See :mod:`PlotGraph3d` module for plotting. """ __author__ = 'Christoph Kirst <ckirst@rockefeller.edu>' __license__ = 'MIT License <http://www.opensourc...
61e200f634757232be71dec596aa3032df92f7de7ca58ebd605b7b16d3b6626b
Python
5,766
148
# MIT License # # Copyright (c) 2019 Lucas K Wagner # # 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, modify, merg...
5e79be61f40195d7649c47a7cee044a039b521bb7720b80f09973809be6c1eea
Python
5,769
138
import copy import math import os import random import allennlp import torch from typing import Iterator, Dict, List, Tuple from allennlp.training import Trainer from torch.utils.data import Subset, Dataset from numpy.random.mtrand import RandomState from allennlp.common import util as common_util from allennlp.dat...
b92063c23b343428e8e73407d2693876a76bf6252bec8d5cc5502491b43d39eb
Python
5,769
155
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Postprocessing functions, used for interpretation of fitted models Created on Wed May 19 10:03:53 2021 @author: townesf """ import numpy as np from copy import deepcopy from pandas import DataFrame from spatial_factorization.utils.misc import t2np,nan_to_zero from s...
197965ca448921514e1aff350799e4e98e5972b5f16c3426e4a70aeadc6f1cd6
Python
5,772
145
# -*- coding: utf-8 -*- """ Template to run the processing pipeline """ import os,numpy #load the parameters: runfile('/home/wirrbel/FriendlyClearmap/clearmap/docs/conf.py') from ClearMap import * parameter_filename = '/home/wirrbel/FriendlyClearmap/clearmap/ClearMap/Scripts/example_set/S1_57645/parameter_file.py' e...
2ccfefdc9c95af01fdf997e67914037a02dd6ad6166be817ad3c487756ecdfde
Python
5,772
111
# -*- 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...
774a5a8c551edaa03bd363acf051b5de343a734647876e0322fa23559118d48a
Python
5,772
148
""" Agent registry for managing available AI agents. """ import logging from typing import ( Optional, ) from .base import ( BaseGalaxyAgent, GalaxyAgentDependencies, ) log = logging.getLogger(__name__) class AgentRegistry: """Registry for managing available AI agents.""" def __init__(self): ...
53dcf5f4b7357aa7414289c1fc5c99526312010f55df9cbb8c73ab2ed5bc0f22
Python
5,774
174
# Reference: https://wiseodd.github.io/techblog/2017/03/07/boundary-seeking-gan/ 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 i...
cfe3a5d6263a2cdd532c3d54777f03c565e5e9b08a7f6d95c06f560d469280fc
Python
5,774
150
import logging import numpy as np from sklearn.base import BaseEstimator import divik._matlab_legacy as ml from divik.core import configurable from ._stat_selector_mixin import StatSelectorMixin @configurable class GMMSelector(BaseEstimator, StatSelectorMixin): """Feature selector that removes low- or high- me...
2c4cbc93632ba37a7ace3c0640d1febfb5efdf78c2742afa244e3a09b270b462
Python
5,776
167
#!/bin/python3 # Utility functions for displaying and storing data # Copyright 2021-2023 Jannik Luboeinski # License: Apache-2.0 (http://www.apache.org/licenses/LICENSE-2.0) # Contact: mail[at]jlubo.net import time from datetime import datetime import os import re ###################################################...
f3ac5b8ed01d8c5d1b3c77ea3aeb909544920ce6e720650c38f0fda26f3b454b
Python
5,776
156
__doc__ = """ Independent Implementation of HCBS' Synaptic Partner Candidate Generation See: https://github.com/paragt/EMSynConn/blob/master/vertebrate/candidate/generate_proposals.py """ import numpy as np from scipy import spatial from scipy.ndimage import distance_transform_edt from ... import seg_utils from .. i...
cf152cb81b35fe0f208eeffaa2ab9e5e7c9c2816aee7d4ecaac0f2ed0ed922ba
Python
5,780
166
# -*- coding: utf-8 -*- # Author: Florian Boudin # Date: 09-10-2018 """Kea supervised keyphrase extraction model. Kea is a supervised model for keyphrase extraction that uses two features, namely TF x IDF and first occurrence, to classify keyphrase candidates as keyphrase or not. The model is described in: * Ian Wit...
05e5baa8cec5429814cbe3d84b09b0866ed85b4c3a8facbad477b703d079b8ae
Python
5,782
165
#!/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 "Li...
075361bafcea7215eebf01f3096506586b7e21988810029059a562706a0cc4f4
Python
5,784
114
import logging from galaxy.tool_shed.tools.data_table_manager import ( BaseShedToolDataTableManager, RequiredAppT, ) from galaxy.tool_shed.util import ( basic_util, hg_util, ) from galaxy.tool_util.fetcher import ToolLocationFetcher from galaxy.tool_util.parser import get_tool_source from galaxy.tool_u...
5d2de51b7e30c6bb2d1b53d2fa7f4ca9cc90224326b0e4639a9fa5b627675518
Python
5,786
108
import tensorflow as tf from .generic import * class DataLoaderMidAir(DataLoaderGeneric): """Dataloader for the Mid-Air dataset """ def __init__(self, out_size=[384,384], crop=False): super(DataLoaderMidAir, self).__init__('midair') self.in_size = [1024, 1024] self.depth_type = "ma...
b31cd8d946273e4d591de86667e11c9e179a6af9d6b7b09c83747592f8748a55
Python
5,786
203
"""Tests for the attribute .X""" from __future__ import annotations import numpy as np import pandas as pd import pytest from scipy import sparse import anndata as ad from anndata import AnnData from anndata._warnings import ImplicitModificationWarning from anndata.tests.helpers import ( GEN_ADATA_NO_XARRAY_ARGS...
131916f470a3dd4ca8bcfe197eb4a008801198ede7218db7a3e8cf527d1465fc
Python
5,787
126
from __future__ import print_function import tensorflow as tf from keras import activations, initializers, constraints from keras import regularizers from tensorflow.keras.layers import Layer import keras.backend as K class GraphConvolution(Layer): """Basic graph convolution layer as in https://arxiv.org/abs/160...
981aca00006f08f41558b603015c22464a90af82b088cf1c1849a146a240d7c3
Python
5,787
137
import typing import unittest from itertools import zip_longest import arbor from arborize import Schematic, arbor_build from arborize.builders._arbor import get_decor, get_label_dict, hash_labelset # This import only works when tests are executed from root dir. from tests._shared import SchematicsFixture if typing...
ae32284fbf9aa8ac0648136863180a9e20c582a483c15f07876d659164581951
Python
5,787
155
r"""Computation of graph non-randomness.""" import math import networkx as nx from networkx.utils import not_implemented_for __all__ = ["non_randomness"] @not_implemented_for("directed") @not_implemented_for("multigraph") @nx._dispatchable(edge_attrs="weight") def non_randomness(G, k=None, weight="weight"): ""...
ae6a408b726a52dc40bbb387a2af0c29ff89b7806e630567783b74717fc0e6cb
Python
5,787
160
# 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...
369feab129a84d8d5671ce6aad9563ac3a5326ce7b709f66d93a07b36872852b
Python
5,790
151
from pathlib import Path from scipy.cluster.hierarchy import ward from sklearn.metrics.pairwise import cosine_similarity class MetaClusterData(): """Store the state of the clusters and metaclusters Args: cluster_type (str): the type of clustering being done raw_clusters_df (pd.Da...
8f3b7a929f2960936a075b7f9dff65cf5ba3ca0e42e605aff48d1a0fe16fd3a3
Python
5,791
164
# cluster.py # Authors: Jacob Schreiber <jmschreiber91@gmail.com> # adapted from code written by Avanti Shrikumar import sys import itertools import numpy as np from . import forked # Edges handed to igraph per chunk in _graph (about 1.3 MB of Python ints). _EDGE_CHUNK = 16384 def _leiden(g, weights, seed, n_lei...
342a026c59538e45afdd1962bb2c852dbdc34d1f713354f32b8e984b95961f5b
Python
5,792
173
"""Functions for generating graphs based on the "duplication" method. These graph generators start with a small initial graph then duplicate nodes and (partially) duplicate their edges. These functions are generally inspired by biological networks. """ import networkx as nx from networkx.utils import py_random_state...
0bef7bb61d839566aa460f8abf4862c252252a1d02de4c617a7268927c6c71b4
Python
5,794
195
import matplotlib import matplotlib.pyplot as plt import matplotlib.cm as cm from matplotlib import gridspec import matplotlib.patches as mpatches from sklearn import datasets, linear_model import parmap import numpy as np import os import pickle from sklearn.decomposition import PCA import pycorrelate from tqdm impor...
07ad3c4f348638e952b8f51ca0541d5311cd588d34bf9f224c7b8569a9b8b061
Python
5,796
139
# 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 collections.abc import Iterable, Sequence from typing import final from ax.adapter.base import Adapter from ax.analysi...
a35dacdb49d12edac834a3b733aea73f42e5f67c8ec106869989e382055240f0
Python
5,799
146
#!/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 dataclasses import datetime import enum import math from collections import OrderedDict from co...
68fd21dfa3445ece1eea0affbd97490174d4a9cb9d6cc3aea3c6af777e6893e9
Python
5,801
146
# %% import import sys, os, platform from src.imaging_derivs import DataMatrix from src.pipelines import ComputeMinimumControlEnergy from src.plotting import my_reg_plot from src.utils import rank_int import scipy as sp # %% import workspace os.environ["MY_PYTHON_WORKSPACE"] = 'ave_adj' os.environ["WHICH_BRAIN_MAP"] ...
90ea3e246b975221efe1f6044040e9273ac4e47519d081456dd62b2c1f73a7cb
Python
5,804
157
#!/usr/bin/env python # # Copyright (c) 2017 10X Genomics, Inc. All rights reserved. # from collections import namedtuple, OrderedDict import h5py import cellranger.io as cr_io FeatureDef = namedtuple('FeatureDef', ['index', 'id', 'name', 'feature_type', 'tags']) # Required HDF5 datasets REQUIRED_DATASETS = ['id', '...
c80b019457f99218a152bbbc72d2a41ce92ef6e64b781ad16e8f30a60b8a4a32
Python
5,804
149
import io import pickle import sys import time from tqdm import tqdm from src.gru import * from src.pre_data import * from src.train_and_evaluate import * from src.warmupLR import * import warnings warnings.filterwarnings("ignore") USE_CUDA = torch.cuda.is_available() size_split = 0.8 PAD_token = 0...
50492629a80dc3db23f248940dd6c0798bb3bd9df5a602cc5eace58aa3241bce
Python
5,805
150
"""Distance measures approximated metrics.""" import networkx as nx from networkx.utils.decorators import py_random_state __all__ = ["diameter"] @py_random_state(1) @nx._dispatchable(name="approximate_diameter") def diameter(G, seed=None): """Returns a lower bound on the diameter of the graph G. The functi...
e4e76d065358ba190316f30bc077aa7b87ae6de2e6e375d61c4364e2b1c37a75
Python
5,807
162
# 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 collections.abc import Sequence from typing import Any import torch from botorch.models.model import Model from botorch...
51ff90ca2a3ec85909da7a8182e71894eec45db10246235623c1e161f626b099
Python
5,809
167
import pickle import time from torch.nn.parallel import DistributedDataParallel from tqdm import tqdm from src.S2S_greedy_feedback import * from src.pre_data import * from src.train_and_evaluate import * import os import warnings from src.warmupLR import GradualWarmupScheduler warnings.filterwarnings(...
2d713e1320c8b7cca87fa9bf76bc02f05bcdd030afa657e0f2fc8e2dba4877e3
Python
5,810
150
""" Plot Figure 5 (Lorenceau) """ import numpy as np import strinf as si # # # PARAMETERS # # # ZOOM = 2.0 SAVE = True SHOW = True PANEL = ("C",) lorenceau = { "DSL_low_noise" : "2021-08-26-12-09-10-696387_110_lorenceau_1996_low_noise", "DSL_high_noise" : "2021-08-26-12-07-25-644304_110_lorenceau_1996_high...
7ac10465b0a8173ea43bc3bbea4fd50f840aa94b122bd108a28e553e699b1370
Python
5,810
180
"""Define and provide model RDMs. NOTE: The order in MODELS determines the order of orthogonalization. """ import copy import numpy as np from scipy.spatial.distance import squareform from config import NUMBERS from utils import calc_rdm, eq1, spm_orth MODELS = { "9x9": {"numberline", "extremity"}, "18x18"...
508a4a625dca5dba50fb2189dae8f2ac012e6f316f811dd1b7f9b7ccf02d3a18
Python
5,811
148
import os import click import sys import logging from .job_manager import BatchManager, Job from .config_json_parser import ClpipeConfigParser from .error_handler import exception_handler @click.command() @click.argument("subjects", nargs=-1, required=False, default=None) @click.option( "-config_file", type=c...
5da0809318fdecdc9b2f17473157f97f04e77d6860ffe2c8518d9c95251acb98
Python
5,812
148
import os import click import sys import logging from .job_manager import BatchManager, Job from .config_json_parser import ClpipeConfigParser from .error_handler import exception_handler @click.command() @click.argument("subjects", nargs=-1, required=False, default=None) @click.option( "-config_file", type=c...
2b6d7095f3479dc289ac74d51c6f7d880268f68e7fb1cfed7e6e79b242e53710
Python
5,815
140
# -*- coding:utf-8 -*- __author__ = 'yangjian' """ Denoise Auto-encoder Denosing auto encoders are an important and crucial tools for feature selection and extraction. """ import numpy as np from tensorflow.keras.callbacks import EarlyStopping, ReduceLROnPlateau from tensorflow.keras.layers import Dense, Input from te...
2f31ebae67d72331bf7b9ed1c87bac4d8d0ddbd73f82178879e643489d425dff
Python
5,817
179
import torch import numpy as np from matplotlib import pyplot as plt from matplotlib.ticker import AutoLocator from ..utils.convert_units import freq_to_wl, wl_to_phys_wl from ..utils.compute_spectrum import compute_spectrum from ..training.model.model_to_eps_grid import model_to_eps_grid from ..utils.global_constants ...
75827054c2180da933ed0236aff6ca15e34110631fe4f7d64d03043621397246
Python
5,819
189
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
26a0a049d624d7f8e5953132089e131d644fc5306f63cecc1bc8973ba84869d9
Python
5,820
156
#!/usr/bin/env python ############################################################################### ############################################################################### ## Created on February 1st 2017 to remove singletons from paired-end BAM file ###########################################################...
9085878ed5d49c2cb32d2cd26d97ac510b7c29b832ced06b04085be624449e66
Python
5,820
141
""" Evaluation functions to measure the performance of a given loss function on a given dataset """ import sys sys.path.append('..') from losses.losses import * from misc.utils import * from misc.loaders import * import lightgbm as lgb from sklearn.metrics import * from scipy.special import expit from sklearn.model_...
4f4bd8482574cb7041eb5bd330a50075a29136b233bf87f73a743799e74913dd
Python
5,827
163
from enum import Enum import numpy as np from learnMSA.model.tf.model import LearnMSAModel from learnMSA.util.dataset import Dataset from learnMSA.util.sequence_dataset import SequenceDataset class SelectionCriterion(Enum): POSTERIOR = "posterior" LOGLIK = "loglik" AIC = "AIC" CONSENSUS = "consensus...
c6f6a2372c76d1eea14ab2bf25c02f222338f2c6deddab88b0e2fc18557feeef
Python
5,828
144
""" Copyright (c) 2019 10x Genomics, Inc. All rights reserved. aggregation metrics are devised from final fragments file """ import martian from tools.io import get_counts_by_barcode from tools import ReferenceManager from metrics.generate_metrics import (add_doublet_rate_metrics, add_purity_metrics, add_bulk_target...
1e762514a49a848b10b44b2dc7654d88011c708fe2384b337a15c538d8ec47b9
Python
5,829
155
import numpy as np import sklearn import pytest from himalaya.backend import set_backend from himalaya.backend import ALL_BACKENDS from himalaya.validation import _assert_all_finite from himalaya.validation import check_cv from himalaya.validation import validate_data @pytest.mark.parametrize('backend', ALL_BACKENDS...
5022a53f965fa2d45e025fb70eb2f47be374905003fc48bebb5bd173c69fbf7d
Python
5,831
173
from collections import Counter, defaultdict import numpy as np from scipy.signal import find_peaks, peak_widths from sklearn.cluster import dbscan from scipy.spatial.distance import euclidean def parse_peakachu(fil, thre, res): D = defaultdict(dict) score_pool = defaultdict(dict) with open(fil,...
7f7ba7bcbfb6f38a9a4523a0356fcd999bef5f7f9cc1248aef9c27df33af50b9
Python
5,831
170
""" Module for the Report class. """ from typing import List, Union from warnings import warn import matplotlib.backends.backend_pdf import numpy as np from bsb import Scaffold, from_storage from cerebellum.analysis.plots import Plot, ScaffoldPlot class PlotTypeInfo: """ Class storing information about ele...
60b7e20e2e5913d398ac0cd2728d501d0e52cf8ec39f5876fad1069f0950a832
Python
5,834
174
''' The implementation of PIGNPI and the baseline ''' import numpy as np import torch import torch.nn as nn from torch.functional import F from torch.optim import Adam from torch.nn import Sequential as Seq, Linear as Lin, ReLU, GELU, Tanh, Softplus, Sigmoid, LeakyReLU from torch.autograd import grad torch.set_defaul...
d7ae1a0fd9838838d79e82cfa7bd9b64dcf94334ad5045e0da911020dd355f13
Python
5,834
167
import numpy as np import scipy import scipy.cluster.hierarchy as sch from .dmg import PairwiseDMG class ClusterMerge: """Perform cluster merge based on the given merge criterion.""" def __init__( self, merge_criterion, stop_criterion=None, stop_clusters=-1, n_cells=2...
25f44680fba217ebc9bb97dcdbfa5c25844411ba3170afdd9b2fa7a77f5ce00c
Python
5,839
147
import pytest pytest.importorskip("numpy") pytest.importorskip("scipy") import networkx as nx from networkx import edge_current_flow_betweenness_centrality as edge_current_flow from networkx import ( edge_current_flow_betweenness_centrality_subset as edge_current_flow_subset, ) class TestFlowBetweennessCentrali...
64b48ecda9c47dab15b04c26de1c2abdb1434a6c6f88cced214a837c014295e5
Python
5,839
182
import pathlib import subprocess from concurrent.futures import ProcessPoolExecutor, as_completed from functools import lru_cache import anndata import numpy as np import pandas as pd import pysam from scipy import stats from scipy.sparse import csr_matrix from .._doc import * from ..utilities import parse_mc_pattern...
35a1c66f02ee402c7f181e51ed46a0d8008a4a6ae908540ab11937cbd844e88a
Python
5,841
190
import networkx as nx __all__ = ["cytoscape_data", "cytoscape_graph"] def cytoscape_data(G, name="name", ident="id"): """Returns data in Cytoscape JSON format (cyjs). Parameters ---------- G : NetworkX Graph The graph to convert to cytoscape format name : string A string which is...
1feca8f01d5d19e8603c65c7d6d064993f0e2c1248d7e4566b047a285e3fc520
Python
5,842
188
# This file was automatically generated by SWIG (http://www.swig.org). # Version 3.0.12 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info if _swig_python_version_info >= (2, 7, 0): def...
ece92b5267d68a8f53efcc40d4e2691174cd5f1b6e8bad7a92318a04f8055ce5
Python
5,843
199
import matplotlib.pyplot as plt # To plot import numpy as np import random import math # 17.09.20: Hexagonally tethered chains for input to LAMMPS. # Set variables N = 100 # Number of bond vectors = number of units - 1 # Per chainaffect gridspacing = 3.5 # The spacing in our g...
08c6c2019a608a69df43055cf036f8d8a49a893fb3c9af7f1f65a6e5ed4ed83c
Python
5,844
157
import torch import random import rdkit import rdkit.Chem as Chem import networkx as nx from MolRep.Explainer.Attribution.utils.fuseprop.chemutils import * from MolRep.Explainer.Attribution.utils.fuseprop.nnutils import * from MolRep.Explainer.Attribution.utils.fuseprop.vocab import common_atom_vocab from collections i...
a7c5e9faa5bbc0585158f32fa144f713826b31f283fc5dbe44d7a6b0700409bb
Python
5,845
198
import nibabel as nb import numpy as np import os from nipype.interfaces.base import ( BaseInterface, BaseInterfaceInputSpec, traits, File, TraitedSpec, CommandLine, CommandLineInputSpec, ) from nipype.utils.filemanip import split_filename import nipype.pipeline.engine as pe from nipype.int...
5b8ed5bb3ca06be6ef898b528f83e429d4cc35c1d6116759aea135cec1da8bf4
Python
5,846
159
# 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...
e40f3f8137e1ba8504396f2efee1827cf02c24217c5193276d94df483aa567f5
Python
5,847
137
from uff.ic.mell.sentimentembedding.datasets.dataset_loader import DataSetLoader from uff.ic.mell.sentimentembedding.classificadores.analisador import Analisador from uff.ic.mell.sentimentembedding.vocabularios.deepmoji_vocabulario import DeepMojiVocabulario from uff.ic.mell.sentimentembedding.vocabularios.emo2vec_voc...
1e4c78071477c5a4ebb58e401df7ea6e100c44ace7730087576b5204b4dc811a
Python
5,849
149
""" Utility functions for doing stratified random sampling (at the sentence level) for those corpora which do not have test/train splits, and for saving the test and train data in CONLL 2003 format in separate directories. """ import os import codecs from sklearn.model_selection import train_test_split import utils ...
64816f0f1d4a2c040a18100ecf5c6a911b51b8a07cad5c180994a398c8bb3b0a
Python
5,850
208
# -*- coding: utf-8 -*- """ Created on Wed Dec 4 11:35:36 2019 @author: aaussel """ from IB_soma_LIP import * from IB_axon_LIP import * from IB_apical_dendrite_LIP import * from IB_basal_dendrite_LIP import * from scipy import signal prefs.codegen.target = 'numpy' defaultclock.dt = 0.01*ms runtime=1*second start...
7c12e283ccf9e3c82c041950c3a54974665be0872a263effd268b615dda77043
Python
5,851
177
import pytest import networkx as nx class TestFilterFactory: def test_no_filter(self): nf = nx.filters.no_filter assert nf() assert nf(1) assert nf(2, 1) def test_hide_nodes(self): f = nx.classes.filters.hide_nodes([1, 2, 3]) assert not f(1) assert not...
b388530b7660243975eb11c070a04055f0e54dcc3bd2075f01597659d4ee81cb
Python
5,852
193
import argparse import torch.nn as nn import torch.nn.functional as F from cogdl import experiment from cogdl.models import BaseModel from cogdl.layers import GCNLayer, SAGELayer, GATLayer from cogdl.datasets.ogb import OGBArxivDataset class GCN(BaseModel): def __init__( self, in_feats, hi...
628a38a762937c4e8d88f28f80340367d16363d29c2cc218c03cdc797a83f98f
Python
5,853
142
# 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"...
fed593c4bc6028035cd53921ed6a102ff97547c50f2c37e20cb911ea79bc0b93
Python
5,853
134
# -*- coding: utf-8 -*- import os import pandas as pd import numpy as np import glob def get_kif_and_condition_from_file_path(file_path): folder_name = os.path.basename(os.path.dirname(file_path)) condition = folder_name.split("-")[3] if condition == "Control": condition = "control" ...
1a47191c9c30820b801fee9ea5f5754405a607836e21e24051d3e54c297292b5
Python
5,855
152
from PyQt5.QtWidgets import QApplication, QMainWindow, QFileDialog, QMessageBox, QLineEdit from PyQt5.QtCore import pyqtSlot from .run_processing_mw import Ui_MainWindow import pyqtgraph as pg from oct.reconstruct import * from oct.post import * from oct.load import * from oct.view.ofd import * import logging class ...
aa4fcbe8a987a25b1eca47eaaf40670ba24b534f5bb92beaa32a698b9f3de92d
Python
5,857
142
#!/usr/bin/env python # interface libraries from tkinter import * from tkinter import filedialog from tkinter.ttk import * # my files from mainbody import mainbody from getboundary import getboundary def makeform(root, fields): entries = {} rows = [] for field in fields: row = Frame(root) ...