sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
8e2690e252c82d06f1d5f6827e37e29b67bc0403175015ce0a35ea0748e690a1 | Python | 6,359 | 185 | """
Initially adapted from
https://github.com/funkey/gunpowder/blob/master/gunpowder/torch/nodes/predict.py
Changes before porting into this package are recorded at
https://github.com/kirchhausenlab/gunpowder/blob/patch-1.1.4-logging/gunpowder/torch/nodes/predict.py
"""
import logging
from typing import Dict, Union
... |
3c004f6eb232a00ce210440a5ec64b9768d3dfa37c0d9a4d47310efa37aef3d6 | Python | 6,362 | 192 | import pytest
import networkx as nx
from networkx.algorithms import bipartite
class TestBipartiteCentrality:
@classmethod
def setup_class(cls):
cls.P4 = nx.path_graph(4)
cls.K3 = nx.complete_bipartite_graph(3, 3)
cls.C4 = nx.cycle_graph(4)
cls.davis = nx.davis_southern_women_g... |
09fd1c0893a996780f94ddb7395a8372b9f2d90665ad832bad61de222d003da0 | Python | 6,363 | 182 | """Unit tests for the :mod:`networkx.generators.expanders` module."""
import pytest
import networkx as nx
@pytest.mark.parametrize("n", (2, 3, 5, 6, 10))
def test_margulis_gabber_galil_graph_properties(n):
g = nx.margulis_gabber_galil_graph(n)
assert g.number_of_nodes() == n * n
for node in g:
a... |
debd3246054cc45e946ce3e95ff5d5b26595f6768465ab8ee5821ec21fa236d4 | Python | 6,366 | 159 | #!/usr/bin/env python
#
# Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
import os
import re
import socket
import martian
import tenkit.fasta as tk_fasta
import tenkit.preflight as tk_preflight
from preflights import (check_refdata, check_vmem_for_reference, check_filehandle_limit,
... |
a01afaef56f941ebc09d1a9eef986f93c424787054507248c210f368ae61592b | Python | 6,367 | 186 | __doc__ = """
Grid search functions
Nicholas Turner, 2018
"""
import itertools
import numpy as np
from .. import proc
from .. import seg_utils
from .auto import toolbox as tb
from . import cremi
from . import score
from . import edge
def gridsearch_edgethresh(seg_weights, labels, pre_threshs, post_threshs):
... |
10687cb9db0ee469fcd122558cbf934d970d11ecc3a758e91cf7db02829316f0 | Python | 6,369 | 223 | """Figure 3 plot - neurometrics."""
# %%
# Imports
import warnings
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from mpl_toolkits.axes_grid1 import make_axes_locatable
from config import ANALYSIS_DIR_LOCAL, STREAMS
from utils import prep_to_plot
# %%
# Settings
analysis_dir = ANALYSIS_DIR... |
31f484e9bb033f5272a22fbfe98b8b4a78dc068f61235726b1a11f80ea894951 | Python | 6,372 | 188 | # SERM
#
# Produces a recovered gene expression matrix from expressions with dropout.
#
# Written by Md Tauhidul Islam and Hongyi Ren, Radiation Oncology,
# Stanford University
import os
import numpy as np
import torch
import torchvision
import torch.nn as nn
import torchvision.transforms as transforms
impor... |
d71ca6888c189e9515f30c83c26896743d5ec6490a67efa1a9983222d8c1935b | Python | 6,372 | 147 | """Helper functions useful for the snakemake path wrangling"""
from os.path import join
from os import listdir
from os import name as sysname
def samples_get(config, probe):
"""
Query sample names given probe
:param config: snakemake config
:param probe: probe of interest
:return: list of samp... |
4e7acdb11590972759ae577d2a5724cc958b99af9db10f0c58b6fa542edce336 | Python | 6,374 | 291 | # A class that for writing BED Files, based on the UCSC specification.
# Authors: Ivy Raine <ivy.ember.raine@gmail.com>, Jacob Schreiber <jmschreiber91@gmail.com>
from typing import List, Optional, Literal, Union
from collections import OrderedDict
import numpy as np
from os import PathLike
class BEDTrackLine:
"""C... |
f433e065692b4aa451698fdc601a48b65affaf59f069e26dfd848a74b86d583a | Python | 6,375 | 164 | # NICE
# Copyright (C) 2017 - Authors of NICE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program ... |
130a35d9e65ac7e4672d5790f49f1addeb8a717a007f5c24cfc7392f2f069e0b | Python | 6,376 | 154 | # 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... |
852cb5b30a7398bf14d7c11a7afaafdbb66abdb9f0c9f01ad0c6fab7aa41686a | Python | 6,376 | 174 | from pathlib import Path
from typing import AbstractSet, Dict, Tuple
import nibabel
import pandas as pd
from nibabel.dataobj_images import DataobjImage
from pandas.errors import ParserError
from nl_expr.exceptions import (
InvalidCommandExpression,
UnsupportedProgramError,
)
from nl_expr.expression_pattern_ma... |
87b03aeae58dd596b6163614d604c425c733dc05147d113ba1c820eaeebfdfa7 | Python | 6,376 | 169 | # # # # # # # # # # #
# # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #
# # #
# # # Evaluate the perceived directions of the inner dots
# # # in experiments 1 and 2 of Takemura et al., 2011. Cf. Figures 4 and 6.
# # #
# # # 1) We assume that the motion decomposition includes a self-motion component
... |
5b40e0cf75dd1775b890555a82078fcd4d774f71ce44632eaf3f55a8de9e1ece | Python | 6,379 | 218 | """Fused projection inputs, autograd context, and Torch reference equations."""
from typing import Optional
import torch
from . import surrogate_runtime as surrogate_objects
from .surrogate import _surrogate_gradient, _surrogate_spec
_MAX_CUDA_ELEMENTS = 2**31 - 1
def _rematerialize(x, v, threshold, reset, *, ta... |
c5df5a853f1145a8b950be7fe3e1f1a1ff70a8d2ece613f870fa88d4ec1e1a4c | Python | 6,381 | 147 | '''
Created on May 5, 2022
@author: voodoocode
'''
import unittest
import numpy as np
import finnpy.feat.sfc as sfc # @UnresolvedImport
import finnpy.demo.functionality.sfc.gen_demo_data as gen_demo_data # @UnresolvedImport
np.random.seed(0)
class test_sfc_all(unittest.TestCase):
def mag_sq_coh(self, data, ... |
9c5d6a52db2102ac3a6c030fda9167285de21b5634a24b435020844b736de819 | Python | 6,384 | 156 | # 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... |
ae7f4580a07ec48713bdd041a195e4e74a3d44854cae1ab469011a54c61b0c52 | Python | 6,386 | 218 | from nl_expr.expressions import Symbol, Constant as _C
from nl_expr.expression_walker import PatternWalker, add_match
from ..chart_parser import ChartParser
from ..english_grammar import (
EnglishGrammar,
EnglishBaseLexicon,
S,
NP,
PN,
VP,
V,
DET,
N,
num,
gen,
PRO,
ca... |
ee027cbd644ed28ef174c3e891bcf0b144e871606f656851ad173c793c67089f | Python | 6,386 | 205 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Functions for visualization
Created on Wed May 19 09:58:59 2021
@author: townesf
"""
import numpy as np
import matplotlib.pyplot as plt
from contextlib import suppress
from scipy.interpolate import interp1d
from scipy.spatial import Delaunay
from utils.misc import ... |
2289b4b276c7902b996d9ed295ed8ab9e85ad56d236002744b208eb5e3cb6a2a | Python | 6,391 | 192 | # -*- coding: utf-8 -*-
"""
This module contains provisional support for SOCKS proxies from within
urllib3. This module supports SOCKS4 (specifically the SOCKS4A variant) and
SOCKS5. To enable its functionality, either install PySocks or install this
module with the ``socks`` extra.
The SOCKS implementation supports t... |
304cbd4387db7bb194d9999ffdf37f5f8b0b0fb9871f1b915f5e98c0c55fa9de | Python | 6,391 | 174 | from itertools import chain
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.datasets import cifar10
from tensorflow.keras import utils
from tensorflow.python.keras.utils.np_utils import to_categorical
from tensorflow.keras import Sequential
from tensorflow.keras.optimizers import Adam
from te... |
79d96f7d61bab0efaededd1a49f8ceeb292978c95dbcad3998312ed1edb5106b | Python | 6,392 | 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
from collections.abc import Mapping, Sequence
from dataclasses import dataclass, field
import torch
from ax.benchmark.benchm... |
d54f9c4922530241f7a303ea0e6bf310c1a88d2698bb2d4369e4aa71dc3cc631 | Python | 6,394 | 150 | # 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... |
f28b14bffe485883ff064aa45428dfeb0d92a0517ff7f5869e9f15ff0f2eeb46 | Python | 6,395 | 169 | # 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.graphviz.hierarchical_search_space_graph import (
HierarchicalSearchSpaceGraph,
... |
5aef688f8375ee5b0a731d1239412a35d7624cea66f3e4cdf006b08b775699f4 | Python | 6,397 | 194 | # -*- 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... |
6691bd61da46331b6d37481c15809515b0f8d6736767ecf552cc2ce9f4132c58 | Python | 6,399 | 194 | #%%
# import dbspace as dbo
from dbspace.utils.structures import nestdict
from dbspace.signal.spot_check import spot_check
from dbspace.signal.oscillations import poly_subtr, calc_feats
import matplotlib.pyplot as plt
import numpy as np
#%%
v_files = {
"IF-300": "/home/vscode/data/experiments/in_vitr/interface_vo... |
0bced1cb45622bfe186d4376c067e8ad1b76849b58a4446f6563d6cebebba833 | Python | 6,400 | 190 | import sys
import re
from pathlib import Path
from dataclasses import dataclass
from typing import List
# Documentation directory (inside the learnMSA package)
HELP_DIR = Path(__file__).parent.parent / "docs"
def format_description(description: str) -> str:
"""Remove indentation from description lines."""
l... |
57a6d1bd943744ba82dfe82616687ea01cbe43ae0c7468c407df3be1a377e87e | Python | 6,400 | 196 | # -*- 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... |
fc8ab803e3bf9af04b128126100f923f23d3896d6793d0963ae527da21fc4cbf | Python | 6,401 | 194 | import importlib.metadata
import os
import sys
import unittest
from io import StringIO
from bsb_test import (
FixedPosConfigFixture,
NumpyTestCase,
RandomStorageFixture,
skip_parallel,
)
from bsb import MPI, NodeNotFoundError, Scaffold, handle_command
class TestCLI(unittest.TestCase):
@skip_para... |
3f86a1a58816e3486ca253e1875bd8e8e75f279741acc0cd1fedf174ef7d73cb | Python | 6,402 | 194 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from cogdl.utils import (
EdgeSoftmax,
MultiHeadSpMM,
get_activation,
get_norm_layer,
)
class GAT(nn.Module):
def __init__(self,
in_dim,
num_hidden,
out_dim,
... |
9a77a4c088c334a13e7ed0ce5153cb50e8c658a9ec50a519403d220229ea79fa | Python | 6,402 | 134 | # 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... |
53813a5abaf90c344edb4a5f2c27635391127bee53330951563d9b212445b4ef | Python | 6,404 | 199 | #!/usr/bin/python3
import matplotlib.pyplot as plt
import numpy as np
import sys
import getopt
from plotly.subplots import make_subplots
import plotly.graph_objects as go
from scipy import signal
class SimData:
def loadFile(self,filename):
if self.subj < 0:
return np.loadtxt("../results/{}".for... |
5410f05a7b682c1491a5e18ce5478c7805bae98158c0c924de0a01c93992d01a | Python | 6,404 | 147 | """Splits single-depth MIBI scans into pseudo Depth Profiles.
Copyright (C) 2021 Ionpath, Inc. All rights reserved."""
# pylint: disable=too-many-branches
import argparse
import glob
import os
import shutil
import struct
import numpy as np
import tqdm
HEADER_SIZE = 12
HEADER_FORMAT = 'iii'
SAT_ENTRY_SIZE = 10
SAT... |
a5c82362858e19f660ef0b6d481e3984f25709edfa54947bab55801e3f6ed977 | Python | 6,405 | 202 | # 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... |
d8ec8059e0e83649a6e2187bcffe15e577d23d45f2c20f0c4ecf1c41aeab857b | Python | 6,405 | 174 | import io
import pickle
import sys
import time
from tqdm import tqdm
from src.tfm import *
from src.pre_data import *
from src.train_and_evaluate import *
import os
import warnings
from src.warmupLR import GradualWarmupScheduler
warnings.filterwarnings("ignore")
USE_CUDA = torch.cuda.is_available()
... |
0a67193ff6b1f4dfbdd21105720c5fb6be0fff2377d7886540c57d3d97b48c63 | Python | 6,406 | 185 | # 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... |
6e4ceba97d82fe33708f37f1ed2b3b9ab37b97729ee98ef23e77549f514f7d70 | Python | 6,408 | 205 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Functions for visualization
Created on Wed May 19 09:58:59 2021
@author: townesf
"""
import numpy as np
import matplotlib.pyplot as plt
from contextlib import suppress
from scipy.interpolate import interp1d
from scipy.spatial import Delaunay
from spatial_factorizat... |
3810bff7cda2075b97813eebf85b10615ce12e5e4f2a0e008fc498aca8a7933e | Python | 6,411 | 199 | from abc import (
ABC,
abstractmethod,
)
from sqlalchemy import (
delete,
func,
null,
or_,
select,
)
from galaxy.model import (
GroupRoleAssociation,
UserGroupAssociation,
UserRoleAssociation,
)
class AssociationNullFix(ABC):
def __init__(self, connection):
self.... |
7fbd31b6638aaa684d5639566d280a5f2efb7a79a8a00fbc0d371ab4c91cfa20 | Python | 6,412 | 232 | """ General purpose ROC curve functions """
import operator
from collections import Counter
import numpy as np
def precision(preds, labels, penalize_dups=True):
"""
Returns the precision score between two iterables of items, as well as
a list of bools indicating which items in preds were counted as fals... |
525119423171eae899c3f93aff4651ab9eaaf1be9c57bf59aa34e524a9b3c762 | Python | 6,415 | 191 | 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... |
677f38b8c209423453b6318887caf2c91b703547e21c8e5c52ab3f61633fd2eb | Python | 6,416 | 171 | # 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... |
4b429d5070cbdf193b795a60e5957325fabc36736f4d23dc095ee8ec7105fab8 | Python | 6,418 | 197 | # -*- coding: utf-8 -*-
"""yamlio
functions for reading and writing yaml configuration files
"""
# Created on Wed June 17 2020
#
# Contributions and Changelog accessed via a private git repository:
# https://github.com/philipwijesinghe/deep-learning-lsm.git
# philip.wijesinghe@gmail.com
#
# Copyright (c) 2020 Phili... |
5e3a8b25aeabaf3e19b06b21757ccd8a87f83bf0b3766e2052166c14106b825d | Python | 6,418 | 196 | # -*- 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... |
6574b8e1fc60d15319b1b04ef8cc573cf694566deff558613a5765729736871a | Python | 6,419 | 165 | import os
from fnmatch import fnmatch
from typing import (
Optional,
Union,
)
import fs
import fs.errors
from galaxy.exceptions import (
AuthenticationRequired,
MessageException,
)
from galaxy.files.models import (
AnyRemoteEntry,
BaseFileSourceConfiguration,
BaseFileSourceTemplateConfigur... |
d4b53a0d97cefd7fb54231235fc34408f946566821715ef29ba1c4b838eb9ec9 | Python | 6,419 | 160 |
"""
Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
Determine normalization info per library
"""
# Imports
from __future__ import division
import pandas as pd
import numpy as np
from collections import Counter
import pickle
import json
from analysis.peaks import estimate_final_threshold
from tools import... |
45ec3cc78bb46b00f6c719c0ed16cc6343d129b18d3ebb9b532ef9d4d27c4855 | Python | 6,421 | 192 | import logging
from collections import defaultdict
from functools import lru_cache
from typing import (
cast,
Dict,
List,
NamedTuple,
Optional,
Tuple,
)
import yaml
from galaxy.tool_util.biotools import BiotoolsMetadataSource
from galaxy.tool_util.parser import ToolSource
from galaxy.tool_util... |
69522bcba1ec8e0d01376ab16dc41a2d0b4849e6257c2220881819af34c4bfde | Python | 6,424 | 154 | # 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 typing import final
from ax.adapter.base import Adapter
from ax.analysis.analysis import Analysis
from ax.analysis.heal... |
ad5849ae22c6274bb160d71d1752e05218312e921faeb2ff022c4b2cf71c76a9 | Python | 6,425 | 239 | """
Implementation of the Wright, Richmond, Odlyzko and McKay (WROM)
algorithm for the enumeration of all non-isomorphic free trees of a
given order. Rooted trees are represented by level sequences, i.e.,
lists in which the i-th element specifies the distance of vertex i to
the root.
"""
__all__ = ["nonisomorphic_tr... |
4fae448a1432af1295d07c7ce4d4d489200254362716eb8f41c614635dc9e93f | Python | 6,427 | 205 | import warnings
from collections.abc import MutableMapping
from zarr._storage.store import Store, StoreV3
from zarr.util import json_dumps
class Attributes(MutableMapping):
"""Class providing access to user attributes on an array or group. Should not be
instantiated directly, will be available via the `.attr... |
1ac8a2d8e9220757864c10245005ae8e5d046357f79da919e46f1d6ae5503626 | Python | 6,429 | 154 | import os
import numpy as np
import matplotlib.pyplot as plt
from scipy.ndimage import gaussian_filter, gaussian_filter1d
from cellpose import io, transforms, utils, models, dynamics, metrics
import h5py
import gc
from glob import glob
import cv2
from natsort import natsorted
import shutil
from pathlib import Path
im... |
59513f8e20144af4bd1f95360ccc51255e2815b33bb642df64af006b4f589f3c | Python | 6,431 | 218 | from __future__ import annotations
import warnings
from contextlib import nullcontext
from typing import TYPE_CHECKING
import h5py
import numpy as np
import pandas as pd
import pytest
from anndata import AnnData, ImplicitModificationWarning, read_h5ad
from anndata.tests.helpers import gen_typed_df_t2_size
from annda... |
975b17ae17941968623544ea6c2840f5f5f5be5d8b686127ded05aa8c273af78 | Python | 6,431 | 162 | # 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... |
cddb22ae46db99df9e0e1c3febe120775714dd5027b613c76901f72c857e798c | Python | 6,431 | 188 | # 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... |
f66990b5fd43648277d63db72b9ea0c819c4378b4b597a4e1c8babf5391c65b2 | Python | 6,431 | 196 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 16 13:54:14 2019
@author: mengmi
"""
#%env CUDA_VISIBLE_DEVICES=2
import torch
from torchvision import models, transforms
import numpy as np
import os
import torch.nn as nn
import scipy.io as sio
from PIL import Image
#from matplotlib import pyplo... |
3be0fe43df6858f902809944ad537f7fea4d757b1bc947c061c40f46a7ee5a9b | Python | 6,433 | 167 | from pathlib import Path
import numpy as np
from learnMSA.util.sequence_dataset import SequenceDataset
class AlignedDataset(SequenceDataset):
"""
Manages a multiple sequence alignment.
"""
def __init__(
self,
filepath: Path | str | None = None,
fmt: str = "fasta",... |
6f41264c63edaf51e99c4f5f2c3f2a37832f05a4409d01cd27a746b58bdaa71b | Python | 6,439 | 196 | from sklearn.base import BaseEstimator, RegressorMixin, MultiOutputMixin
from sklearn.utils.validation import check_is_fitted
from ._group_lasso import solve_sparse_group_lasso_cv
from ..validation import check_array
from ..validation import check_cv
from ..validation import validate_data
from ..validation import _ge... |
3bb99b7c84ea3e9a757c9709376ab36cc3f9fe96cf4e60971aaa64ce85ed589e | Python | 6,440 | 300 | # -*- coding: utf-8 -*-
"""
FileUtils
=========
This module provides utilities for file management used by various IO modules.
See also
--------
:mod:`ClearMap.IO`.
"""
__author__ = 'Christoph Kirst <christoph.kirst.ck@gmail.com>'
__license__ = 'GPLv3 - GNU General Pulic License v3 (see LICENSE.txt)'
__copyright... |
9919a741fd046d3b06e50b01246b6f5f27b9ed9c10096c58a7260c029851e966 | Python | 6,441 | 147 | """IO jump freq model pmod with both posterior and kl divergence as pe, with high/low pain confounds"""
import os,json,glob,sys
from os.path import join as opj
from nipype.interfaces.spm import Level1Design, EstimateModel, EstimateContrast, OneSampleTTestDesign, Threshold
from nipype.algorithms.modelgen import Specify... |
7a71fcc8ed5d8bb98b045aae05c3bb1295516fe173764ad183965e3036a26f7b | Python | 6,442 | 183 | """This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license."""
import logging
from urllib.parse import quote
from core.feature_flags import flag_set
from core.middleware import enforce_csrf_checks
from core.ut... |
bca589b1d7b16af7cdbdd79536a4100a525933b4c238b319ee1f438981433f83 | Python | 6,443 | 137 | import sys
sys.path.append('..')
from misc.loaders import molnet_loader
from misc.utils import *
import lightgbm as lgb
import numpy as np
from sklearn.metrics import *
from sklearn.model_selection import train_test_split
import time
import pandas as pd
################################################################... |
f823a0ee7b859c88c416ff9ab46a3108746084d5a7ef850ee9758d97243288dd | Python | 6,445 | 186 | from skimage import morphology, measure, io, util # For performing morphology operations (should maybe import more from skimage...)
from mpl_toolkits.mplot3d import Axes3D # Plotting in 3D
import matplotlib.pyplot as plt # To plot
from scipy.optimize import curve_fit
from pylab imp... |
da420f4f04abfe62d098921a921dcaf3c4b92df8645cd79779c98180540317e2 | Python | 6,446 | 207 | import logging
from functools import lru_cache
from nl_expr.expressions import Constant, Symbol
from nl_expr.logic import (
Conjunction,
Disjunction,
Implication,
Negation,
)
from nl_expr.logic.expression_processing import (
extract_logic_atoms,
extract_logic_free_variables,
)
from nl_expr.logi... |
40da250c6754ce7c2535f6327b4d7e1717e7a03c67b9a3daa9b76aa8f5e16e16 | Python | 6,450 | 158 | # 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"... |
bd703fc61942ea600db10bb45d32e96f5caeb9687566da747a9cf1bb2291b6ac | Python | 6,450 | 237 |
# Read information from the hic header
import struct, io, os
import numpy as np
from sklearn.isotonic import IsotonicRegression
from scipy.sparse import csr_matrix
from numba import njit
def tocsr(X):
row, col, data = X.row, X.col, X.data
M = csr_matrix((data, (row, col)), shape=X.shape, dtype=float)
r... |
f182bbcf86838f8d7ba45dd3c88c1ff5f457da5756768111d381300fdf994bb5 | Python | 6,453 | 188 | import io
import os
import sys
from contextlib import contextmanager
from patch.exceptions import (
ErrorHandlingError,
HocConnectError,
HocError,
HocRecordError,
HocSectionAccessError,
PatchError,
)
@contextmanager
def _suppress_nrn(stream=None, close=False):
"""
Ma... |
8455c20b8c955f72843ec061fa6cf0501e26d94678341203532696db806192c4 | Python | 6,455 | 205 | #!/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
class AxError(Exception):
"""Base Ax exception.
All exceptions derived from AxError need to ... |
94d5ab14805810f1f978bdd12e7e7600c29027e7d218f19b790077a112c4eaf4 | Python | 6,456 | 179 | """Device dispatch for explicit-state neuron operators."""
import hashlib
import importlib
import threading
from functools import cache, wraps
from pathlib import Path
import torch
from torch._subclasses.fake_tensor import unset_fake_temporarily
from spikingjelly.logger import logger
_CACHE_TAG_LOCK = threading.Loc... |
2dca1568541e4cf914a34f11df782d68057d77c0fe11354e45d2bc4779e20bdc | Python | 6,458 | 169 | import rdkit.Chem as Chem
from rdkit import DataStructs
import pandas as pd
from rdkit.Chem import AllChem
import rdkit.Chem.Descriptors as desc
import rdkit.Chem.rdMolDescriptors as Rdesc
from rdkit.Chem import rdmolfiles
import rdkit
import numpy as np
mw = desc.ExactMolWt
fpdensity1 = desc.FpDensityMor... |
c0294dacb3ee8d08539c157db427c167f93b9309bfc43ecf416cad1f56be946e | Python | 6,460 | 195 | # -*- 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... |
2fa7c23fd429c4c038b75cbe09a21338a4944542642490f6a4c6ee45c063c69c | Python | 6,463 | 162 | import tensorflow as tf
import sys
import os.path
import shutil
class Dataset:
num_threads = 8
num_outputs = 0
list_labels = range(0)
num_images_training = 0
num_images_val = 0
num_images_test = 0
def __init__(self, opt):
self.opt = opt
#ABSTRACT METHOD
def get_data_trai... |
a9003b798c250b0ae4d5702fe201750e2828eef55afaaa5186900bcdeb45755c | Python | 6,463 | 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 datetime import datetime, timedelta
from ax.analysis.healthcheck.can_generate_candidates import (
CanGenerateCandid... |
d8e43dd0308b444697520a4ac86f8c60448aa21498d6872b475b17911262268b | Python | 6,464 | 192 | 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... |
08b5a36cd29452ddadfe39f08abe1dfacd8518f89a45f12ac525b40ce777b9b0 | Python | 6,465 | 179 | """
Inpainting using Generative Adversarial Networks.
The dataset can be downloaded from: https://www.dropbox.com/sh/8oqt9vytwxb3s4r/AADIKlz8PR9zr6Y20qbkunrba/Img/img_align_celeba.zip?dl=0
(if not available there see if options are listed at http://mmlab.ie.cuhk.edu.hk/projects/CelebA.html)
Instrustion on running the s... |
6fb5cce89dd0378c06ff88592260a7a28dca0ddc3749f51c5d8177437b9b7383 | Python | 6,465 | 198 | import tqdm
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from cogdl.utils import (
EdgeSoftmax,
MultiHeadSpMM,
get_activation,
get_norm_layer,
)
from utils import create_activation, create_norm
class GAT(nn.Module):
def __init__(self,
in_dim,
... |
3aa1e5b7d7e1bea87cddbdc0a99040ffce2690fa2485afe428a6944e3f8bc0a5 | Python | 6,467 | 219 | """This module provides the functions for node classification problem.
The functions in this module are not imported
into the top level ``networkx`` namespace.
You can access these functions by importing
the `networkx.algorithms.node_classification` modules,
then accessing the functions as attributes of `node_classifi... |
7a924da34370623fbd4243d4f7397d3d9dd2dd0d66220a55c177b3092d7d49a6 | Python | 6,471 | 199 | import os
import json
from pathlib import Path
from copy import deepcopy
import numpy as np
import settings
MODELPATH = settings.MODELPATH
def save_config(config, path):
config['save_path'] = str(config['save_path']) # from Path to plain string
os.makedirs(MODELPATH / path, exist_ok=True)
... |
a8e3760f8471973651bde600ece197efd318c0383151d00a131fb7e2fdd7d335 | Python | 6,471 | 170 | """
=========
Subgraphs
=========
Example of partitioning a directed graph with nodes labeled as
supported and unsupported nodes into a list of subgraphs
that contain only entirely supported or entirely unsupported nodes.
Adopted from
https://github.com/lobpcg/python_examples/blob/master/networkx_example.py
"""
import... |
9c1081903f79985d81a184ce8f27d2d3371c4e360f80851633e341f6938181b3 | Python | 6,478 | 171 | from __future__ import absolute_import
import io
import os
import sys
from pip._vendor import pytoml, six
from pip._internal.exceptions import InstallationError
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
if MYPY_CHECK_RUNNING:
from typing import Any, Tuple, Optional, List # noqa: F401
def _is_... |
8d74969eed572d9f17e612b15cae07fb6a3f4b56a64645a23969712a9a65e39c | Python | 6,479 | 144 | 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, ... |
8d6111f1a2c064cede1e1e22c8a2a7834a33df5f5755d6658f1882102baca321 | Python | 6,486 | 152 | """
General functions for loading data from disk and generating random patterns
"""
import roblib
import numpy as np
from scipy.io import loadmat
from sklearn.preprocessing import LabelEncoder
import pickle
import os.path
from sklearn.decomposition import PCA
from sklearn.discriminant_analysis import LinearDi... |
a8263f1c7517be8d39c00b0411100b804c6d960c4b9c01d243b71ed5bfa0dd23 | Python | 6,487 | 230 | from __future__ import absolute_import
from collections import namedtuple
from ..exceptions import LocationParseError
url_attrs = ['scheme', 'auth', 'host', 'port', 'path', 'query', 'fragment']
# We only want to normalize urls with an HTTP(S) scheme.
# urllib3 infers URLs without a scheme (None) to be http.
NORMALI... |
a94a1dc01d9bb6d90ae14e057eb36204df98cf605931fde8f14bc510cd2e7df2 | Python | 6,489 | 154 | #!/usr/bin/env python
#
# Copyright (c) 2017 10X Genomics, Inc. All rights reserved.
#
import collections
import numpy as np
import scipy.spatial.distance as sp_dist
import cellranger.analysis.io as analysis_io
import cellranger.analysis.clustering as cr_clustering
import cellranger.analysis.constants as analysis_cons... |
1f4d18ef047c99fc644105ef1e46c61d274b61402e4bd11523f5a83d28b4804d | Python | 6,491 | 158 | # 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"... |
7e64360692e5acd43c4c8add30c70540811bb9f76eeb4774e78f52ca138bcd0d | Python | 6,494 | 134 | """
04_run_simulations.py - tDCS FEM simulations across montage x conductivity-model combinations for one subject.
Conductivity models: ISO (isotropic literature values), DTI (dwi2cond FA-based baseline), MD-dMRI
(anisotropic, sigma proportional to <D>, the QTI mean tensor).
Montages, all +2 mA total dose (HD vs pad ... |
fcb7f421dab670faed3b795185ae0d2ea818bcc34349551e3f1abe36ed6ce3fe | Python | 6,494 | 190 | import os
import shutil
import tempfile
import numpy as np
from scipy import stats
from scipy.sparse import lil_matrix
from joblib import load, dump
from joblib import Parallel, delayed
from rsHRF import processing, sFIR
from ..processing import knee
def apply_fir_microtime_grid(para):
"""
sFIR/FIR cannot use... |
510b26b95dca12d60f2b95ab21cda514fe5d25bd178ea7071931b9071a2751ab | Python | 6,498 | 194 | import copy
import pytest
import torch
import torch.nn as nn
from spikingjelly.activation_based import memopt, neuron
@pytest.mark.parametrize(
"compressor",
[
memopt.BooleanSpikeCompressor(),
memopt.Uint8SpikeCompressor(),
memopt.BitSpikeCompressor(),
memopt.SparseSpikeCompr... |
98fc7bd895b1fa43bd6201f03b06a8758c748d666c8504388483aef1d316fe1a | Python | 6,499 | 180 | '''
Polychronization: Computation with Spikes
Eugene M. Izhikevich
Neural Computation, 2006
This script shows a way to reproduce Izhikevich's network using Brian. Note
that there are a couple of slightly tricky technical points necessary to
reproduce Izhikevich's particular numerical integration scheme and STDP... |
1e25168d41621e993ddf25eee62afb191a81b37ae0036fee72209345ac4452c2 | Python | 6,501 | 327 | # -*- coding: utf-8 -*-
"""
Created on Sat Jun 20 14:00:49 2015
@author: ckirst
"""
# open data
#mount windows folder
#sudo mount -t vboxsf D_DRIVE ./Windows/
#fn = '/home/ckirst/Science/Projects/BrainActivityMap/Data/iDISCO_2015_06/Adult cfos C row 20HF 150524.ims';
#fn = '/run/media/ckirst/Christ... |
3ba0b70af46d2919145f75944ca8375cec1abeac94a98c81d52dddbf99aeaf3c | Python | 6,503 | 159 | import numpy as np
import pickle
import torch
from torch.utils import data
from torch.utils.data.dataset import TensorDataset
from torch.utils.data import DataLoader
from torch.nn.utils.rnn import pad_sequence
from sklearn.preprocessing import StandardScaler
torch.set_default_dtype(torch.float64)
class MyDataset(da... |
3bbc21f3103d29ceea127d5a0fd42afe65b92af2c03a3f34d27ba979933b2f5e | Python | 6,506 | 211 | # 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 Collection
from dataclasses import dataclass, field, InitVar
from pathlib import Path
import pan... |
c9f3df6a4846e4ecd555d44b9df2dfa3aa2b9e64cc887d1aa124771bb7256608 | Python | 6,506 | 168 | # 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.adapter.factory import get_thompson
from ax.analysis.plotly.marginal_effects import (
compute... |
643edc1594eb2f3d4cb3b81e473a812561c8ba7f9d48e3b13e28364359f1ab7c | Python | 6,512 | 175 | import pytest
import torch
from spikingjelly.timing_based import functional, neuron
def _dense_local_weights(weight, input_size, stride, padding):
channels, height, width = weight.shape[1], *input_size
kernel = weight.shape[-1]
output_height = (height + 2 * padding - kernel) // stride + 1
output_widt... |
49f6da60492130325f093b3c44154fbdc40e80eefb9ae9a6337548e01a9a2998 | Python | 6,523 | 147 | """
History agent for understanding and answering questions about Galaxy histories.
Provides tools to explore histories, datasets, jobs, and tool usage. Can answer
general questions about history contents, interpret results, generate methods
sections, and summarize analyses.
"""
import logging
from pathlib import Pat... |
441a4d9aaef97c0f1748e73bf18b415a098b76f9574651861136e2c8315055de | Python | 6,524 | 177 | # 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... |
6b75da8b47d0c4b247f54d2d0c4cb588b854c9444904f0c141e5208ff173e346 | Python | 6,527 | 220 | from __future__ import annotations
from collections.abc import Generator
from functools import partial
from importlib.metadata import version
from typing import TYPE_CHECKING
import joblib
import numpy as np
import pytest
from dask.base import normalize_token, tokenize
from packaging.version import Version
if not TY... |
dad0e4552eedcaca7e3ce235f68ad3cfb96ee76605ccca87c8c178aa0c77909e | Python | 6,532 | 197 | import pytest
import torch
from spikingjelly._ops.tempotron import _roots, _states, _weight_gradient, cpu
from spikingjelly.timing_based.functional import _parameters, tempotron
def _normalizer(slow, delta):
peak = torch.tensor(delta * slow, dtype=torch.float64).log1p() / delta
return torch.exp(-peak / slow)... |
dc55de3f763a7b8e2230f73290c98530f03a4f0cfec91babbbe93ab69e42f5a4 | Python | 6,535 | 170 | """Browser-bound, single-use authentication state stored alongside PSA partials."""
import hashlib
import json
import math
import re
import secrets
import time
from collections.abc import Mapping
from typing import (
Any,
cast,
Literal,
)
from sqlalchemy import (
delete,
select,
)
from sqlalchemy.... |
18443e75d7a9e447a579e603d39385e3b2b9aa73ff310a95c2121e11e306abbb | Python | 6,537 | 177 | #!/usr/bin/env python
"""
Convert 3D zarr arrays to .tif image sequences
This script converts a 3D zarr array (zyx order) into a sequence of TIFF images.
It partitions the volume only along the z-axis so that each block produces a contiguous,
non-overlapping range of sections. Each section is converted to uint8 ... |
e4f61a0ada56f9623e338be3afdebfb51e5d97537dd261e957b00022042234ad | Python | 6,537 | 195 | 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... |
123fc19a94768225db47c5961b0e8899a928828f6ba7ca8f04012f17c1a6a9f5 | Python | 6,538 | 186 | # 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... |
39a56b7d3ac30531c9390fc1e29c3f2f2bc522c15422944e9674711b1e34ac8a | Python | 6,542 | 145 | import time
import networkx as nx
import numpy as np
from sklearn import preprocessing
from tqdm import tqdm
from cogdl.utils import alias_draw, alias_setup
from .. import BaseModel
class PTE(BaseModel):
r"""The PTE model from the `"PTE: Predictive Text Embedding through Large-scale Heterogeneous Text Networks"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.