sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
5e0e8ab20d9fe5450bf2f2ba4a698525914659a3ab8ea01803b64c0c3f1ca881
Python
2,816
85
#!/usr/bin/env python3 import os import pandas as pd from nilearn import masking as nmask from nilearn import image as nimg # ------------------------------------------------------------------ # Create group mask across subjects for Emofilm movie data # using preprocessed BOLD files # ---------------------------------...
89661fcf92c4daf9a87e5350bde8e44517cab050fb25c749be4d4ce8fc3e342c
Python
2,816
72
#! /usr/bin/env python from lab.parser import Parser parser = Parser() parser.add_pattern('ms_final_size', 'Final transition system size: (\d+)', required=False, type=int) parser.add_pattern('ms_construction_time', 'Done initializing merge-and-shrink heuristic \[(.+)s\]', required=False, type=float) parser.add_patter...
8af8d591fa8ea2a28f8365eee1c91535ca053ce3cb0421981b16c9e805fad2d0
Python
2,816
93
#!/usr/bin/env python3 import os import pandas as pd import math # ------------------------------------------------------------------ # Create participant-wise movie timing files for Emofilm # based on events.tsv files # Onset and Offset are saved as TR indices # -------------------------------------------------------...
c7f961ee72e784cc64d99f7fb1a09e4d197413bfb569af0ff07749f08b1e65d7
Python
2,816
87
import torch import numpy as np import pandas as pd import scanpy as sc import torch.nn.functional as F from easydl import * from anndata import AnnData from torch import nn, einsum from scipy.stats import pearsonr from torch.autograd import Function from torch.autograd.variable import * from einops import rearrange, r...
dee2d9f166066b20974981788cda323150d231df7ccaac5d96cddbc6da370b51
Python
2,816
60
#!/usr/bin/env python ## this script creates dataframes from the full distance matrices for Features (pre- and post-session), ## and Naming (pre- and post-session) and saves them to a new CSV file ## The dataframes contain the distances values for each pair of subjects. import pandas as pd from pathlib import Path # ...
6004364100b54df2ec9cb5e52f5df286c713b1874f29eecfa2815969d2d2fe98
Python
2,817
73
# 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...
a956373501b56d01b87b8f5368b32a66d7e834264f21117c5bc5520219492070
Python
2,817
84
################################################################################ # Import, Set up MPI Variables, Load Necessary Files ################################################################################ import os from os.path import join import sys import matplotlib import matplotlib.pyplot as plt from matp...
16eb05ea49eb14e260e74d843de749891130aa6f30ad9f4e0665fe3be2c189c6
Python
2,818
84
# Node-group asset "Segment ID" (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_CHECKING fr...
edd86a1729216d90aa1af57a3239b954746c7a60cde32f0b419193729fa1433f
Python
2,818
77
"""Visualizes the time of the day when the HRV and RR are mostly missing Parameters ---------- variable : str name of the variable to preprocess. It could be heart rate (hr), temperature (temperature), electrodermal activity (electrodermal) path : str path where the raw data i...
01e5cfdf20ccadec8c477f538e8495db47433b93f62e2e338996180d0ede9298
Python
2,819
83
#!/usr/bin/env python3 # Quick implementation of Hierarchical Clustering Analysis, # for comparison with rootlets hPCA results, # using input data created by hPCA.py script. import os import numpy as np from numpy.linalg import norm import seaborn as sns from scipy.stats import zscore from scipy.cluster.hierarchy ...
6dfa29613b274e8ca0244181a3e961617e8efe2f6e8c1ebe0d1abdd4edb9e197
Python
2,819
113
from __future__ import annotations import pytest dask = pytest.importorskip("dask") pytest.importorskip("distributed") from dask.distributed import get_client from quacc import flow, job, subflow client = get_client() def test_dask_decorators(tmp_path, monkeypatch): monkeypatch.chdir(tmp_path) @job ...
a4a79c654b43921bcab8d050fcddb37addd2b7b99f18564459c22c840ecbf98f
Python
2,819
83
import os import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Circle from collections import defaultdict import matplotlib.colors as colors import cv2 import random def scatter_plot(dir_paths, num_files=500, alpha=0.6): fig, ax = plt.subplots() # Dictionary mappin...
aadcb8c2fdaca48595b73b183a3a8b96ace183306984a91e810cecea84e3debd
Python
2,819
92
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jul 21 12:48:57 2023 @author: emma data generator for bias unlearning -- returns 3 items (X, y, b) -- we manually one-hot y and b in the unlearning code """ from numpy.random import seed seed(1) import tensorflow as tf tf.random.set_seed(1) import...
2dcc45b3d1ae96c0e577cfe4729e4bc8d17160e3ea93be61450f5c1571720cc4
Python
2,820
81
#! /usr/bin/env python # -*- coding: utf-8 -*- import itertools import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment from downward.reports.compare import ComparativeReport import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterP...
2f88aa53fb252043164f65d4d7c9f7839ba0136fa347aa5447dae59f524b2cb8
Python
2,820
81
# Librairies import os import sys code_path = os.path.split(os.path.split(os.getcwd())[0])[0] sys.path.append(code_path) import numpy as np import argparse from setting import * from utils import * # Arguments argParser = argparse.ArgumentParser() argParser.add_argument("-n", "--name", type=str, help="dataset name") ...
4d71b53d99b172c3ebb9bd5120a02597af0117bcaa24d33254825bee32603fd6
Python
2,820
91
"""Testing module geom.""" import os import numpy as np from numpy.testing import assert_array_almost_equal from treem import Morph from treem.utils.geom import ( fibonacci_sphere, repair_branch, rotation, rotation_matrix, sample, ) def test_fibonacci_sphere(): """Tests fibonacci_sphere."""...
a83051991217dbe7bec656dff933ca58f73b7cf4835c44ed856edb487de22734
Python
2,820
64
# 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...
b768b6438dacd56cc2a030511259ba4c32a01aadb36b96ca8d099a0bddd134ba
Python
2,820
83
from .utils import AtomsDataset, register_dataset from typing import List, Optional, Dict, Union, Tuple import torch PtDict = Tuple[ Dict[str, torch.Tensor], Dict[str, torch.Tensor], Dict[str, Union[float, int]], ] @register_dataset("pt") class PtData(AtomsDataset): def __init__( self, ...
195ae1bbfe97fa9a3ace816ead1e1cd019956004ccc5cc40b4b9effa21819ec0
Python
2,821
79
import unittest import numpy as np from neurolib.utils.parameterSpace import ParameterSpace class TestParameterSpace(unittest.TestCase): def test_parameterspace_init(self): # init from list _ = ParameterSpace(["a", "b"], [[3], [3]]) # init from dict _ = ParameterSpace({"a": [1, 2]...
8e66de4a2a099404d2971d3dee9b5c2519741ba747ce9db1fdfc8e70a618e991
Python
2,821
112
""" IMPORTANT: it's just draft """ # built-in from functools import reduce from typing import Any # app from .base import Base as _Base, BaseSimilarity as _BaseSimilarity try: # external import numpy except ImportError: numpy = None # type: ignore[assignment] class Chebyshev(_Base): def _numpy(sel...
bafe5394bd082f984146a1e2e862b8eb0e82cff78579e3f87498a94c291e25f0
Python
2,821
72
import unittest import os import pandas as pd import sys sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../src") from hornet.model import predict class TestPredictFunction(unittest.TestCase): def setUp(self): self.path = ".output_test_pred" self.input_path = ".input_test_pred" ...
364a361c6fb81bb95f31ffbf5f7395ea003374e91f725d9bf443cea3c8b3b143
Python
2,822
122
from __future__ import annotations import warnings import pytest jf = pytest.importorskip("jobflow") from quacc import flow, job, subflow def test_jobflow_decorators(tmp_path, monkeypatch): monkeypatch.chdir(tmp_path) @job def add(a, b): return a + b @job def mult(a, b): retu...
20582a8d873e585d5538c6efc250cfb057778aaa37682144f8ea350ee82f87b4
Python
2,823
78
# set QT_API environment variable import os os.environ["QT_API"] = "pyqt5" import qtpy # qt libraries from qtpy.QtCore import * from qtpy.QtWidgets import * from qtpy.QtGui import * # app specific libraries import control.widgets as widgets import control.camera as camera import control.core as core import control.m...
9b7f2a4b04aaa7026c6ea6133db80cabe0b0a72029e1187fe80ca1588088eabb
Python
2,823
91
import random import sys import unittest import neurolib.optimize.evolution.deapUtils as du import neurolib.optimize.evolution.evolutionaryUtils as eu import numpy as np import pytest from neurolib.optimize.evolution import Evolution from neurolib.utils.parameterSpace import ParameterSpace class TestEvolutinUtils(un...
52c68a18118214ed2d1d02516b7451b1aff3297cc3a142ff4a563d48e9146e89
Python
2,824
74
from __future__ import absolute_import, division, print_function, unicode_literals import argparse import logging import os import sys import tensorflow as tf import matplotlib.pylab as plt from tensorflow.keras import layers from tensorflow.keras import models import numpy as np import PIL.Image as Image import glob ...
80970eeb7a63f0165052e332e705d9ddb7cb98d2a4fe5b76fc3928782276de8b
Python
2,825
75
from typing import Tuple, Union import numpy as np import torch import torch.distributed as dist import yacs.config from torch.utils.data import DataLoader from pytorch_image_classification import create_collator from pytorch_image_classification.datasets import create_dataset def worker_init_fn(worker_id: int) ->...
971712232ec3820e9a712be84267d2a32dda3ace5cd06fdfe5ddc5c2f62a1e1a
Python
2,825
117
import sys; import os sys.path.insert(0, os.path.abspath('../eyewire')) import mesh from volume import * from shove import Shove from tqdm import * import pickle def _dump(object, filename): pickle.dump( object , open( "./{}.p".format(filename) , "wb" ) ) def _load(filename): try: return pickle.load...
a0ed7d89a65a7281ec24654776b9e39270f84b5ba8d37223ff5b4651f6874f55
Python
2,825
74
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import pymc as pm import aesara.tensor as tt import warnings import pdb warnings.filterwarnings("ignore", category=FutureWarning) import arviz as az from scipy.special import expit from matplotlib import gridspec from IPython.d...
0aab551040041ac9531f7c14e9e14da48b8e425aaa315029fd9baf770294a10c
Python
2,826
103
#!/usr/bin/env python3 import os import pandas as pd import numpy as np from sklearn.metrics import pairwise_distances # ------------------------------------------------------------------ # paths # ------------------------------------------------------------------ projpath = '/project/3011157.03/Simon/proj_2022_CABB_...
3f87e95747fcd289c5199ee53a04bdb4ddfac54765a4fcda0eebe2dbbfe9b6e0
Python
2,827
88
from wsilearn.utils.cool_utils import is_string def is_string_int(value): try: int(value) return True except: return False def is_string_float(string): """ checks if the string is a float """ try: float(string) return True except: return False def...
b8688967f7b8ef47cc6a021dc68a5155009948c03cb42a9734b47ca66718ab09
Python
2,827
71
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from common_setup import IssueConfig, IssueExperiment, is_test_run BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"] REVISIONS = ["issue696-base", "issue696-v1"] CONFIGS = [ IssueConfig( ...
17c1453b1c4128f1762e3f2f9040162d97b4c7e88fe9665b8c128993e78dbaca
Python
2,828
78
import cocotb import pytest from cocotb.triggers import Timer import elasticai.creator_plugins.adders as adders from elasticai.creator.arithmetic import int_arithmetic from elasticai.creator.testing import CocotbTestFixture, eai_testbench from elasticai.creator_plugins.multipliers.utils import ( generate_mult_test...
3db7a5cf6b6fdfa2f2e19c6c4df9bf0b03797be8a79f4dafb3f530ec298b193b
Python
2,828
87
# Written by Minh Nguyen and CBIG under MIT license: # https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md import math import torch import torch.nn as nn class MinimalRNNCell(nn.Module): """A Minimal RNN cell . Args: input_size: The number of expected features in the input `x` hidden_s...
400b4334805935434ee3f11c2a5e8556038be546fd435cf2a7d44251edb7d231
Python
2,828
78
import os from typing import List, Tuple import torch from constants import N_ITEMS from src.models import get_regressor, get_classifier def get_classifiers_checkpoints(trained_classifiers_root, max_ckpts=-1) -> Tuple[List[int], List[str]]: checkpoints = [] items = [] for i in range(1, N_ITEMS + 1): ...
59ed0ddf75f82dfe203dc24a636dd4764facb214b0cba69b259e6f8a5db8906f
Python
2,828
65
from __future__ import print_function,division from typing import Any, Dict, Tuple, Union import numpy as np import pandas as pd from PIL import Image from topaz.utils.picks import as_mask def coordinates_table_to_dict(coords:pd.DataFrame, dims:int=2) -> Union[Dict[str,np.ndarray], Dict[Any,Dict[str,np.ndarray]]]: ...
ed2fba74a8b4754bab990cc038937d06f49a9e16b38c42fcff0d8b89adaa6227
Python
2,828
60
#!/usr/bin/env python ## this script creates dataframes from the full distance matrices for Features (pre- and post-session), ## and Naming (pre- and post-session) and saves them to a new CSV file ## The dataframes contain the distances values for each pair of subjects. import pandas as pd from pathlib import Path # ...
2b1e2151f58fa19a4488aa854157c3bc64d51e052d596afa84a32d005c4f2f0c
Python
2,829
90
from __future__ import print_function from setuptools import setup from setuptools.command.test import test as TestCommand import codecs import os import sys import re here = os.path.abspath(os.path.dirname(__file__)) def read(*parts): # intentionally *not* adding an encoding option to open retu...
83a0276d8819262e91e5aebb5dfc2df412c8b64208c640c23c663788092e4f46
Python
2,829
100
# 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...
b907b25e9b985585c7c63af9eacce52bf8d45e56ab08871e963f6a7fc05c12e9
Python
2,829
83
# flake8: noqa # There's no way to ignore "F401 '...' imported but unused" warnings in this # module, but to preserve other warnings. So, don't check this module at all. # Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use thi...
0edff45bdfa12efd9f89d82d7d50744fa9c15a413c99c2be7b3119261dcfd393
Python
2,830
74
""" Created on Sat Mar 26 14:24:27 2022 @author: Haotian Teng """ import h5py from xron.utils import seq_op import numpy as np from umap import UMAP from sklearn.manifold import TSNE from matplotlib import pyplot as plt import matplotlib.cm as cm from typing import List fast5_f = "/home/heavens/Documents/FAQ...
de194a24f66c418d496ccf0e3ca519ebdbc83d48106ee1e0ae1f6612c6d4da52
Python
2,830
105
import random import pregex as pre import math assert(pre.create("f(a|o)*") == pre.Concat([pre.String("f"), pre.KleeneStar(pre.Alt([pre.String("a"), pre.String("o")]))])) assert(pre.create("fa|o*") == pre.Concat([pre.String("f"), pre.Alt([pre.String("a"), pre.KleeneStar(pre.String("o"))])])) assert(pre.create("(f.*)+"...
f985b9bb1f1e1a42a9a202f4aa047afa5bddcee36a363d9257e669a1bf066e79
Python
2,831
78
"""`--affine_init` must reject a degenerate ants.affine_initializer result. ``ants.affine_initializer`` runs an UNSEEDED internal rotation search, so it is nondeterministic and can occasionally return a near-singular or grossly over-scaled affine. Seeding SyN with one silently corrupts the registration: SyN's loc...
3d7347d8220a11f93617df45985fbf3fdad188b588e560f41f0b7e4bbcec985a
Python
2,832
56
############################################ # REFLECT ontologies - DO, BTO, STITCH, GO # ############################################ def parser(files, filters, qtype = None): """ Parses and extracts relevant data from REFLECT ontologies: Disease Ontology, Tissues, STITCH and \ Gene Ontology databases. ...
7e89e07b89e4e274368db1da09a33240d07cab7917856798bf2d0f646fd334aa
Python
2,832
63
import torch import torch.nn as nn import torch.nn.functional as F class LSTM(nn.Module): r''' A simple but effective long-short term memory (LSTM) network structure from the book of Zhang et al. For more details, please refer to the following information. - Book: Zhang X, Yao L. Deep Learning for EEG-Ba...
f12ab0277e77a45ff6936b338e88e2573dfcebc0e2e5e2e258b4637f4f59d331
Python
2,832
73
import argparse import numpy as np import os import pandas as pd import sys from tabulate import tabulate from constants import * from src.training.train_utils import Logger from src.models import get_regressor, get_regressor_v2 from src.evaluate import RegressionEvaluator from src.evaluate.utils import * # setup ar...
326c2a9e7176351fbe38a80e49e6bc8a459967b878c9e7a0d4d6f9bd271d83bb
Python
2,833
97
""" This Python module provides just the code from the 'conceptnet5' module that you need to represent terms, possibly with multiple words, as ConceptNet URIs. It depends on 'wordfreq', a Python 3 library, so it can tokenize multilingual text consistently: https://pypi.org/project/wordfreq/ Example: >>> standardized...
77929dbf69ea6e739a3ec7822960ceb88cef4636c962e73d2458a7d0e085d370
Python
2,834
80
from __future__ import print_function from . import conditions class Axiom(object): def __init__(self, name, parameters, num_external_parameters, condition): # For an explanation of num_external_parameters, see the # related Action class. Note that num_external_parameters # always equals ...
873ab88816283cf52a142449366ffdcd91ca23f7a83cc41b60d861b3c990b4d5
Python
2,834
43
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup REVS = ["issue548-base", "issue548-v1"] LIMITS = {"search_time": 1800} SUITE = suites.suite_optimal_with_ipc11() B_CONFIGS = { 'rl-b50k': ['--search', 'astar(merge_and_shrink(merge_strategy=merge_linear(variable_orde...
7c95718f81fd319b83a587cf64d91c36a1a0838a71bd93ede07390f611a31188
Python
2,835
66
"""Affine -> the four anatomical edge letters of a displayed slice. The preview draws a slice with array axis 1 vertical and axis 2 horizontal (``_show_array`` uses ``axes={"t": 0, "x": 2, "y": 1}``; a 2D slice reaches the same mapping through ``prep_slice_for_pg``'s transpose), and ``invertY`` puts row 0 at the ...
15ae77f449aea1af5c4ebb8b46c4d446dcf48e27712e9b5ab4473b832f75d23d
Python
2,836
79
# ruff: noqa # 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 ----------------------------------------------------------...
a3a47e0b63eba2cae4eb6b712fd0a725f209a229f1c5f2d19bd557fca3fb5062
Python
2,836
88
# -*- coding: utf-8 -*- # Copyright (c) 2012 Giorgos Verigakis <verigak@gmail.com> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS P...
dd214a67074aa6232efd0f177ab745fa345d764d8d28a8c6f965ef17fbfbb1e4
Python
2,836
102
from __future__ import annotations import gzip import os import pytest from quacc.schemas.vasp import bader_runner, chargemol_runner def mock_bader_analysis(*args, **kwargs): return { "min_dist": [1.0], "charge": [1.0], "atomic_volume": [1.0], "vacuum_charge": 1.0, "vacu...
1243a874c6128362a881ef85eba0d4c01727a424a0a4f4f7ae40061f777807c9
Python
2,837
110
""" Cog SDK Coder system for custom type encoding/decoding. This module provides the Coder base class for defining custom type serialization between Python types and JSON. """ from abc import abstractmethod from typing import Any, Dict, Optional, Set, Type class Coder: """ Base class for custom type encoder...
454d1a8bdac4ee02e73c1a70b37cd757eb252129e74e46ac86d37ec3ba1f4ce1
Python
2,838
36
"""BRAKES_OR_BIG.py 2026-10-05. Pre-registered: 04-NOTES/PREREG-2026-10-05e-BRAKES-OR-BIG.md (sha in .sha256 next to it). Are dominant inputs inhibitory per se, or just giant one-of-a-kind cells that happen to be inhibitory? Male CNS v1.0. usage: python BRAKES_OR_BIG.py -> 06-OUTPUT/brakes_or_big.txt""" import os imp...
65fbb21bac78d62b98ee17b04413cf0b6fbb5d9806ab18e770661496979fd2aa
Python
2,838
92
import tensorflow as tf from tensorflow.keras.layers import Input, Dense from tensorflow.keras.models import Model import tensorflow.keras.callbacks import os import numpy as np import tensorflow.keras.backend as K from utils import onehot_test_label class LossHistory(tensorflow.keras.callbacks.Callback): def on...
88b682c00eb3330f597bf9991b8e3161fcf52e746329fbb7fe3252bfd5db6309
Python
2,838
88
import torch from torch import nn from typing import List, Dict, Callable, Any, Optional, Union from .equivalent import TensorLinear, ElementTensorLinear from .activate import TensorActivateDict from ..utils import EnvPara __all__ = ["ReadoutLayer"] class ReadoutMLP(nn.Module): def __init__( self, ...
15e5620eb50834865caf9d393c0c6f5380235f3d5ab048802ecf465cc87045a1
Python
2,839
76
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. import sys from unittest import TestCase, main from ..ansi import Back, Fore, Style from ..ansitowin32 import AnsiToWin32 stdout_orig = sys.stdout stderr_orig = sys.stderr class AnsiTest(TestCase): def setUp(self): # sanity chec...
dee5e6142251e362d8d50e4ab1cf2ac9cea840a8314b74724c7b1d79cc57f65d
Python
2,839
71
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 11 19:55:38 2022 @author: haotian """ import os import sys import toml import numpy as np import argparse def merge(args): fs = args.fs keys = args.keys collections = {x+'.npy':[] for x in keys} for f_i,sub_f in enumerate(fs): ...
d4b32b3559fd038e48ff93220b1b30f7d592a243755e3e0748f7367de3652be4
Python
2,840
99
""" Optuna example that optimizes a configuration for hand-written digits dataset using skimage. In this example, we optimize a classifier configuration for hand-written digits dataset. We optimize parameters of local_binary_pattern function in skimage and the choice of distance metric classes. """ import numpy as n...
47a4302af19b14f772dc093ad3da43fddac2ddd76512efe400d47cbbbe780f97
Python
2,841
104
from datetime import datetime from numpy import (append, cumsum, where, ndarray, ) DEFAULT_DATETIME = datetime(2000, 1, 1) def decode(s): return s.decode('utf-8', errors='replace') def _select_blocks(blocks, begsam, endsam): """Co...
e2a46b22d4532de94893f9b01ba996be12a4d3822a77eb947e41fe9064542504
Python
2,841
83
""" oxasl.gui.structure_tab.py Copyright (c) 2008 University of Nottingham """ import os import wx from oxasl.gui.widgets import TabPage, OptionError class StructureTab(TabPage): """ Tab page containing options for providing structural data """ EXISTING_FSLANAT = 0 NEW_FSLANAT = 1 INDEP_STR...
7ce54f6b73eab8bafbc505c8209c2efe3ae4f072e84e9fc07afb9f06a55bd4ee
Python
2,842
76
# Plots TVAT surfaces and polynomial regressions from Fig 5A-B from os.path import join from get_paths import * import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable import pickle from colors_paultol import cmap_iridescent if __name__ == "__main__": ...
d179caad943174e0103b9ea88ff195d6847ed1416d6917b9ae8ab7388ee5a497
Python
2,843
108
import autograd.numpy as np import autograd.numpy.random as npr from autograd import grad, make_vjp from autograd.misc import const_graph, flatten from autograd.test_util import scalar_close from autograd.tracer import primitive def test_const_graph(): L = [] def foo(x, y): L.append(None) ret...
f336ee096c08b0404a2f9f9379a33c8b72f22b2b23f90b9d57ff1c5a23edf1a6
Python
2,843
56
#!/usr/bin/env python import os import pandas as pd import numpy as np from nltools.data import Brain_Data, Adjacency from nltools.mask import expand_mask from sklearn.metrics import pairwise_distances ## location of main project directory on HPC projpath = '/project/3011157.03/Simon/proj_2022_CABB_movie/' print('Th...
026096893d40c80c0be6a48c7d0ff4df367c5c1688c62e4ee11f41f0a8fd98ed
Python
2,844
93
import click import pandas as pd from lib.sequence import SeqRegressionDataLoader1D # options @click.command() @click.option('--test', 'test_file', required=True, type=click.Path(exists=True, readable=True), help='Test sequences') @click.option('--model', ...
0147e385c33270003ee5e749ef484365e3fcbc75abd3ab24e95541dffa0b900e
Python
2,845
84
import torch from typing import Callable, List class Table: def __init__(self, col_names: List, row_names: List): self.col_names = col_names self.row_names = row_names self.content = { col_name: { row_name: None for row_name in row_names ...
2af99dc4a60d0e879a2a9cf0af6f784bf5491ce6271b608dd0178eda6ca0fcfe
Python
2,845
84
# 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...
60d327c77e31cfe9d9d2edd53708e64ed354fd27ae1fdb2ad4e84a0f706d9f6d
Python
2,846
101
""" Tests for the wbi_backoff decorator: retry on transient HTTP/JSON failures, give up on permanent ones. """ import pytest import requests import ujson from wikibaseintegrator.wbi_backoff import wbi_backoff, wbi_backoff_backoff_hdlr from wikibaseintegrator.wbi_config import config @pytest.fixture(autouse=True) def...
88bbeb8f381ac715dff55863d4d4c09300d1a0844b66f41881b32a0b2993864f
Python
2,846
86
from collections.abc import Callable from elasticai.creator.file_generation.savable import Path from elasticai.creator.file_generation.template import ( InProjectTemplate, module_to_package, ) from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_port from elasticai.creator.vhdl.code_g...
a6e5e48499e3b7d691b431532eb377942f9712d42e80c2e1886fbc02c79cea16
Python
2,847
85
import numpy as np import keras.backend as K def dice(y_true, y_pred): #computes the dice score on two tensors sum_p=K.sum(y_pred,axis=0) sum_r=K.sum(y_true,axis=0) sum_pr=K.sum(y_true * y_pred,axis=0) dice_numerator =2*sum_pr dice_denominator =sum_r+sum_p dice_score =(dice_nu...
ba161aa1314ba441f12aaa6daacb035ea268684def63dadf89203d42f60c6d78
Python
2,847
90
import json import os import pandas as pd from argparse import ArgumentParser def read_files(path_data): """ Load all functional files into Nifti format Parameters ---------- path_data: string path containing the functional images Returns ---------- files_h...
e110efac3fe924097fb4bd4a2c64c04fefac8707751868d79aae386e09d3e648
Python
2,848
81
from pathlib import Path import numpy.testing as npt import pytest from pycudadecon import RLContext, decon, rl_cleanup, rl_decon, rl_init from pycudadecon.util import imread ATOL = 0.05 # tolerance for np.allclose DATA = Path(__file__).parent / "test_data" PSF_PATH = str(DATA / "psf.tif") OTF_PATH = str(DATA / "o...
03cdcef8355c43f580f8569d41592d7de0ac0625062680d86cc2b9c4c5b65491
Python
2,849
98
from math import ceil import cocotb import pytest from cocotb.clock import Clock from cocotb.triggers import RisingEdge from elasticai.creator.testing.cocotb_pytest import ( CocotbTestFixture, eai_testbench, ) from elasticai.creator.testing.cocotb_stream import ( ResetControl as ClockReset, ) from elastic...
04f4f3382e4ebff486fb0229daac0941f48a721ac2bad7a53e4755096963d1e4
Python
2,849
72
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Dec 22 12:22:46 2023 @author: daltonm """ import h5py import dill from pathlib import Path from importlib import sys import pandas as pd import numpy as np # sys.path.insert(0, '/project/nicho/projects/marmosets/code_database/analysis/trajectory_encod...
94c8096085cfae2c93d5ca7c4ed5aefe46f234761b56c012f25824430ff2d7f8
Python
2,849
80
# 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...
d41b72378a9c826f42b8a4a6fc5a701222da074b552783bae8a30ecb4a89a1ee
Python
2,849
93
# 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...
1c81b492448c6e713fed8d8e1dddddd8b2c1e04f4ca0c12388c67be351d05548
Python
2,850
90
from copy import deepcopy from unittest import TestCase import numpy as np import matplotlib.pyplot as plt from numpy.fft import fftfreq, fftshift from scipy.fftpack import fft from scipy.ndimage import convolve1d from scipy.signal import welch from scipy import signal from soundsig.signal import correlation_function,...
a0a33196715a6da272464af3c6a5056d185c25821f2f0cd958752cdd50ac3285
Python
2,850
87
# 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 -------------------------------------------------------------- # If ex...
1c51f6079b62eec0d81a37b327fcc737a35de04716f2261c3ff2e86a7d374441
Python
2,851
87
from typing import Any import torch import torch.nn.functional as F from torch import nn, Generator from ..prixfixe import FinalLayersBlock from .utils import initialize_weights class AutosomeFinalLayersBlock(FinalLayersBlock): def __init__(self, in_channels=64, seqsize = 230): super(AutosomeFinalLayersB...
444e09017ab2e411fc389d8beeaad4bc29f9b77b5f5191fe0373c37e6a106735
Python
2,851
62
import numpy as np import pandas as pd import scipy.io import os import argparse def get_parser(parser=None): if parser == None: parser = argparse.ArgumentParser() parser.add_argument("-i", "--input", type=str, help="Path to the input file or the 10X directory.") parser.add_argument("-o", "--output...
11ebb45f83bb6af887edbba125d5200ba78926bcfdbbf061784ed38378c620a2
Python
2,852
123
import abc import numpy as np import torch from diff_frech_mean.frechetmean.utils import EPS class Manifold(metaclass=abc.ABCMeta): @abc.abstractmethod def zero(self, *shape): pass @abc.abstractmethod def zero_like(self, x): pass @abc.abstractmethod def zero_tan(self, *sha...
fb8e3b9203d54e36f36e6607ab54dd684fe477ad0d840853c1cc8935d6b24fdb
Python
2,853
88
# 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...
15e85fc194effb97027ec6dc325be55249b7c59d1c461b1ebfa5d5a667931787
Python
2,854
91
# Copyright (c) 2012 Giorgos Verigakis <verigak@gmail.com> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE A...
236271afe7686687b0ae402720594e5570cd24e739da727c71493d40ac11c746
Python
2,854
89
### Modules # basic import pysam, numba, h5py from Bio.Seq import Seq from numba.typed import List # dask import dask import dask.bag as db from dask.distributed import Client, LocalCluster from dask.diagnostics import ProgressBar from .ResquiggleUtils import * def ViterbiRead(dset, read_id): ### from hdf5 t...
290a8f8f2e7f1ef6490330b00a40965d6d7ceefb888bb16953f5fbf36106b127
Python
2,854
88
#!/usr/bin/env python3 import os import pandas as pd from nltools.data import Brain_Data from nltools.mask import expand_mask from nilearn.image import index_img # ------------------------------------------------------------------ # paths # ------------------------------------------------------------------ projpath =...
b884fbab7c9b1b6ff6e2c6b1a9963a0bd39e226ff519ed7bf173990ddd2627c4
Python
2,854
89
import inspect from typing import Any, Callable, Dict, Optional, Text, Union, Iterable import numpy as np import tensorflow.experimental.numpy as tnp import tensorflow as tf #tnp.experimental_enable_numpy_behavior(prefer_float32=True) from tensorflow.keras import layers as kl ''' Genformer helper functions ''' @tf....
25a43fbdaebfe3776ed0fff438652b6d2f017c22d17272291ee26dbba6fdd25b
Python
2,855
111
import json from collections import Counter import math import numpy as np import pandas as pd import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader from torch import Generator from pathlib import Path CODES: dict[str, int] = { "A": 0, "T": 3, "G": 1, ...
b8fd8e21b7bada14adf7aaf40a3045113d7598af747a7a841769478d69593212
Python
2,855
55
""" Created on Wed Jul 20 00:42:56 2022 This script is used to evaluate the methylation ratio of the basecalled reads for partially methylated IVT dataset. @author: Haotian Teng """ import os import pandas as pd from tqdm import tqdm import numpy as np from xron.utils.fastIO import read_fastqs import seaborn as sns fro...
fa81c8132e0acbd68b417a1c5db63403a0d7e8762e1eeef1b2ff57986289872e
Python
2,855
95
from __future__ import annotations from pathlib import Path from shutil import which import pytest from ase.build import bulk from numpy.testing import assert_allclose from quacc.recipes.espresso.bands import bands_flow from quacc.utils.files import copy_decompress_files pytestmark = pytest.mark.skipif( which("...
320ac54cd9072e30426dd4a22ccc841f54f0bbb8b178af8e1f051589d15a74b0
Python
2,856
74
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ import os import numpy as np from matplotlib import pyplot as plt from matplotlib import rcParams import toml rcParams['figure.dpi'] = 300 plt.rcParams["font.family"] = "Arial" #make font bold plt.rcParams["font.weight"] = "bold" BRIDGE_F=o...
55797b034b084de47b27cbcd8401070050294cc17b5ef96ffc7f566ce5489cb9
Python
2,856
77
# # # -*- coding: utf-8 -*- from keras.models import load_model import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler import tensorflow as tf tf.reset_default_graph() # Reset default graph tf.keras.backend.clear_ses...
bcd015d3d482ade4ff2ce42d0dd97a24c3dfab80d025c1cdf5bb46ae7ca0792d
Python
2,856
94
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Process MRI files: - convert DICOM to NII - Call to `recon-all` Example ------- To run `recon-all` on all subjects data using 8 parallel cpu cores (one per subject): ``python mri....
e4922c03c58a1c5b5a2c5c3414ee7e137d57f03fce82c611d0f4abe6df81c327
Python
2,856
83
"""Computes the number of missing datapoints Parameters ---------- variable : str name of the variable to preprocess. It could be heart rate (hr), temperature (temperature), electrodermal activity (electrodermal) path : str path where the raw data is stored savefile : str ...
3ac90efc25bee9ab7ae202818e1fc86eccce852a12c27ccb0d5f71868ae88633
Python
2,858
102
from typing import cast import pytest import torch from elasticai.creator.arithmetic import ( FxpArithmetic, FxpParams, ) from elasticai.creator.nn.fixed_point.fxp_round_cut import ( CutToFixedPoint, FloorToFixedPoint, RoundToFixedPoint, ) from tests.tensor_test_case import assertTensorEqual def...
685a679dcf44361a2e426472232cde60b81456e2dab355a78afde0b0e7556f7d
Python
2,859
94
# 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...
aab136938dc0dfde210903cf8d0124c296b546ebbb0fac30fcebbee638a34fe1
Python
2,859
80
__author__ = "Zoe Wefers" __credits__ = ["Ryan Huang"] __version__ = "1.0.0" __maintainer__ = "Zoe Wefers" __email__ = "zoe.wefers@mail.mcgill.ca" """Purpose: Object definitions for various cellular compartments.""" import ui class Dendrite: def __init__(self, img_name): self.img_name = img_name ...
787788600dc311a227721a903b2aeb5adfe565eff68da38a32a44813a1295e57
Python
2,860
33
"""posthoc_spiking_weights_line_2026-10-03.py — POST HOC (after SPIKING_WEIGHTS returned NO: with weights from one spiking baseline the laboratory prior already sits at 0.449, so the frozen 0.456 cannot transfer). Do the spiking weights still mark the break, only at their own line? The share with spiking weights at e...
ab5bf7859ff7bb68144f744cea2ad5fd27ae9e6ba62b3788031159a7d8d2e032
Python
2,860
82
"""Each encoder should have following attributes and methods and be inherited from `_base.EncoderMixin` Attributes: _out_channels (list of int): specify number of channels for each encoder feature tensor _depth (int): specify number of stages in decoder (in other words number of downsampling operations) _...
06b349350c98cdd6ac965d51b45d247ad43c32b51d61e56ad624d7149167fd37
Python
2,861
124
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup CONFIGS = { "blind": [ "--search", "astar(blind)"], "ff": [ "--heuristic", "h=ff()", "--search", "eager_greedy(h, preferred=h)"], } REVS = ["issue533-base", "issue5...
5a009af232aa60908faa060cfd747314ed7786b016c4bd37497cf5046a8b719b
Python
2,861
98
import numpy as np def e_step(matrix, counts): """ Performs E-step of EM algorithm: proportionally assigns reads to features based on relative feature abundances. """ colsums = matrix.dot(counts)[:, np.newaxis] out = (matrix / colsums).multiply(counts) return out def m_step(matrix): ...