sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
6d149444f3d4b36c0c05bd938a59444e3e840530e0a69e1f5a9e4270a65edcad | Python | 9,145 | 274 | """Exceptions used throughout package"""
from __future__ import absolute_import
from itertools import chain, groupby, repeat
from pip._vendor.six import iteritems
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
if MYPY_CHECK_RUNNING:
from typing import Optional # noqa: F401
from pip._internal.req... |
8747ceecdb99f0b95c9955c7151d739a916a06d9b4715d6efbc4671c5c871160 | Python | 9,149 | 264 | # -*- 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... |
bc73d80ca9b595b736a47cd804c3b58a1bfb394132c92904e3250b4f9b450169 | Python | 9,155 | 295 | import contextlib
import itertools
from typing import AbstractSet
import numpy as np
from nl_expr.expression_pattern_matching import add_match
from nl_expr.expression_walker import PatternWalker
from nl_expr.expressions import Constant, Symbol
from ...relational_algebra import (
ColumnStr,
NameColumns,
Na... |
1b6f346c0a9ec97c8299eb3936946a52fd9373e1075ab32c849dff7f8baa57d5 | Python | 9,156 | 290 | import networkx as nx
__all__ = ["degree_centrality", "betweenness_centrality", "closeness_centrality"]
@nx._dispatchable(name="bipartite_degree_centrality")
def degree_centrality(G, nodes):
r"""Compute the degree centrality for nodes in a bipartite network.
The degree centrality for a node `v` is the fract... |
f6108df58907aa95fb0810aa7b05da8c27ea1b1862f801a4a33d0396f1111375 | Python | 9,174 | 262 | from __future__ import annotations
from collections.abc import Mapping, Sequence
from pathlib import Path
from types import MappingProxyType
from typing import Any
import matplotlib.cm as cm
import matplotlib.colors as colors
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from anndata import... |
cb6fa2d0615d65a12b03570b041dc8c77aef1f686cb3659f6d54324056297a57 | Python | 9,178 | 231 | from .hic_exception import *
import numpy as np
from .utils import *
from abc import ABC, abstractmethod
from scipy.linalg import block_diag
from .interfaces import *
class BaseHicMatrix(ABC):
def __init__(self, the_array, res):
self._oe = False
self.mat = the_array
self.res = res
... |
29f635a9860094a4e35a3db1bfb922e75260d5ea5da81f6a98606f8b6c23493b | Python | 9,185 | 224 | __all__ = [
'table_MPD_statistics',
'table_MPD_survival',
]
import lifelines
import numpy as np
import pandas as pd
import scipy
def calc_cox_pval(df, age, sex='M', x='bio', mort_tte='mort_tte', mort_event='mort_event'):
""" Returns concordance and pvalue """
sex = sex if isinstance(sex, (list, tupl... |
e081ab8c8d9d4d62fdeba6441859af727959e53af24c062a6f82b9c13d85b4a8 | Python | 9,188 | 241 | #!/usr/bin/env python
"""
Evaluate segmentation metric for a single probability map with different thresholds.
This script:
- Loads labels, prediction probabilities, and (optionally) mask and metric mask
from Zarr containers.
- Computes a cropped ROI by removing a user-specified padding (in voxels) from... |
7415c67a24b714f82f9269a9022e8594fe42ee37341aa1f9d4e3cd4e7e52852b | Python | 9,190 | 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_alternate3 import *
from LIP_full_alternate3 import *
from itertools import *
from joblib import Parallel, delayed
import multiprocessing
def sav... |
88c189cf6ccf42bb1f9682b4511f00cf4cbb8151a346da2746fe3aaea327a0b2 | Python | 9,191 | 240 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 6 14:09:58 2020
@author: smith
"""
import os
import pandas as pd
import numpy as np
import collections as cx
from goatools.base import download_go_basic_obo
from goatools.base import download_ncbi_associations
from goatools.godag_plot import plot_g... |
0c43bc8e7e8317c26bb4a5a759de1bd92c43797a0cbd839cc92936841a3e74d9 | Python | 9,193 | 188 | # -*- coding: utf-8 -*-
# Copyright (C) 2015, Egor Zindy <egor.zindy@manchester.ac.uk>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Soft... |
3aaa8dd2f4ec74912df52473d8f0c093ae1fbecd3b0bcf176f11503fbc7cae59 | Python | 9,196 | 264 | """
Disjoint projection on a probabilistic choice, its body being lifted with
every rule:
P[∃X (C(ū) ∧ φ)] = Σ_a P[C(ū)[a/X]] P[φ[a/X]]
for a choice C whose atom has the variables X and occurs nowhere else.
The expected probabilities are computed by enumerating the possible
worlds.
"""
import itertools
import py... |
3a819c3c43551918510405c483bc51d7776dc0c3a2aab6dbcbe2c959c67ef75c | Python | 9,199 | 224 | #!/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 pandas as pd
from ax.adapter.base import DataLoaderConfig
from ax.ad... |
e58ea9460534d7403ea441e9d045f1ce15b12e032b63fc73f4a40232e964dd1a | Python | 9,203 | 228 | import torch
from torch import nn
from torch import optim
from torch.utils import data as Data
import numpy as np
from typing import Optional, Any, Union, Callable
from torch.nn import functional as F
from torch import Tensor
class PositionalEncoding(nn.Module):
def __init__(self, d_model, dropout=.1, ma... |
01808444192a85284b71e8e47549aa4139df32fa26e479ccab29fe9d3a70ee31 | Python | 9,206 | 260 | import os
import logging
import numpy as np
import numcodecs
from gunpowder.nodes.batch_filter import BatchFilter
from gunpowder.batch_request import BatchRequest
from gunpowder.ext import ZarrFile
logger = logging.getLogger(__name__)
class Snapshot(BatchFilter):
"""Save a passing batch in an HDF file.
Arg... |
60087c742ebde7486deeb9c7aa847da14fb2419622935121b67b9928e1f00f98 | Python | 9,206 | 263 | import math
import numpy as np
import pytest
import torch
from spikingjelly.timing_based import functional, neuron
from spikingjelly.timing_based.examples.srm_mnist import _SRMNet
def _reference(times, indices, offsets, weights, duration, threshold):
output_times, output_indices, output_offsets = [], [], [0]
... |
8c479d606d1cdd7b2aab38779db85aa1f71e884a7a10b4e8406d34f4972d1480 | Python | 9,208 | 354 | # -*- coding: utf-8 -*-
"""
biosppy.signals.abp
-------------------
This module provides methods to process Arterial Blood Pressure (ABP) signals
and extract relevant features such as systolic pressure, diastolic pressure,
mean arterial pressure (MAP), and heart rate variability (HRV) metrics.
"""
# Imports
from __fu... |
5e94f77d6fdbc1e6fc9d113e55314a85ae6ab6f30d3ec8e302be89cd2eb593b6 | Python | 9,211 | 296 | # -*- coding: utf-8 -*-
"""
VesselFilling
=============
This module uses a convolutionary neuronal network to fill empty tubes
and vessels.
"""
__author__ = 'Sophie Skriabin, Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE.txt)'
__copyright__ = 'Co... |
c8acabd7afff42453d42f5d5dea55ad4f3d678391736dbeec46bf9bea024ffa3 | Python | 9,217 | 235 | """Zero-shot identification of the biological test data image conditions using
the linearizing synthetic test and ILSVRC-2012 data.
Parameters
----------
sub : int
Used subject.
n_used_features : int
Number of best EEG features used for the zero-shot decoding.
dnn : str
Used DNN network.
pretrained : bool
If True,... |
02cc0f248a42ed26330878bd899417b90ae3a7636155c41ce5199e28bbedf1ea | Python | 9,218 | 275 | # -*- coding: utf-8 -*-
"""datasets
Defines the dataloaders using PyTorch inherited Dataset class
"""
# Contributions and Changelog accessed via a private git repository:
# https://github.com/philipwijesinghe/deep-learning-lsm.git
# philip.wijesinghe@gmail.com
# Copyright (c) 2020 Philip Wijesinghe@University of St ... |
634b0c073f3f0d3f4e826bbcefc5ce6f637c75cee402fcb196ab42905a5f626d | Python | 9,218 | 217 | import os
import shutil
from typing import Optional
from galaxy import util
from galaxy.datatypes.sniff import is_column_based
from galaxy.tool_shed.util import basic_util
from galaxy.util import checkers
from galaxy.web.form_builder import SelectField
def build_shed_tool_conf_select_field(app):
"""Build a Selec... |
151c6715922b58699ebf8d5867aeed1391ee2a6a1f05434bbaf1a8b26c5ef797 | Python | 9,221 | 219 | from typing import (
cast,
Optional,
TYPE_CHECKING,
Union,
)
from galaxy.model import (
DatasetCollection,
DatasetInstance,
)
from galaxy.model.orm.util import add_object_to_object_session
from galaxy.util.oset import OrderedSet
from .type_description import COLLECTION_TYPE_DESCRIPTION_FACTORY
... |
f3cb134825edea06a4026c4fe010ff8abd51fbfd0d394c5797264a784973cefb | Python | 9,221 | 278 | """Functions related to the Wiener Index of a graph.
The Wiener Index is a topological measure of a graph
related to the distance between nodes and their degree.
The Schultz Index and Gutman Index are similar measures.
They are used categorize molecules via the network of
atoms connected by chemical bonds. The indices... |
1e4935bf9ff383eb1eb021bce0aa1cff8a4f9fd20c0aa16f148172b67490f0df | Python | 9,226 | 235 | '''
Created on Jun 2, 2020
@author: voodoocode
'''
import numpy as np
import finnpy.sfc._misc as misc
import finnpy.sfc.td as td
import finnpy.sfc.cd as cohd
import matplotlib.pyplot as plt
import finnpy.data.paths as paths
def mag_sq_coh(data, _0, _1, frequency_tgt, _2, _3):
return cohd.run_msc(data)[frequen... |
451b01d0d6beba019cece171f7f306e6b7dd785e094da247fa7e45d1fc0d4426 | Python | 9,228 | 195 | from textwrap import dedent
idx_doc = (
"If true, save an methylpy chromosome index for back compatibility. "
"If you only use methylpy to call DMR, this don't need to be True."
)
allc_path_doc = "Path to 1 ALLC file"
allc_paths_doc = (
"Single ALLC path contain wildcard OR multiple space separated ALLC ... |
c9a83f8bdc9a9e2d5cab739ddeaacc0c0e056e0b64134d525ccee769cb745c83 | Python | 9,229 | 245 | from jinja2 import Environment, FileSystemLoader, select_autoescape
import requests
from unidecode import unidecode
from pathlib import Path
from datetime import date, datetime
import getpass
import os
import sys
import warnings
"""
Generates SNIRF interface and validator from the summary table of the specification
ho... |
5c9694f737cc6beee84a3935f3eddb6185f98c446ef56de86cb45407e3528651 | Python | 9,232 | 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_altd import *
from LIP_full_altd import *
from itertools import *
from joblib import Parallel, delayed
import multiprocessing
def save_raster(nam... |
66378184f42370af33fcaf98d450cde72c9d4ca5ae32ada740753308888c5ce7 | Python | 9,234 | 253 | from math import ceil
import torch
from torch import nn
from torch.nn import functional as F
from torch_geometric.nn import DenseSAGEConv, dense_diff_pool
from torch_geometric.utils import degree, to_dense_batch, to_dense_adj
from torch_geometric.transforms import ToDense
NUM_SAGE_LAYERS = 3
class SAGEConvolutions(... |
f6dec5959cae6b250f99ffac5a51818154b2d6a526e7bf598432f18b048249ea | Python | 9,235 | 215 | # -*- coding: utf-8 -*-
"""
Created on Tues Sep 11 13:32:12 2018
@author: jacobrosenstein & chrisarcadia
A PasseriniLibrary stores a list of Passerini molecules. It inherits from the CompoundList class.
"""
import json
import csv
from datetime import datetime
import pubchempy as pcp
from pyteomics import mass
fr... |
62e6e1d81788132f0bc9459090a5af571c5f8080657d6be716b1700b759b7435 | Python | 9,250 | 200 | # 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... |
9d3226b5f9eab669dc2f3a96d7fec50872a025d70fc7ed4ff530b797a9d49578 | Python | 9,251 | 226 | #!/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 ax.adapter.base import DataLoaderConfig
from ax.adapter.data_utils imp... |
644b428013304e47fe4eaa683726ea47aa5fc8ad42e861364972711937cfb832 | Python | 9,252 | 207 | import itertools
import numpy as np
from ... import config
from ..._util import ichain
from ...config import types
from ...reporting import warn
from ..strategy import ConnectionStrategy
from .shared import Intersectional
@config.node
class VoxelIntersection(Intersectional, ConnectionStrategy):
"""
This str... |
d3bc4cb8fd268e449823dd05c1dfffa641916761e3b7af2e19f0228e0db5c29d | Python | 9,254 | 230 | # -*- coding: utf-8 -*-
import numpy as np
from sklearn.utils.random import sample_without_replacement
from sklearn.metrics import auc, precision_recall_curve, roc_curve
from sklearn.svm import OneClassSVM
import argparse
import load_data
import networkx as nx
from graph_autoencoder import *
import torch
im... |
0a46c93ff6547785007df814482762bacd8fac873163a9432362c07174e2b8ae | Python | 9,261 | 225 | """Calculate the confidence intervals (through bootstrap tests) and significance
(through one-sample t-tests) of the pairwise decoding analysis results, and of
the differences between the results and the noise ceiling.
Parameters
----------
used_subs : list
List of subjects used for the stats.
encoding_type : str
Wh... |
6bcc2cbcedb723d13c7a4458083142363787cbb6564643523ebe7f707e3600e9 | Python | 9,262 | 360 | # -*- coding: utf-8 -*-
"""
Simple Interface to read RAW/MHD files e.g. created by elastix
Todo: read subsets efficiently
Example:
>>> import os, numpy
>>> from ClearMap.Settings import ClearMapPath
>>> import ClearMap.IO.RAW as raw
>>> filename = os.path.join(ClearMapPath, 'Test/Data/Raw/test.mhd') ... |
fc8ef7d8fb5209c7c5ca4477b913c8fae60247c1d9dfca90b892fd62e2dcb88c | Python | 9,262 | 182 | import numpy as np
import MDAnalysis as mda
from MDAnalysis.analysis import pca, align
from MDAnalysis.coordinates.memory import MemoryReader
from MDAnalysis.analysis.base import AnalysisFromFunction
from sklearn.decomposition import PCA
print('imported modules')
import argparse
#TODO. do more things in memory
im... |
32c9265b3600f57f5f821dd8614dd9a1a29639a65bb95bfbcf8fb95f70245f08 | Python | 9,263 | 207 | # -*- 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 newFo... |
dd659660e918451dfe88aaf1f124f60b6f0cb3a5ed50851b8ec7fb184d58681f | Python | 9,263 | 223 | #!/usr/bin/python
# neural_circuit.py by Patrick D Roberts (2022)
# Neural mass model of similar to Wilson-Cowan model for 2-state activity
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scipy.optimize as opt # root-finding algorithm
class Neural_Circuit:
"""Class for modeling... |
dbb9a4d9e2b9406013b9cf513918f8121327a7956fbb4835f9cddbc680110256 | Python | 9,264 | 209 | """
Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
Analyze the clusters and assign identity to the clusters
"""
import os
import pandas as pd
import numpy as np
from scipy.stats import pearsonr, spearmanr
import cellranger.matrix as cr_matrix
import martian
__MRO__ = """
stage ASSIGN_CELL_IDENTITY(
i... |
da9a4ba8e022fe84f3b10f0e5e9b0157b5ee2250ff470124958c0537c983853b | Python | 9,266 | 256 | # 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... |
3cb39009cc5fb20ffaad4190f5ea4589e866f968ea043183f4f36632f62ed98e | Python | 9,267 | 296 | import pytest
import networkx as nx
np = pytest.importorskip("numpy")
pytest.importorskip("scipy")
@pytest.mark.parametrize(
"ary_format", ("bsr", "csr", "csc", "coo", "lil", "dia", "dok", "dense")
)
def test_adjacency_matrix_format(ary_format):
G = nx.havel_hakimi_graph([3, 2, 2, 1, 0])
# fmt: off
... |
e93a0947365ea22fbf7157ac5828633102796231bd988ff8adb78ed975e3be6f | Python | 9,279 | 283 | from __future__ import annotations
from typing import Any
import torch
def _transformer_engine_fp8_status() -> tuple[
bool,
bool,
str | None,
str | None,
dict[str, bool],
]:
try:
import transformer_engine.pytorch as te
except ImportError as exc:
return (
False... |
c8d47d946584bf3259c5f95b017d99d358d8afa1db2ad3dfcbf5140f7cb5ea56 | Python | 9,282 | 225 | #!/usr/bin/env python
import argparse
import gzip
import os
parser = argparse.ArgumentParser(description = "determine which clusters are the shared clusters between two souporcell runs with shared samples")
parser.add_argument("-1","--experiment1", required = True, help = "souporcell directory for experiment 1")
par... |
160510b617afa979f4e986446b2a7177c7d643e54a3f0045fa04da3d436634fe | Python | 9,285 | 205 | # -*- 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... |
0f52e0a17fe26efda147ebe2284c7a97faa9de65950a45ba60094619da168174 | Python | 9,286 | 280 | """Algorithms for finding the lowest common ancestor of trees and DAGs."""
from collections import defaultdict
from collections.abc import Mapping, Set
from itertools import combinations_with_replacement
import networkx as nx
from networkx.utils import UnionFind, arbitrary_element, not_implemented_for
__all__ = [
... |
4c077aac57b00fd0ed2ec7b09657e9e167e77999fb6372cd2791ea5d1004cdbd | Python | 9,292 | 315 | import math
import torch
import triton
import triton.language as tl
from triton.language.extra.cuda import libdevice
@triton.jit
def _phi(u, delta):
z = delta * u
series = u * (1 - z / 2 + z * z / 6)
return tl.where(
tl.abs(z) < 1.4901161193847656e-8, series, -libdevice.expm1(-z) / delta
)
... |
0d713ee006aeedec9088f575c929966b5a4e97fa4378536bcab17c5c742d357d | Python | 9,294 | 197 | from eval import evaluate
#########################################################
## Callback-functions for evaluating model-performance ##
#########################################################
def _sample_cb(log, config, visdom=None, test_datasets=None, sample_size=64):
'''Initiates function for evaluatin... |
6ff91385f44c07e300e9a197d21a6936682f82dd8c202a494496abeb4563c2de | Python | 9,295 | 132 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 29 03:51:43 2018
@author: chrisarcadia
"""
import Andrew
from lxml import etree
# alert action
alert = Andrew.Action( position = 1,
type = 'alert',
level = 0,
message = 'aler... |
c8e611977a66cc88df0feadc8af0ff3c165e2bf405d15a3ec7ecaa305f5f1119 | Python | 9,296 | 281 | """
Copyright © 2025 Howard Hughes Medical Institute, Authored by Carsen Stringer , Michael Rariden and Marius Pachitariu.
"""
import os
import numpy as np
import cv2
from scipy.ndimage import gaussian_filter
from . import utils, io, transforms
try:
import matplotlib
MATPLOTLIB_ENABLED = True
except:
MATPL... |
fd6d7cd96f3492dba518b4f2ca12172c35a4b09c28955e5463d183528207ef9b | Python | 9,298 | 247 | from __future__ import print_function
# 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, Versio... |
c1ac46103ec3fe2be42f94f9bf385b04f5bfe536ea1975a9c0ae15cf9d623c09 | Python | 9,299 | 284 | import numpy as np
import os
import pickle
import torch
import json
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import pandas as pd
import math
import utils
from data.data_utils import *
from data.dataloader_ssl import load_dataset_ssl
from constants import *
from args import get_a... |
83ca04f158d6da09322ce3809aafce9c2b90134bb574204bbfa4a869a64ada87 | Python | 9,301 | 321 | import errno
import itertools
import os
import os.path as osp
import random
import shutil
from collections import defaultdict
from urllib import request
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from tabulate import tabulate
from .graph_utils import coo2csr_index
class Ar... |
ddcba52fec25f8a64d97b0e958ecb01a0edec37601cdfa3e43d89ec60fd8058d | Python | 9,301 | 360 | # -*- coding: utf-8 -*-
"""
Simple Interface to read RAW/MHD files e.g. created by elastix
Todo: read subsets efficiently
Example:
>>> import os, numpy
>>> from ClearMap.Settings import ClearMapPath
>>> import ClearMap.IO.RAW as raw
>>> filename = os.path.join(ClearMapPath, 'Test/Data/Raw/test.mhd') ... |
6234692a4a2ddf4d61c55bb7cfd81e4c70906a3804be2c9f159e9386233cf9ac | Python | 9,304 | 193 | from __future__ import annotations
import numpy as np
import pytest
import spatialdata as sd
import xarray as xr
from spatialdata.models import Image2DModel, Labels2DModel
from spatialdata.transformations import get_transformation
import squidpy as sq
from squidpy.experimental.im import (
StainFit,
fit_stain_... |
60bad4ef03483d0d0188c8c7c93c1f2a28a3a14e4db2938efb3d84b25d58a635 | Python | 9,314 | 222 | # 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... |
4e8f1414a1a264839f03ced8d52fbb1d59fff9c2a34585c9e17e3999a31603e7 | Python | 9,321 | 247 | from __future__ import absolute_import
import collections
import logging
import os
import re
from pip._vendor import six
from pip._vendor.packaging.utils import canonicalize_name
from pip._vendor.pkg_resources import RequirementParseError
from pip._internal.exceptions import BadCommand, InstallationError
from pip._i... |
d4e0c8ffb1f1186003042eda1730d7c125bc3f8e2c73c379721812fd4ff22aeb | Python | 9,326 | 289 | from typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from .. import BaseModel
from .deepergcn import DeeperGCN
from .gat import GAT
from cogdl.layers.reversible_layer import RevGNNLayer
from cogdl.layers import GCNLayer, GATLayer, GENConv, ResGNNLayer
from cogdl.utils import ... |
dc19507f0d5bcfa2058456d1db51b5f7c6b0bb4ddd1f5370819d61d94f01504e | Python | 9,331 | 194 | # -*- coding: utf-8 -*-
import os
import numpy as np
import pandas as pd
import sys
import threading
def get_MTRF_diff_axon(data, column, nb_neurites_slower):
MTRF_axon = data.loc[data["neurite"] == 0, column]
MTRF_MN = data.loc[data["neurite"] != 0, column]
#make sure that there is data fo... |
1f122864a70b556b124ee37171db77d1082fa589db7899af07198f95a8452d86 | Python | 9,332 | 241 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 15 16:01:27 2021
@author: smith
"""
import os
import numpy as np
import pandas as pd
import scanpy as sc
import scipy
def findCellsByGeneCoex(adata, gene1, gene2=None, g1thresh=0.6, g2thresh=0.6, gene1up=True, gene2up=True, use_raw=False):
"""F... |
21a51ca2d9429f89ff438756f50438894d8614d0d55eb287812236b9b072b022 | Python | 9,332 | 198 | from eval import evaluate
#########################################################
## Callback-functions for evaluating model-performance ##
#########################################################
def _sample_cb(log, config, visdom=None, test_datasets=None, sample_size=64):
'''Initiates function for evaluatin... |
b2b061ba9732256d05bd85d275ca244f7b4c76e4899e9d9ed6826ed7c60eb4fd | Python | 9,340 | 239 | """Class implementing meta-model for a Conv3D Residual Layer.
That is, a rectangle of Conv3D layers where the first layer is connected
to the last one. This solution reduces the gradient disappearence problem
that is present in deep neural networks.
"""
from typing import Dict
from tensorflow.keras.layers import Add... |
46b663b592a67cdd5db4abe6058b47bc9a27167b371de8cc3e21ff95d6db2ce0 | Python | 9,341 | 280 | # Kwikteam / phy CCG computation module
# Adapted by Catalin Mitelut from github code last updated March 23, 2016
# -*- coding: utf-8 -*-
"""Cross-correlograms."""
#------------------------------------------------------------------------------
# Imports
#--------------------------------------------------------------... |
4df31f478b3b7d3a049a628e3e3fab7bcbdf13aac0e99458fdd3e1be29d02b4f | Python | 9,343 | 244 | """
Type resolution mixin for RegionFrontendDatalogSolver.
Propagates type information across Datalog rule predicates and variables
using Unknown as a marker for unprocessed types. Extracts types from
extensional database (EDB) predicates which carry concrete
AbstractSet[Tuple[...]] types, from builtin functions whic... |
f14beb3745eb7b756866a07a2ff9139bb65fe73d7874b777f6bb71bfd1120051 | Python | 9,344 | 233 | import re
from collections import OrderedDict, defaultdict
from copy import deepcopy
import numpy as np
import pandas as pd
from lib.monomer_alignment_generation.alignment import *
class Species_interact:
def read_species_annotation_table(annotation):
SPECIES_ANNOTATION_COLUMNS = ["OS", "Tax"]
... |
6bd0c92cde3d77258fe741d5a062ebd13582a37c7dde55aade68565f6ec8a99f | Python | 9,351 | 292 | from typing import Dict
import random
import numpy as np
import scipy.sparse as sp
from collections import defaultdict
import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.utils import shuffle as skshuffle
from sklearn.linear_model import LogisticRegression
from sklearn.multiclass import O... |
f9d94640cca44e7a56d9987c014394cb35eb4bd6bfe262c6ca1150c001a19786 | Python | 9,353 | 239 | #!/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 contextlib import ExitStack
from random import random
from ax.adapter.cross_validation import c... |
caea52b42bedffc4c2c0f67806d3832c3c9bf7a159480e4e724f153413db36d2 | Python | 9,354 | 276 | """The "torch_mps" GPU backend, based on PyTorch.
To use this backend, call ``himalaya.backend.set_backend("torch_mps")``.
Important Notes:
This backend uses float32 precision due to MPS framework limitations.
This may result in reduced numerical precision compared to float64 backends.
For high-precision ... |
0f1d716b7e14292d0fc09ae8c45ad3194bd07fa99953c6880db18d1d34fa2c8b | Python | 9,355 | 205 | from dotmap import DotMap
from loguru import logger
from nidn.fdtd_integration.constants import FDTD_GRID_SCALE
from ..utils.global_constants import UNIT_MAGNITUDE
def _validate_config(cfg: DotMap):
"""This function validates that all required entries are in the config.
Args:
cfg (DotMap): Run confi... |
c60ea5ea9ff158dba8911ec1fdf00300c780375f2b4ede2a7813a5336de9f1c3 | Python | 9,364 | 233 | """
Kanevsky all minimum node k cutsets algorithm.
"""
from collections import defaultdict
from operator import itemgetter
import networkx as nx
from networkx.algorithms.flow import (
build_residual_network,
edmonds_karp,
shortest_augmenting_path,
)
from .utils import build_auxiliary_node_connectivity
d... |
4eaa73f740f02987e13ec7f354e265f384cbf3ba5d144e5e3cd1dd5c0c6ce139 | Python | 9,371 | 347 | # -*- coding: utf-8 -*-
"""
lockfile.py - Platform-independent advisory file locks.
Requires Python 2.5 unless you apply 2.4.diff
Locking is done on a per-thread basis instead of a per-process basis.
Usage:
>>> lock = LockFile('somefile')
>>> try:
... lock.acquire()
... except AlreadyLocked:
... print 'some... |
5d7158bf2461a154b5a0a66b51249da0de46fe8c3cd1b593f6a70ee320f50c24 | Python | 9,379 | 219 | import functools
import os
import shutil
from typing import (
Any,
Optional,
Union,
)
from galaxy import exceptions
from galaxy.files.models import (
AnyRemoteEntry,
BaseFileSourceConfiguration,
BaseFileSourceTemplateConfiguration,
FilesSourceRuntimeContext,
RemoteDirectory,
RemoteF... |
305e6a9799c46cf58e79bd0099aa4f6a4eabb0efe0b3c2ed5f47d61cc543824e | Python | 9,381 | 208 | # 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... |
667898bac03788421d4cd256db9f589af9f1c9fc7ad23cd23bb92deb0ae6d62e | Python | 9,382 | 224 | #author: Dimitris Spathis (ds806@cl.cam.ac.uk)
"""
what: load individual feature CSVs of Fenland's full cohort, concat, split to train/test, normalize and do ML
in: CSVs with extracted features, IDs, metadata
out: train/test vectors, figures, and trained models
"""
import numpy as np
import pandas as pd
from tqdm i... |
f6e1926c0292f6be360e60ac51b0b4e5fe2bc0031c8e39901dabe947fe76a16b | Python | 9,392 | 318 | # -*- coding: utf-8 -*-
# Imports
import time
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import MinMaxScaler
from .math_utils import pca
from .chem_utils import ChemDraw
# Wall-clock timer for testing
class timer:
def __init__(self, name):
... |
55488d7fab6ebc1e8219b464a0f2c23c6bcb98445f98696892ae54be089b4d4a | Python | 9,395 | 311 | #!/usr/bin/env python2
# Modified Twitter Sentiment Corpus Install Script
#
# as per the Twitter API v1.1 https://dev.twitter.com/docs/api/1.1/overview
# the original script written by Sanders (http://www.sananalytics.com/lab/twitter-sentiment)
# becomes defunct. The following changes have been made to comply with la... |
84e79b7a39d30a146a8f06ca7f1d5aa125bd93441ccc2919173190b8c36adbc6 | Python | 9,398 | 257 | # 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.p_feasible import PFeasiblePlot
from ax.analysis.plotly.plotly_analysis import PlotlyAnalysisCard
fro... |
ac3b3ad646df403d35aff3bb9e89d46c203bf7b2d2650e58f3b8c74a923afe9b | Python | 9,401 | 251 | """
NeuroStore engine initialization.
NeuroStore (https://neurostore.org) is the database behind Neurosynth
Compose and the one NiMARE's ``fetch_neurostore`` downloads. Releases are
``nimare-studyset-parquet`` archives; this module reads their parquet
tables directly, so NiMARE itself is not required.
Study ids are ... |
1e3847d321c2ced3817f065fc6cc86d5e51f9f917a7323bb68b37356ea3873dc | Python | 9,408 | 293 | # -*- coding: utf-8 -*-
#
# fanc documentation build configuration file, created by
# sphinx-quickstart on Fri Jul 24 09:41:33 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... |
2f9de1383df7767bd90b9ab8a0baa335c9b8ec66b6a8f8edd9b36b09e4f65574 | Python | 9,408 | 256 | #### 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... |
132c78d53fb0581659698d31ee702ddbfadc7284cb5add844252316a93367b01 | Python | 9,409 | 284 | # 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... |
615010f46b0a92dd42c1ce388da1e7f87ea73baa7e4e2c3c0d9795cee8717b35 | Python | 9,409 | 291 | from funlib import evaluate
import networkx
import random
import unittest
class TestRandVoi(unittest.TestCase):
@unittest.skipIf(
not evaluate._have_graph_tool,
"Skipping (graph_tool not installed)")
def test_split_graph(self):
# simple case
#
# 1---2---3
#
... |
50742b4237ecbcad0c246efe7740d1a74955917f916e102db85ea74212618a6a | Python | 9,413 | 265 | import logging
import random
from copy import copy
from enum import IntEnum
import gym
import numpy as np
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class CellType(IntEnum):
OPEN = 0
GOAL = 1
START = 2
OBSTACLE = 3
class GridWorldEnv(gym.Env):
"""Class impleme... |
209ba9cc498324a41857517998b4d5c5c459d1d89b83cd1653498788501566cd | Python | 9,421 | 313 | import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import os
import glob
from scipy.stats import zscore
import importlib
import zipfile
import math
import utils
import scipy as sp
from scipy import io
import scipy.signal
from scipy.sparse.linalg import eigsh
import scipy.opt... |
01d126c39752f5e9f664c32bc92a63fe389c876aad9f89e9b44f9fc9278fba67 | Python | 9,431 | 246 | import os
import sys
# Block triton from being imported - it segfaults when TF CUDA libs are loaded
sys.modules["triton"] = None # type: ignore
import time
from contextlib import ExitStack
from pathlib import Path
import learnMSA.run.util as util
from learnMSA import Configuration
from learnMSA.run.args_to_config i... |
3780a772537c185f7ab345a4899ce5218cd7578647e7c4128946f744c20dace2 | Python | 9,434 | 263 | """
Adapted from
https://github.com/funkey/gunpowder/blob/master/gunpowder/nodes/hdf5like_write_base.py
and https://github.com/funkey/gunpowder/blob/master/gunpowder/nodes/zarr_write.py .
"""
import logging
import os
import zarr
import numcodecs
numcodecs.blosc.use_threads = False
from gunpowder.nodes import BatchFil... |
77f88753a2b93252f60eaf36415b598055e9c9faeb0ee0f0b829a22391fdb50d | Python | 9,435 | 270 | """
This code was taken from https://github.com/ActiveState/appdirs and modified
to suit our purposes.
"""
from __future__ import absolute_import
import os
import sys
from pip._vendor.six import PY2, text_type
from pip._internal.utils.compat import WINDOWS, expanduser
from pip._internal.utils.typing import MYPY_CHEC... |
7cbc6d6af25112ad21fa1a09d7328e02e94e60a1187b51710de024739beb70c8 | Python | 9,436 | 272 | import json
import urllib
import requests
from tqdm import tqdm
import os
def get_file_from_modac(fname, origin):
""" Downloads a file from the "Model and Data Clearning House" (MoDAC)
repository. Users should already have a MoDAC account to download the data.
Accounts can be created on modac.cancer.gov
... |
1c09bda25210a4aae01ea9e0360504271e956116cc6cfebf527d269b1ea0b422 | Python | 9,445 | 230 | import json
import os
import shutil
from typing import Optional
from galaxy.util import safe_makedirs
from .cwltool_deps import ref_resolver
from .parser import (
JOB_JSON_FILE,
load_job_proxy,
)
from .util import (
SECONDARY_FILES_INDEX_PATH,
STORE_SECONDARY_FILES_WITH_BASENAME,
)
def file_dict_to_d... |
806332ddb6470ae39e1a0c5bb5969c82c67d3308b82b1c9aeccff8a3990c80cd | Python | 9,448 | 250 | import torch
import triton
import triton.language as tl
from triton.language.extra import libdevice
from ..layout import _layout_args
from ..triton_layout import _spatial_offsets
from .autograd import _check
@triton.jit
def _forward_kernel(
X,
V,
LEAK_V,
M,
S,
VO,
MO,
H,
N,
TA... |
0508144d764c73a7d20c57e20374d7ccd0facd02f518f7495b87b24b25455a70 | Python | 9,455 | 202 | import itertools
import logging
import os
import time
from abc import abstractmethod
from functools import partial
from pathlib import Path
from typing import Dict, Optional, Tuple
import numpy as np
import sqlalchemy
import tensorflow as tf
from tensorflow.keras.preprocessing.sequence import pad_sequences
from rlmol... |
d062e4440342a956f7c8aecee9e1b5d68ea7d1961dd1b377a6f186c52ee2e869 | Python | 9,455 | 200 | # -*- coding: utf-8 -*-
import pandas as pd
import os
import seaborn as sns
from matplotlib import pyplot as plt
import numpy as np
import copy
def change_cell_number_to_string(number):
#not needed right now since all cells are just ints
#convert int to string with cellXXXX
#where XXXX is the in... |
a4edab943cf6368ce4d97268eeda76015d486e1b799ba82cc7f25c77e3eff1a8 | Python | 9,456 | 301 | # sphinx-apidoc -o ./docs/source ./spikingjelly
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup -----------------------... |
73b421b7da2d35e69f97b50824d434850307893b36551a3428c2711425065f13 | Python | 9,459 | 289 | import pathlib
from concurrent.futures import ProcessPoolExecutor, as_completed
import numpy as np
import pandas as pd
import xarray as xr
from ..mcds import BaseDSChrom
from .rms_test import (
calculate_residual,
downsample_table,
permute_root_mean_square_test,
permute_root_mean_square_test_and_estim... |
ad62aba8f470fd5f427f13c21f7f915f01f7b2d2164672ca8dd9a598f9b73ac8 | Python | 9,460 | 234 | import json
import logging
import os
import re
from galaxy.util import stringify_dictionary_keys
log = logging.getLogger(__name__)
def parse_tool_provided_metadata(meta_file, provided_metadata_style=None, job_wrapper=None):
"""Return a ToolProvidedMetadata object for specified file path.
If meta_file is ab... |
74eebe5a005e289eed18033d8a78984c8a4b6329dfa7709706504573edb45bd7 | Python | 9,462 | 228 | """Calculate the confidence intervals (through bootstrap tests) and significance
(through one-sample t-tests) of the correlation analysis results, and of the
differences between the results and the noise ceiling.
Parameters
----------
used_subs : list
List of subjects used for the stats.
encoding_type : str
Whether ... |
3dc26062bf04d878ea76bfb918e5b5d4dfb8a75cd2dada2076b71a939eb13971 | Python | 9,465 | 230 | #!/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 collections import defaultdict
from logging import Logger
from typing import Any
import pandas a... |
7b802be4a4033b656a53fe58bad4405ed17fc94bd9742b58cdfa8c371d7d03d9 | Python | 9,466 | 270 | # -*- 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... |
40d2d3e88785a0f42df1d8efd92cc81f3c628608969ec89108ebdabc35433446 | Python | 9,467 | 271 | # -*- 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... |
17d15cee1bb5c93420f4f8fe7baa44e70d91eb411ed151bf7d3017ad0ab1da95 | Python | 9,468 | 271 | # -*- 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... |
e01ecb61eca1eded10d5135b6bed099567db9d776af15ccc7f1a4563922e69f6 | Python | 9,476 | 251 | # -*- coding: utf-8 -*-
"""
Example script to set up the parameters for the image processing pipeline
"""
######################### Import modules
import os, numpy, math
import ClearMap.Settings as settings
import ClearMap.IO as io
from ClearMap.Alignment.Resampling import resampleData;
from ClearMap.Alignment.Elas... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.