sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
d4b50673778e4dd24552d00d65470f3d67b025890745888318818bc554466516 | Python | 5,196 | 142 | import ast
import numpy as np
import graph_tool.all as gt
import pyintergraph
def string2array(array_string):
array_string = ','.join(array_string.replace('[ ', '[').split())
return np.array(ast.literal_eval(array_string))
def get_prop_type(value, key=None):
"""
Performs typing and value conversion fo... |
b5ac1eefddbae47465923dbaf362d9a4bbba27142d3c8d79446858ac34d5acea | Python | 5,197 | 95 | from typing import List
import torch
import torch.nn as nn
from .mmd_like import _MMDLikeTrainer
class CORALTrainer(_MMDLikeTrainer):
r'''
This class supports the implementation of CORrelation ALignment (CORAL) for deep domain adaptation.
NOTE: CORAL belongs to unsupervised domain adaptation methods, w... |
c766adb759f955521b37a7fdb633007a572043345f5b170de5d37d349c3cd4ed | Python | 5,200 | 133 | import connalysis
import pandas
import numpy
from .analysis import edge_participation_df
"""
Functions for rewiring a network to increase edge participation.
"""
def find_low_participation(ep_df, dim, n):
"""
Finds edges with low maximum edge participation values.
Args:
ep_df: DataFrame of edge pa... |
d9f249ba70381058713f49a13893d12059f72acff8ca876c7bfd955cfd5690a4 | Python | 5,202 | 137 | import pandas as pd
import os
def wrapper_table(f,pd, caption):
f.write('\\begin{table}\n')
f.write(pd.to_latex())
f.write('\\caption{'+caption+'}\n')
f.write('\\end{table}')
if not os.path.exists('stats'):
print("Error: Please run firs the script 'combine_tables.py'")
else:
pd.set_option('dis... |
15652e03e918639a803a2b3d8e4973ea6bc1ce736066bab82b1758ad7265b174 | Python | 5,204 | 180 | ### compute the transmitted diffraction orders of a binary grating using mode decomposition
### based on two different methods: (1) MPB eigensolver and (2) DiffractedPlanewave object.
### Also, verify that the total power in all the orders is equivalent to the Poynting flux.
### for normal incidence, compute only posit... |
fb523a00d9780e4c8a6c0dbe84ce4fe3017194caef323b4cebffc557530dc9df | Python | 5,204 | 106 | """
toposampling - Topology-assisted sampling and analysis of activity data
Copyright (C) 2020 Blue Brain Project / EPFL & University of Aberdeen
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... |
9a483d2edc85dc45a8c7e2a76c1c74f20295f33bb4ca6225d62cc8868dbe7fb9 | Python | 5,205 | 175 | """Module for parsing and testing package version predicate strings.
"""
import re
from . import version
import operator
re_validPackage = re.compile(r"(?i)^\s*([a-z_]\w*(?:\.[a-z_]\w*)*)(.*)", re.ASCII)
# (package) (rest)
re_paren = re.compile(r"^\s*\((.*)\)\s*$") # (list) inside of parentheses
re_splitComparison ... |
ac12067045eeb679b45d7bb2c4418c5465965cbbc57fa0493f6a96e3f3d68595 | Python | 5,205 | 142 | import hashlib
import os
import random
import subprocess
import tempfile
import mlflow
import numpy as np
import torch
from rich import print
class MLFCore:
__instance = None
def __new__(cls):
if cls.__instance is None:
print('Creating the object')
cls._instance = super(MLFCo... |
bbdb08c0468da33f54aa11549dd64e717d237b850e9bbcaf6a92cc18130247e2 | Python | 5,206 | 128 | """ConfigMenuWindow must not block the GUI thread on environment detection.
``get_environment_status()`` shells out to a fresh interpreter to ``import torch``
(up to a 60s timeout) and runs ``nvidia-smi``. It used to run synchronously in
``refresh()`` - called on every window open, every Refresh, AND every theme
... |
d075868d6ccdd17bbb05103848ded00e6ea37693ae0319183614ecd291b6de2b | Python | 5,207 | 139 | import argparse
import json
import math
import os
import matplotlib
matplotlib.use("Agg", force=True)
import matplotlib.pyplot as plt
import pandas as pd
from scipy.stats import linregress
def parse_em_log(workdir):
# EM doesn't have a CSV log, but we can capture the final minimized energy
# from the standa... |
d4ff6aeede3ce1f1de13c5c1ccd6843e8106fdc0ed1b35d61c040171ddf8dc9e | Python | 5,208 | 157 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# 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, merge,... |
eb4d007bc8c590647350ebe1edd08830e7d1dd3f7e22c0df83708c3062c3b1ce | Python | 5,208 | 161 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
ba95a02a53f83ea752d30ef44ec70ad416dcbe0ab9bb366330a84d5a7a38ef8c | Python | 5,213 | 215 | import numpy as np
from common.tracetype import *
def CreateSynapses(popdata, cons, effs, plasticity):
connection = np.zeros((len(popdata),len(popdata))).tolist()
efficacy = np.zeros((len(popdata),len(popdata))).tolist()
for idx1,row1 in popdata.iterrows():
for idx2,row2 in popdata.iterrows():
... |
f334f84142e46d2868c04cd54de59c2ac590079d5969146332d2e98efc7868fd | Python | 5,213 | 114 | import pandas as pd
import scanpy as sc
import scanpy.external as sce
import numpy as np
from time import time
import anndata as ad
from memory_profiler import memory_usage
def my_func(adata):
sc.pp.filter_genes(adata, min_cells=3)
sc.pp.filter_cells(adata, min_genes=200)
sc.pp.recipe_zheng17(adata)
sc... |
227891081e26623a42ec21ad4a89fd04560af3927d2a1eec3f63199e15558e15 | Python | 5,214 | 136 | # Node-group asset "Chain Parameter" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKI... |
50839609703ce8685aace822e30ef77c6faed1cc0b543c77a360cbca4100a3b3 | Python | 5,214 | 144 | #! /usr/bin/env python
"""
calculate accuracy (with other criteria) of called mods from call_modifications.py.
need two result file, one contains calls for methylated sites, another contains calls for
unmethylated sites.
"""
import argparse
import sys
import os
import random
import numpy
from collections i... |
c3096313b240b8909f1e91680baa2df5eed5a0ddf4f7a8d49591344148db1251 | Python | 5,214 | 120 | # -*- coding: utf-8 -*-
#
# Test logging.
#
import os
import platform
# Local imports
import syncopy as spy
from syncopy.shared.log import get_logger, get_parallel_logger
from syncopy.shared.errors import SPYLog
class TestLogging:
def test_seq_logfile_exists(self):
logfile = os.path.join(spy.__logdir__,... |
80f348026cb9d22fa9965d083ce7d286d9c0dfe4075bb3ffbb8efcb83b12e733 | Python | 5,215 | 122 | # Node-group asset "Index Mix Rotation" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHE... |
c9ddd8510f49667d7c9ac85d0d350aa8f410ba7a0b828a001353ef261d5ee7e9 | Python | 5,215 | 107 | import numpy as np
from scipy.spatial import cKDTree
import networkx as nx
import pandas as pd
from typing import List
def remove_zplane_duplicates_all_barcodeids(barcodes: pd.DataFrame,
zPlanes: int,
maxDist: float,
... |
9d758847f4922078b3315d6d69f1fba8ea4034fb0d9d1c68c8132e1a4c59f353 | Python | 5,217 | 125 | import torch.nn as nn
from functools import reduce
from operator import __add__
class Conv2dSamePadding(nn.Conv2d):
def __init__(self, *args, **kwargs):
super(Conv2dSamePadding, self).__init__(*args, **kwargs)
self.zero_pad_2d = nn.ZeroPad2d(reduce(__add__,
... |
35e7be90ad9472a4c0866edc3126763f6486dc6e76938a75f0b2b782f093a2a6 | Python | 5,218 | 133 | # Node-group asset "Structure Parameter" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CH... |
c2c09c51a5c43fa8470d39be3acbde4491db8ea6bb43fbd82a6c7d95b93b548c | Python | 5,218 | 147 | import gzip
import urllib.request
from pathlib import Path
import numpy as np
import torch
import torch.nn as nn
from elasticai.creator.file_generation import find_project_root
from elasticai.creator.file_generation.on_disk_path import OnDiskPath
from elasticai.creator.nn import Sequential
from elasticai.creator.nn i... |
c5a1080271f9a00d69f755f654c0d2b2cf96bd02ee9ee4fa364ebb866d5fedc5 | Python | 5,218 | 142 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 21 09:51:51 2023
@author: morgan hamm
"""
import numpy as np
import pandas as pd
import scipy
from scipy import signal
import argparse
# import seaborn as sns
args = argparse.Namespace(npz_file='/home/morgan/Documents/grad_school/misc_code/hackat... |
dc77e4eba176fd7dc0e18991b25b0cad5ead8901c8667f9dad4ff62177b6eb36 | Python | 5,218 | 150 | from collections import Counter
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import pandas as pd
import diopy
import scanpy as sc
import random
from matplotlib.lines import Line2D
import matplotlib.pyplot as plt
class MLP(nn.Module):
def __init__(self, input_size, hidden_size1,... |
58a04f4f719bbab41b87c075b6c44b20b1bf9c23972360503dafce4cff1fb245 | Python | 5,219 | 139 | import torch
import torch.nn as nn
import torch.nn.functional as F
from segmentation_models_pytorch.base import modules as md
class DecoderBlock(nn.Module):
def __init__(
self,
in_channels,
skip_channels,
out_channels,
use_batchnorm=True,
attention_type=None,
)... |
9b9112246f1b45251c1352a90faf7971b1fe9d237ac12329124083ada2e87d81 | Python | 5,219 | 176 | ##
# \file motion_evaluator.py
# \brief Class to evaluate computed motions
#
# Should help to assess the registration accuracy.
# \author Michael Ebner (michael.ebner.14@ucl.ac.uk)
# \date January 2018
#
# Import libraries
import os
import re
import numpy as np
import pandas as pd
import SimpleITK as s... |
bb53b87e4bc23b89a19aee62df6c6b0eff405f936051c8bf7985720434214c83 | Python | 5,220 | 141 | from typing import FrozenSet, Iterable, Optional, Tuple, Union
from pip._vendor.packaging.specifiers import SpecifierSet
from pip._vendor.packaging.utils import NormalizedName, canonicalize_name
from pip._vendor.packaging.version import LegacyVersion, Version
from pip._internal.models.link import Link, links_equivale... |
e5a54255824b34fed37f7036b94bfe08bdf56a8f77e7258c013c2ba9737869d4 | Python | 5,220 | 124 | # Node-group asset "Index Mix Color" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKI... |
52f9c8c1df96633e1160b64cfabbddd81b2ca55596f18f052ad6dfae007458ce | Python | 5,222 | 167 | import torch
from measures import (
binary_accuracy,
convergence_score,
cumulative_average,
normalized_editdistance,
pairwise_dedup,
production_similarity,
semantic_difference,
)
EPS = 1e-5
def test_semantic_difference():
# maximum
assert semantic_difference((1, 180), (2, 0)) == ... |
e0d9790e228ac83a6b80cdeb9d391e7ed1bf1822a4868378f6c7d52098681fb2 | Python | 5,222 | 141 | """Per-point-set cell overlays for the slice viewer.
The viewer can show several point files at once, each in its own colour, and
toggle them independently - so overlays are rendered PER SET rather than baked
into one composite image. Each set gets its own transparent PNG layer stacked
over the slice, which is wh... |
2a8a119ec0daec1dd09f1a055efd360a85087dc5d5c8972381a80be5693bc0e6 | Python | 5,223 | 106 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
import math
from collections import OrderedDict
from ..utils import _to_triple, _triple_same, _pair_same
from .base_acsconv import _ACSConv
class SoftACSConv(_ACSConv):
"""
Decorator class for soft ACS Convolution
... |
94bbbb318ae4605ade4abaf99ba1571afdc9aa0d79600c1884734459132ba3da | Python | 5,223 | 122 | import os
import numpy as np
import pandas as pd
import scanpy as sc
import matplotlib.pyplot as plt
use_mouse = "Zhuang-ABCA-3"
adata = sc.read_h5ad("Data/raw_data/simulations/merfish/MERFISH/whole_mouse_brain/ABCA/" + use_mouse + "/Expression_Matrices/" + use_mouse + "-raw.h5ad")
cells_info = pd.read_csv("Data/raw_... |
23ce7b28abb50ed6030d775c765af91d1b72399d8a88f002f1fb425d5bee4815 | Python | 5,225 | 162 | # Node-group asset "Transform Accumulate Point" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import ... |
dfc79a80865e192846adf111c426bfd9335b21c0d19c67ad54532e3e88235d6a | Python | 5,225 | 165 | #!/usr/bin/env python
# Written by Minh Nguyen and CBIG under MIT license:
# https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
import numpy as np
import torch
import torch.nn as nn
from cbig.Nguyen2020.rnn import MinimalRNNCell
from cbig.Nguyen2020.rnn import LssCell
def jozefowicz_init(forget_gate):
"... |
f2f0e9ec659b39498da6b2969361a038ce11782168ebca87812ae81814a34fe0 | Python | 5,225 | 175 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
05201058132f610c73691428939f2e679aa2eb03ddd7eb37e9f352581b8dc7ce | Python | 5,226 | 150 | from unittest import TestCase
from codex.service.heatmaps import (
for_display,
heatmap_color,
make_table,
ALL,
UNKNOWN,
compute_group_sizes,
counts_data,
)
from tests import get_testing_neuron_db
class Test(TestCase):
@classmethod
def setUpClass(cls):
cls.neuron_db = get_... |
3480f51e90db6ff9ef82ab7190013057336fb372a46f97b8a000901d2ed7777a | Python | 5,226 | 151 | # Parameters
import argparse
# Create an ArgumentParser object
parser = argparse.ArgumentParser(description='Decision tree models for pseudobulk data')
# Add parameters to the parser
parser.add_argument('--inPath', type=str, help='Folder with the input data')
parser.add_argument('--resultsPath', type=str, help='Folde... |
40ce8a7c72b916e9e25979ea6a4bb2e46a5c0ddff4f68cd502c8c57186d81906 | Python | 5,226 | 165 | # -*- coding: utf-8 -*-
import os
import visdom
import numpy as np
import time
def mkdir(path):
# 引入模块
# 去除首位空格
path = path.strip()
# 去除尾部 \ 符号
path = path.rstrip("\\")
# 判断路径是否存在
# 存在 True
# 不存在 False
isExists = os.path.exists(path)
# 判断结果
if not isExists:
... |
b87420a4ef315128ae649019116218cc9ffd2b8c9613ee2066ab3da60fb99154 | Python | 5,226 | 154 | import argparse
import json
import h5py
import time
import click
import numpy as np
import tensorflow as tf
import deeplift.dinuc_shuffle as ds
from basenji import dna_io
try:
import rnann
except:
from basenji import rnann
# from basenji import trainer
if tf.__version__[0] == '1':
tf.compat.v1.enable_eager... |
db559ace322385ba7cf41e6c37b3450a57934db45ff429670c95be1a94f8eb1e | Python | 5,226 | 138 | """QC thresholds, named and sourced.
A pass/fail verdict is only meaningful next to the cutoffs that produced it, so
thresholds are a first-class, named, overridable object rather than constants
buried in a comparison. The report shows which set is in use and where it came
from, and a lab can ship stricter number... |
e45ef0a6351f9686db2dcd1831c1561b69210f8625e2fe5f6d84bda269279f68 | Python | 5,228 | 112 | import os
from numbers import Integral
from typing import Dict, Iterator, List, Tuple, Union
import numpy as np
import pandas as pd
from torcheeg.datasets.module.base_dataset import BaseDataset
from .base_model_selection import BaseModelSelection
from .utils import create_subset, read_indices, validate_partitions, wr... |
7def7d3a6882662ebb6bab926a546f47a53cedd47924078328921d3b459ddd27 | Python | 5,229 | 133 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Figure 2 of paper Functional subnetworks
@author: felipe
"""
import sys
import os
sys.path.append(os.path.abspath('../../'))
import analysis.frequency as frequency
import analysis.synchronization as synchronization
import numpy as np
import scipy.io as sio
import sci... |
92e6e5f819557c7e9717ec15a682deeddbd7cec5a5bdd38d7d3710ca08b08948 | Python | 5,230 | 168 | """
@Mariellapanag
Created on Feb 2023
@author: mariella
Functions for computing metrics related to Drs (AUC) and statistical tests
Includes
calculate_DRS
TODO:
"""
# internal modules
import sklearn.metrics
import numpy as np
# Function for calculating DRS (and other metrics) for each subject
def calcu... |
68ffeda24bf3c3f5519ef2e339de935028cbbab38d2ed8666157d8fa9aa5052b | Python | 5,231 | 137 | """Simulations for manuscript figures
-------------------------------------
This script needs to be executed before `ms_figures_plotting.py`.
"""
import numpy as np
from mesocircuit import mesocircuit_framework as mesoframe
import parametersets
import ms_figures_cross_correlation_function as ccfunc
#################... |
c51213e10f64a6fd86288cd6bbb3a09b9ed83cf289a54b8942abde5e40b72209 | Python | 5,231 | 153 | # Node-group asset "Atoms to CA Curves" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHE... |
d643ca3090ea99dddf36eb664d80d3360510843250a2abc404f8a307d6e666ea | Python | 5,232 | 122 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 5 11:25:39 2023
@author: benozzo
"""
import numpy as np
def get_idx_mouse():
idx_noHem = np.array([5,42,
0,2,3,37,39,40,
4,12,13,14,22,41,49,50,51,59,
6,19,20,21,43,... |
de3fdfc2821f9311200e7a3264922f3b9d8aaf77c2f2bf02319babbf9467cd75 | Python | 5,232 | 174 | """
\file vot.py
@brief Python utility functions for VOT integration
@author Luka Cehovin, Alessio Dore
@date 2016
"""
import sys
import copy
import collections
try:
import trax
import trax.server
TRAX = True
except ImportError:
TRAX = False
Rectangle = collections.namedtuple('Rectangle', ['x', '... |
003e0370f24d65e5febd5e91b206311073a1a7456d361b4969d2b38fb6000c37 | Python | 5,233 | 105 | import scanpy as sc
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from pca import pca
import warnings
warnings.filterwarnings('ignore')
from sklearn.preprocessing import LabelEncoder
from utlis import softmax, reduce_dimensions, cal_ratio
import pandas as pd
fro... |
d64e18e9e2d3599fe283e67af7a3c1477ea239e5943ec764fe0a8b6d1cc7c478 | Python | 5,234 | 132 | # A signal channel module
# Gary Bhumbra
import numpy as np
from pyclamp.dsp.dtypes import *
#-------------------------------------------------------------------------------
class chInfo: # Basic channel info
def __init__(self, _index = 0, _name = ""):
self.setInfo(_index, _name)
def setInfo(self, _index = 0... |
3cf80544e751b7b4d8c48d924067e982b751eaf56fd86caa72abfe3b3b622e6c | Python | 5,235 | 170 | import warnings
import numpy as np
from statsmodels.tsa import stattools
from statsmodels.tsa.vector_ar.vecm import coint_johansen
from sklearn.gaussian_process import kernels, GaussianProcessRegressor
from sklearn.metrics import mean_squared_error
from sklearn import linear_model
import mne.connectivity as mnec
from... |
2df30280e3965dd89b1d652a55313c02e4abcfbb995bd75937d99d20ad311e67 | Python | 5,236 | 173 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
5f94cc0ed1375ce862dbfa4c70f05ec5c5a4df9b84b675c3d3e1a6cd3ac3e0ad | Python | 5,237 | 166 | # Node group ".MN_utils_style_spheres_icosphere" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# Shared by several assets, which import it; not an asset itself.
# _build_group() is the source of truth: the docstring, __init__ and acce... |
0e4d93b319990e328873532b8eb2754587e63f3a3b913b5f14e28fc7e2bc8494 | Python | 5,238 | 172 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
4b002b8fe1184efc74046244f9e9522d418c91461a51f88a9e21b2f1f1f94c85 | Python | 5,239 | 127 | from abc import ABC, abstractmethod
import torch
__CONDITIONING_METHOD__ = {}
def register_conditioning_method(name: str):
def wrapper(cls):
if __CONDITIONING_METHOD__.get(name, None):
raise NameError(f"Name {name} is already registered!")
__CONDITIONING_METHOD__[name] = cls
re... |
4fd55286c9d2cc85190a2ea50b1a0a43b0ba18804e6a9cf700db55ee60e4d6c2 | Python | 5,239 | 156 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
a0f2a673c5e3de6cd9537d762cb87644152e0984c2dad1c74492838e0106054f | Python | 5,239 | 170 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2022 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : swc_checker.py
# Author : Yufeng Liu
# Date : 2022-08-04
# Description : The script tries to che... |
04dbe2e7cd937932513da0727c4eb59aeb435ade8044c583f6fad18db77c27d6 | Python | 5,241 | 156 | import os
import numpy as np
import yaml
import json
import logging
def read_ckg_config(key=None):
cwd = os.path.dirname(os.path.abspath(__file__))
config_file = os.path.join(cwd, 'config/ckg_config.yml')
content = read_yaml(config_file)
if key is not None:
if key in content:
retur... |
ba4560da234b5e5dbeaa5c1bfd1f6d15874f02d14cd0c796b9704202a4107c83 | Python | 5,241 | 151 | # Parameters
import argparse
# Create an ArgumentParser object
parser = argparse.ArgumentParser(description='Random Forest models for pseudobulk data')
# Add parameters to the parser
parser.add_argument('--inPath', type=str, help='Folder with the input data')
parser.add_argument('--resultsPath', type=str, help='Folde... |
ba77423b0bc0f643efada476fb85f372e46df1f3a668d6f0b9fe1ae17ea1a06c | Python | 5,241 | 122 | """Undo-history side panel for the CCF Boundary Editor.
A small ``QGroupBox`` in the dock surfaces the last N (default 20)
undo entries with human-readable labels. Selecting an entry "jumps
back" to that state by popping every newer entry off the undo stack
and applying each one's snapshot in pop order (so the sl... |
4c108a4a8d05dfc89469b3928a589749588ab8854806f8fcd43a6656d4636bb6 | Python | 5,242 | 113 | #!/usr/bin/python
from __future__ import print_function
import socket
import sys
import os
import subprocess
use_multiprocessing = True
if use_multiprocessing:
import multiprocessing
max_cpus = 2 # We might want to not run on the full number of cores, as Rosetta take about 2 Gb of memory per instance
######... |
c27e866d029615893d71f4374cf3aef1dd7501e494c474501d80088f4badb96b | Python | 5,242 | 89 | from typing import List
import torch
import torch.nn as nn
from .mmd_like import _MMDLikeTrainer
def maximum_mean_discrepancy_linear(x_source,
x_target):
delta = x_source - x_target
loss = torch.mean(torch.mm(delta, torch.transpose(delta, 0, 1)))
return loss
class DDCTrain... |
0edca7579a1fc70b857bf7d72d38712065818a3e86f466d1bebd8212bed0eef8 | Python | 5,243 | 144 | """
Tests for the DeepSlice atlas-plane selector.
The QuickNII-plane -> CCF coronal-index conversion is pure geometry (no DeepSlice
install needed), so it is tested directly. The CNN-backed `predict_ccf_plane`
is tested only for its graceful-absence contract here (DeepSlice is an optional
dependency and is not ... |
fc00e33686c37edd6e2f80dee9f4d8b988e771f6613b69c9e8372afe4588bc3e | Python | 5,243 | 139 | import gradio as gr
import utils
import Model_Class
import Model_Seg
import SimpleITK as sitk
import torch
from numpy import uint8, rot90, fliplr
from monai.transforms import Rotate90
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
image_base64 = utils.image_to_base64("anatomy_aware_pipeline.pn... |
91e972ca6c92ad3f5580d339ef0c236227d63999e08cce0750fec807518798ef | Python | 5,244 | 151 | # Reads R1.fastq and R2.fastq files, selects reads with proper cell barcode and produces a new _cbc.fastq file.
import sys, os
import itertools as it
import argparse as argp
import numpy as np
import gzip
import pandas as pd
from pandas.io.parsers import read_csv
#### function to identify cells from barcodes, allowing... |
b58374b090bf77f82da861a5f28c6e23ae429642d3accf40559d994185a6d8d8 | Python | 5,244 | 188 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
d451b9661da5b4964aaf23b8d1dda5d90f7515835acee4b5ea4929a0054e8746 | Python | 5,244 | 163 | import configparser
import logging
import os
from typing import List, Optional, Tuple
from pip._internal.exceptions import BadCommand, InstallationError
from pip._internal.utils.misc import HiddenText, display_path
from pip._internal.utils.subprocess import make_command
from pip._internal.utils.urls import path_to_url... |
b74c2d29851a14c520ad9d5293a64149e33391b868172cf7cbb5747b00ae817e | Python | 5,247 | 116 | import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
from torch.autograd import Variable
from core.cfam import CFAMBlock
from backbones_2d import darknet
from backbones_3d import mobilenet, shufflenet, mobilenetv2, shufflenetv2, resnext, resnet
"""
YOWO model used in spatialtemporal a... |
da73b451e8e15875bde62ae74925f2d4b89be6cb796172fb07b273f82e68d3da | Python | 5,247 | 152 | # Reads R1.fastq and R2.fastq files, selects reads with proper cell barcode and produces a new _cbc.fastq file.
import sys, os
import itertools as it
import argparse as argp
import numpy as np
import gzip
import pandas as pd
from pandas.io.parsers import read_csv
#### function to identify cells from barcodes, allowing... |
b50aeb9aad67a742fd6d5a3cf70a88e864cb6cb7ec121f6113d93589b99ed1d4 | Python | 5,248 | 178 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# 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, merge,... |
3843743aa201e0beaa7c26a8900c473d5420b3cdcf425c353678d3d76ca05737 | Python | 5,250 | 124 | import os
import datetime
import numpy as np
import tensorflow as tf
import tensorflow_addons as tfa
import matplotlib.pyplot as plt
from tqdm.keras import TqdmCallback
from sklearn.metrics import ConfusionMatrixDisplay, precision_score, recall_score, accuracy_score, roc_auc_score
from tensorflow.keras.callbacks import... |
52b9db1ffdebf6339736ac68718f1e5fbf0b3b808c43bc9f5ac138cb49bd6a41 | Python | 5,251 | 148 | import numpy as np
from proteingraph import read_pdb
from proteingraph.pin import filter_dataframe,compute_chain_pos_aa_mapping,compute_rgroup_dataframe,compute_distmat,get_interacting_atoms
import torch
from os.path import exists
from torch_geometric.data import Data
from proteingraph.pin import pdb2df
from proteingra... |
84ba7c69f4226f109b533d6b7b4690a91e399e9c18bb0a73422f25dd21027c51 | Python | 5,251 | 168 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# 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, merge,... |
9cfc8510e620be1fef3ac1ad12fc3ff7a5ca6ec1e71904665fdabedec2821cea | Python | 5,251 | 177 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
04a1971b43049433a30e0d4aabb4d7af5d22310497119f5fd58b494f1a1e6f50 | Python | 5,252 | 148 | import random
import unittest
import torch
import torch.nn as nn
from torch.utils.data import Dataset
from torch.utils.data.dataloader import DataLoader
from torcheeg.trainers import ADATrainer, CORALTrainer, DANTrainer, DANNTrainer, DDCTrainer, JANTrainer
class DummyDataset(Dataset):
def __init__(self, length: ... |
2213aed025e20833953a8a925af523228f2fa2956c6d159f61604b34c5ed1c30 | Python | 5,253 | 148 | import numpy as np
from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.nn.integer.ram.design import Ram
from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_p... |
8f457d873339a013c0172513324eb5b882c1a087857149e3c199f115cd2b1039 | Python | 5,253 | 102 | import matplotlib.pyplot as plt
from eworm.network import *
from eworm.utils import *
import _pickle as pkl
import os
import os.path as path
import sys
import numpy as np
import numpy.random as nr
def corr(trace_a, trace_b):
return np.corrcoef(np.vstack([trace_a, trace_b]))[0, 1]
def regular(trac... |
014c31c3c51307b5d8416107235ba394c1ef90f3c0d8de6a4799efe77c1919d9 | Python | 5,254 | 171 | from __future__ import absolute_import
import torch
"""
this code is adapted from:
https://raw.githubusercontent.com/bearpaw/pytorch-classification/master/models/cifar/resnet.py
by Wei Yang
"""
import torch.nn as nn
import math
from torchvision.models import resnet
__all__ = ['resnet']
def conv3x3(in_planes,... |
2d84278a4df70487350f19e2c6834a971a1f0ab8a3b8d559317921af81d55943 | Python | 5,254 | 101 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from lab.reports import Attribute, gm
from downward.reports.absolute import AbsoluteReport
from downward.reports.compare import CompareConfigsReport
import common_setup
REVS = ["issue571-base", "issue571-base-v2"]
LIMITS = {"search_time": 18... |
5f3a98b79720db0503a69dfb0009a17efaa708b811c11f71de0f6c3d74a2aa2e | Python | 5,254 | 137 | import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
import os
class tES_Adaptive:
"""
This class works for both binary/weighted directed/undirected networks.
"""
def __init__(self,
adjacency_matrix,
num_nodes,
lambda_o,
... |
7b6e117e743ad8c194220498a0d3bd3de4655064344022a62128b91cfa229373 | Python | 5,254 | 175 | import warnings
from numba import errors
warnings.simplefilter('ignore', category=errors.NumbaDeprecationWarning)
from sklearn.decomposition import PCA, KernelPCA
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import make_pipeline
from umap import UMAP
from sklearn.manifold import TSNE
import t... |
98a9fccd13273c37656bce2c4c947232146a017b610287e229eda36c23d56478 | Python | 5,254 | 102 | from .virtual_volume import VirtualVolume
from pathlib import Path
from .config import *
import struct
from file_io import load_image
from .block import Block
import numpy as np
class TiledVolume(VirtualVolume):
def __init__(self, root_dir):
super(TiledVolume, self).__init__(root_dir)
self.VXL_1 =... |
1485b397d76e64e0b0509b6d323d9003946ad6ce2573cef17af9c0ac57aaf93b | Python | 5,255 | 154 | #!/usr/bin/env python
# Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
# Allows the execution of user-implemented metrics
"""
Welcome to the Scenar... |
8e95f9c11ca7d8eeac0ff3912ac34a595f7d37e4d62e579976a2ff876213df51 | Python | 5,255 | 166 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
169a206c8aa13a90539591bee567eb115a02268ef9bb96725c106e470bdf0799 | Python | 5,256 | 109 | import os
import sys
import torch
import torch_geometric.datasets as GeoData
from torch_geometric.data import DataLoader, DataListLoader
from torch_geometric.nn.data_parallel import DataParallel
import random
import numpy as np
import torch.nn.functional as F
from opt import *
from metrics import accuracy, auc, prf, ... |
956b2ada84a55889089230246f55a2deb723ddf989382737cddf7ef256a5997f | Python | 5,256 | 129 | import os
from scipy.io import loadmat
import numpy as np
import pandas as pd
import torch
from sklearn.model_selection import train_test_split
from datasets.SequenceDatasets import dataset
from datasets.sequence_aug import *
from tqdm import tqdm
#Digital data was collected at 12,000 samples per second
signal_size = ... |
29ed63099340fe23fefb0cbc8770dded71bdc9c722e2c45d97652319b0d0c3d3 | Python | 5,257 | 160 | import sys
import os
import schnarc
import logging
import shutil
import argparse
import numpy as np
import datetime
import copy
import time
(tc, tt) = (time.process_time(), time.time())
#import schnet
import schnetpack as spk
import torch
import torch.nn as nn
from torch.optim import Adam
from torch.utils.data.sampler ... |
5dadc0999be59632b6e9e529615fa7e55781358601ef47239d64b09e35fda953 | Python | 5,258 | 133 | """Survival residuals and their calibration diagnostics."""
from __future__ import annotations
import numpy as np
from matplotlib import pyplot as plt
from SurvivalEVAL.nonparametric_estimator.single_event import NelsonAalen
_residual_names = {
"coxsnell": "Cox-Snell Residuals",
"modified coxsnell-v1": "Cox... |
b55c14ffa34cdb431a5bd0bade74b0e8f47807b28fc523ed14f046ad7e027407 | Python | 5,258 | 132 | """GPU-memory hygiene + reporting for the cellpose batch loop.
Why this exists
---------------
cpsam (a SAM/ViT model) is memory-hungry, and a full-resolution stitched
section's peak GPU usage sits right at the edge of a small (<=8 GB) card. Across
a long batch, PyTorch's caching allocator lets the *reserved* hi... |
19fa563fa67f26ce33deefc060ecd2adad50c23a9e726c9c3429861b39cd390b | Python | 5,259 | 139 | import optuna
import torch
from torch.utils.data import DataLoader, TensorDataset
import numpy as np
from sklearn.preprocessing import StandardScaler
from torch.optim import Adam
from torch.nn import CrossEntropyLoss
from lightning.pytorch import LightningModule
import pandas as pd
from optuna import create_st... |
32fa7ea4b30a56a6e8ffed9aa14598ba11c5447fc93f7305c1bce4036bceb87a | Python | 5,262 | 99 | import mne
import pandas as pd
from mne_bids import BIDSPath, read_raw_bids
import os
import numpy as np
import matplotlib.pyplot as plt
def readFilter(subject, data_path, l_freq, sr_new, save_path, n_runs=10, task='pain'):
esg_list = ['CS1', 'C1z', 'C3z', 'C5z', 'C7z', 'C9z', 'C11z', 'C13z', 'C73', 'C81', 'C82', ... |
806096c9dff16e1a4a0948ccfc236cf2b558306d0ad4fe3509fcdb286d94197a | Python | 5,262 | 148 | import os
import time
import numpy as np
import pathlib
from PIL import Image
from typing import Tuple, Dict, List
import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.optim import lr_scheduler
import torch.backends.cudnn as cudnn
... |
80928d2e879c3c16e79edf693c9d806b8c934407d7ac82fd65901fc7c278a491 | Python | 5,262 | 137 | import torch
import torch.nn as nn
import torch.nn.functional as F
# 1D Convolution Block
class ConvBlock(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size):
super(ConvBlock, self).__init__()
self.conv = nn.Conv1d(in_channels, out_channels, kernel_size, padding=kernel_size // 2)... |
e068c9525790050a680fee1946c029c7107470fea6ef3c3b210005c9a5eed4c4 | Python | 5,262 | 158 | import numpy as np
import pandas as pd
from collections import Counter
from scipy.stats import binom
from scipy.cluster.hierarchy import dendrogram, linkage
from multiprocessing import Pool
from MulticoreTSNE import MulticoreTSNE as TSNE
import sklearn.cluster as cluster
# glossary of functions #
# filterCells
# zscor... |
3880ce9d12ccb739bc40f3de2232eb5996d1b85b66fc1964a8fda41829bb46ea | Python | 5,263 | 196 | from __future__ import annotations
import pytest
ct = pytest.importorskip("covalent")
from pathlib import Path
from covalent._workflow.lattice import Lattice
from quacc import flow, get_settings, job, strip_decorator, subflow
from quacc.wflow_tools.customizers import customize_funcs, redecorate
def test_strip_d... |
7aad7205c9d8a648afa640158a0c0d058ad6896252269d318da649da76793224 | Python | 5,263 | 224 | from collections import Counter, defaultdict
from copy import copy
import heapq
import itertools
from queue import PriorityQueue
import numpy as np
class NoParsesError(Exception):
"""
No parses were computed for the given sentence.
"""
def __init__(self, message, sentence):
super().__init__(message)
... |
ca523c258cdf96eb8790c57a9f14f587168fa4dc6b8af45ce78c578e7223590b | Python | 5,263 | 90 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
try:
from relativescatter import RelativeScatterPlotReport
matplotlib = True
except ImportError:
print 'matplotlib not available, scatter plots... |
f1bf7f4b6fd18b42737779274093481c05bbaa00242762cbcd4c61a643d5094a | Python | 5,263 | 172 | import random
from pathlib import Path
import cocotb
import pytest
from cocotb.clock import Clock
from cocotb.triggers import RisingEdge
import elasticai.creator_plugins.bram as dut
from elasticai.creator.arithmetic import int_arithmetic
from elasticai.creator.testing import CocotbTestFixture, eai_testbench
from elas... |
1ae5abe9b3e65563af9bfd9c32be82f04fe433820f86e3c5e1d92bd5de0ccea7 | Python | 5,264 | 100 | #! /usr/bin/env python3
import os
import subprocess
import logging
import APT_interface
class cd :
"""Context manager for changing the current working directory, and automagically changing back when done"""
def __init__(self, path):
self.path = path
def __enter__(self):
self.old_path = ... |
53d2f6cf577aa38a45ef5fa91668f9629f96bd901e212468850a549f4f951a65 | Python | 5,264 | 102 | from ..utils import format_adj_matrix_from_standard, format_channel_location_dict, format_adj_matrix_from_adj_list
from ..standard_1005 import STANDARD_1005_CHANNEL_LOCATION_DICT
TSUBENCHMARK_CHANNEL_LIST = [
'FP1', 'FPZ', 'FP2', 'AF3', 'AF4', 'F7', 'F5', 'F3', 'F1', 'FZ', 'F2', 'F4',
'F6', 'F8', 'FT7', 'FC5',... |
507488cd5af4b3469d262d150c8daddd01cb2ae113a803e741e516c88305f273 | Python | 5,265 | 144 | """
Tests for the on-add setup that runs when MN node group assets are imported.
Asset drag-and-drop can't be simulated headlessly, but the add operator's
steps can: it imports the node group (which fires ``blend_import_post``) and
then creates the node instance in the edited tree. Depending on the asset
library's imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.