sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
97130b7b06d7df28c7a2b87bfb5e3e521d04d0ff0bd5676eef72a4720b7c5359 | Python | 2,578 | 81 | import pytest
import numpy as np
@pytest.fixture(scope="session", autouse=True)
def set_seed():
np.random.seed(42) # noqa: NPY002
import logging
from ase.io import read
from quacc import get_settings
from pathlib import Path
from ts_workflow_examples.neb_ts_with_hessian.using_mace import neb_ts_hess_irc_mace
... |
bf0469552ca9c0e40a722947018ee4ffaa503e9937d9aee0effc27b8c977359c | Python | 2,578 | 100 | #
# 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,... |
fb1f4a04403104330526f401a0667589ecea2907ba3e2cee22831f92997b88b8 | Python | 2,578 | 89 | from typing import Callable, Optional
from torch import Tensor
import torch.nn as nn
import torch.nn.functional as F
from .block_utils import conv1x1, conv3x3
class PreactBasicBlock(nn.Module):
expansion: int = 1
def __init__(self,
inplanes: int,
planes: int,
... |
9747e83c4ddd2a3446224a27a832f6d58e67c9443abe6fee37f17aaf152060f4 | Python | 2,579 | 81 | import pytest
import torch
import elasticai.creator.nn.fixed_point as nn_fxp
from elasticai.creator.arithmetic import FxpParams
from elasticai.creator.nn import Sequential
class SimpleLinear(torch.nn.Module):
def __init__(self, total_width: int, frac_width: int):
super().__init__()
self.model = S... |
b62495e0c4ad809ffed3d2d92e3bf27606d0fe7b95be10f2b3dd32f610757e86 | Python | 2,579 | 88 | """Base manifold."""
from torch.nn import Parameter
class Manifold(object):
"""
Abstract class to define operations on a manifold.
"""
def __init__(self):
super().__init__()
self.eps = 10e-8
def sqdist(self, p1, p2, c):
"""Squared distance between pairs of points."""
... |
bc5ba35fc7fddcd3682cc656a1fac47430e912fd4aa1a87fe4fc8dc33f397c82 | Python | 2,579 | 87 | import numpy as np
from . import loadDefaultParams as dp
from . import timeIntegration as ti
from ..model import Model
class ALNModel(Model):
"""
Multi-population mean-field model with exciatory and inhibitory neurons per population.
"""
name = "aln"
description = "Adaptive linear-nonlinear mode... |
0a500ef68314c855799ef9fff8a522e0c9745cff0eee863fded63fe8ba26c514 | Python | 2,580 | 86 | # 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... |
2763c8dd42f27fa32b3899988be5710f504ca3191f8a02340528d7cdbc493763 | Python | 2,580 | 85 | import glob
import numpy as np
from scipy.signal import resample_poly
import wfdb
import math
import _pickle as pickle
def prepare(QTpath='data/qt-database-1.0.0/'):
# Desired sampling frecuency
newFs = 360
# Preprocessing signals
namesPath = glob.glob(QTpath + "/*.dat")
# final list that will c... |
da54803927d90f78464bc5b48f0c38297c03bdd1ebdbba70bbe069c7c69a6624 | Python | 2,580 | 99 | from __future__ import annotations
import numpy as np
import pytest
from quacc import job
from quacc.wflow_tools.job_patterns import (
kwarg_map,
map_partition,
map_partitioned_lists,
partition,
unpartition,
)
def test_partition():
@job
def simple_list():
return list(range(10))
... |
9e3fb88b778cdf045895f6b20033c6c58137d570621f27319509e57c3561df72 | Python | 2,581 | 65 | import torch
from torch_geometric.nn import MessagePassing
from torch_geometric.nn import global_add_pool, global_mean_pool, global_max_pool, GlobalAttention, Set2Set
import torch.nn.functional as F
from torch_geometric.nn.inits import uniform
from conv import GNN_node, GNN_node_Virtualnode
class GNN(torch.nn.Module)... |
e6bcca160378a9ba32ddc48b9a390a5bcd25b3b4db51b548d6607da64e2f276f | Python | 2,581 | 78 | import struct
import pandas
import numpy as np
from typing import BinaryIO
from typing import Tuple
from typing import List
from typing import Dict
from typing import Iterator
"""
This module contains convenience functions for reading and writing MERFISH
analysis results created from the deprecated Matlab pipeline.
"... |
18d5223936bea75f88227fdb91ce9d801e0e93e0fb4664d6166af81c7f62a3d8 | Python | 2,582 | 89 | import math
import cocotb
import pytest
from cocotb.clock import Clock
from cocotb.triggers import RisingEdge, Timer
from elasticai.creator.testing import CocotbTestFixture, eai_testbench
from elasticai.creator_plugins.peripherie.utils import load_and_plugin
@cocotb.test()
@eai_testbench
async def measure_trigger_d... |
40e8886d23ef3c25879b4642fb23a81d5c6a445538f830537fb3c7003db81ea5 | Python | 2,582 | 65 | """Zhuang MERFISH cell-density template: rasterisation logic + registry wiring.
The multi-hundred-MB cell-coordinate downloads are not exercised here; these cover
the deterministic parts - the coordinate->voxel rasterisation, the CCF PIR affine,
and the registry / config-menu wiring.
"""
import numpy as np
im... |
3162447912982ad8c22732c20723a17a073246c2ed48571438af275ac7736ae4 | Python | 2,583 | 87 | from common import *
from os import popen
import numpy as np
import cPickle
rmse = lambda x,y: np.mean([(float(iii)-float(jjj))**2. for iii,jjj in zip(x,y)])**0.5
r2 = lambda x,y: np.corrcoef(map(float, x),map(float,y))[0][1]**2
def find_key(k):
for i in nn_out:
if abs(i-k) < .00000001: return i
r... |
f128bb3d774bab59f36e3310e7479f8082117d39327376e16f8a63e5d2c2a917 | Python | 2,583 | 62 | """
EC codebase scripts and executables
These scripts should be run from the root of the repository, e.g.
python bin/<script>
For more usage examples, see the official_figures and official_experiments documents.
Module mapping details:
TODO: remove module mapping code when backwards-compatibility is no longer ... |
0f1d94cb73ab9b1fff3d7f1903ea202ebad65d5bcda7da244fda85a425b10e8e | Python | 2,584 | 55 | #!/usr/bin/env python
## this script visualizes the results of the anova movie comparison of the ISC values
## it reads in the results of the anova and visualizes the results on a glass brain
## it also writes the results to nifti files (if needed)
## import libraries
import os
import pandas as pd
import matplotlib.py... |
d5071569335608f0ae2318230c0e62abf073c92fb1f814b9d79fa1da8806acb8 | Python | 2,584 | 75 | import numpy as np
from scipy.optimize import lsq_linear, nnls
import fluorescentneurosurgery.data
from importlib_resources import files
import scipy.io as sio
BASIS_SPECS = sio.loadmat(files(fluorescentneurosurgery.data).joinpath('basisSpectra.mat')) #data is {String variable_name: Numpy Array matrix}
PPIX_634 = B... |
606f8954bec3d096470a2db130caeb1adce7f63e268f57ee7b44155905dc011b | Python | 2,585 | 90 | # 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... |
d6ccd111a891f69d07a384ea2c7727001a5cb0cea36d1f4b7c88fe7e67a3e87c | Python | 2,587 | 41 | # -*- coding: utf-8 -*-
import argparse
from supar import BiaffineSemanticDependencyParser
from supar.cmds.run import init
def main():
parser = argparse.ArgumentParser(description='Create Biaffine Semantic Dependency Parser.')
parser.set_defaults(Parser=BiaffineSemanticDependencyParser)
subparsers = par... |
1c070d4e4a9334d6a3fade4a460b182e63052736038ccfde34db302aacf5d9ff | Python | 2,588 | 56 | """
Created on Mon May 9 06:15:29 2022
@author: Haotian Teng
"""
import os
import sys
import time
import toml
import torch
import argparse
import itertools
import numpy as np
from matplotlib import pyplot as plt
from xron.nrhmm.hmm import GaussianEmissions, RHMM
from xron.nrhmm.hmm_input import Kmer2Transition, Kmer_... |
40f96e610142de1bbabc02cfe9dd2c3148210775f7e982e4b73cf9cc16565b99 | Python | 2,588 | 72 | import torch
import random
import numpy as np
def random_split(dataset, frac_train=0.8, frac_valid=0.1, frac_test=0.1,
seed=0):
"""
Adapted from graph-pretrain
:param dataset:
:param task_idx:
:param null_value:
:param frac_train:
:param frac_valid:
:param frac_test:
... |
38ea9b917163081390ece7867f08bf77da585c1835013431040860b50339b8a3 | Python | 2,590 | 90 | # Node-group asset "Normalize Field" (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... |
fd439a88b6caa4bb7b18c873a9b81f41fb0b85dc4573f4cd97bc744188a0787b | Python | 2,590 | 93 | # Node group ".Sample Atomic Attributes" (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 accessors ar... |
8f5161df5d116d5d8343d9ef92692abe58f7f20772b982a594b9c6c5b73cb093 | Python | 2,591 | 88 | """
pygments.plugin
~~~~~~~~~~~~~~~
Pygments plugin interface. By default, this tries to use
``importlib.metadata``, which is in the Python standard
library since Python 3.8, or its ``importlib_metadata``
backport for earlier versions of Python. It falls back on
``pkg_resources`` if not fou... |
1b827983968d28fcbdecf9ae944c3955320a4c84959539ea058529561e4b3bea | Python | 2,592 | 65 | # coding=utf-8
# Copyright 2020 The Google AI Team, Stanford University and The HuggingFace Inc. team.
#
# 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/L... |
2f0083134c0318b86096e295bae749d9dbc8c35797122fbf6356d084335ccf93 | Python | 2,593 | 55 | #!/usr/bin/env python
## this script visualizes the results of the anova movie comparison of the ISC values
## it reads in the results of the anova and visualizes the results on a glass brain
## it also writes the results to nifti files (if needed)
## import libraries
import os
import pandas as pd
import matplotlib.py... |
07b5dd0bbaeeada238c625d10f63668a9919a6ae75b2404309690a9240a63672 | Python | 2,594 | 89 | import torch
import pytest
import numpy as np
@pytest.fixture(scope="session", autouse=True)
def set_seed():
np.random.seed(42) # noqa: NPY002
import logging
from ase.io import read
from pathlib import Path
from quacc import get_settings
from ts_workflow_examples.neb_ts_with_hessian.using_newtonnet import ne... |
542460ec13d574b5e0b5ebc48bbb7f8828495ba93a7ce68ed06caa47f9bf311c | Python | 2,594 | 75 | """distutils.command.clean
Implements the Distutils 'clean' command."""
# contributed by Bastian Kleineidam <calvin@cs.uni-sb.de>, added 2000-03-18
import os
from ..core import Command
from ..dir_util import remove_tree
from distutils._log import log
class clean(Command):
description = "clean up temporary file... |
d9faeffd607e8785cc8f6a4bb23dc95685876b64eaf4a39c56b844f51b3dc2ef | Python | 2,594 | 77 | # 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... |
0539167c50eb585c2e4a87489a3b5b021f3008bde2b1e71b9e34dbe44e945032 | Python | 2,595 | 84 | # Extracted from https://github.com/pfmoore/pkg_metadata
from email.header import Header, decode_header, make_header
from email.message import Message
from typing import Any, Dict, List, Union
METADATA_FIELDS = [
# Name, Multiple-Use
("Metadata-Version", False),
("Name", False),
("Version", False),
... |
7ff84920114d2c8ff30f3b857da31b884e3a41a17fe7a0bd49bb0c329337e42d | Python | 2,595 | 102 | import math
import numpy as np; #import tensorflow as tf
import matplotlib.pyplot as plt
from tqdm import tqdm
import sys
import seaborn as sns
import pandas as pd
import torch
from scipy.io import loadmat
import pickle
def normalise(data, axis):
minimum= data.min(axis=axis, keepdims=True)
maximum= data.max(a... |
d264fe7f981c17f7509c116644701e3947a6cf0d3a537e646d3ffae2ad491ef6 | Python | 2,595 | 71 | import os.path
import pandas as pd
from google.protobuf.json_format import Parse
from ord_schema.message_helpers import find_submessages
from ord_schema.proto.reaction_pb2 import Reaction, Compound, ProductCompound
from tqdm import tqdm
from ord.evaluation.evaluate_functions import FilePath
from ord.utils import Deep... |
52d909942a2b81b0b0a72e350ddeb30db5c4c9c48c36d9acabe7bd363038dce9 | Python | 2,596 | 79 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# ------------------------------------------------------------------------------
from __future__ import absolute_import
from __futu... |
cf568de476187becf36fec295a39975d746925815f0f20cc50c25c65e56156ab | Python | 2,596 | 68 | """Tests for the Allen CCF 10um atlas option.
Qt-free: covers the registry resolution and the pipeline-CLI choice that make
the 10um Allen CCF selectable from the GUI (registration_tab drives these).
The GUI dropdown wiring itself is exercised by the existing headless preview
tests; here we pin the framework-free... |
ea30a919b3256aabdef86747e697ecfc4d6d63d675830c4c6e0d70aa5a845a60 | Python | 2,596 | 74 | import random
import cocotb
import pytest
from cocotb.triggers import Timer
from elasticai.creator.arithmetic import int_arithmetic
from elasticai.creator.testing import CocotbTestFixture, eai_testbench
from elasticai.creator_plugins.adders.utils import load_and_plugin
def adder_model(a: int, b: int, bitwidth: int,... |
ae9f53497e085f71a60d35fba491aa1e8aea15147ea513723f8b4c5c5d184591 | Python | 2,597 | 74 | from unittest import TestCase
from pyseg.globals import *
from pyseg.graph import SkelGraph
from pyseg.disperse_io import *
import vtk
from astropy.io import fits
__author__ = 'martinez'
class TestPointGeometry(TestCase):
def test_Class(self):
# TODO: skel_small.vtp is not a proper input
# Readi... |
b7a0828c426ac7c96cb7c6b35c292292e0832cb973659ee2d5af7ccc897d83f3 | Python | 2,597 | 78 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2022 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : run_arbor_r2.py
# Author : Yufeng Liu
# Date : 2022-10-14
# Description :
#
#==================... |
b8fccb3e71b0d58130b1f4013167f615a013b216d6850a24064c3267a50ac02b | Python | 2,597 | 79 | from typing import cast
import elasticai.creator.nn.fixed_point as nn_creator
from elasticai.creator.file_generation.in_memory_path import InMemoryFile, InMemoryPath
def test_vhdl_code_matches_expected_prelu() -> None:
expected = """-- /////////////////////////////////////////////////////////////////////////////... |
bc8b1ef00df04b8f6af79379ed86baf340fbaa4bb05645ceddf77dc99252c606 | Python | 2,597 | 75 | import unittest
import torch
import numpy as np
from torcheeg.transforms import BaselineRemoval, Lambda, Compose, ToTensor, Resize, RandomNoise, RandomMask, BandDifferentialEntropy, MeanStdNormalize, ToGrid, Select, Binary
from torcheeg.datasets.constants import DEAP_CHANNEL_LOCATION_DICT
class TestAnyTransforms(un... |
fa289cedc7c6eb671821e67624266f425cb9453b2c00860cdbe6eeea5151b888 | Python | 2,597 | 79 | from functools import partial
from elasticai.creator.nn.fixed_point.linear.layer import Linear as FPLinear1d
from ._common_imports import (
Design,
InProjectTemplate,
Path,
Port,
Signal,
calculate_address_width,
module_to_package,
std_signals,
)
class LSTMNetworkDesign(Design):
d... |
652fa1722b197353c24d383066ea2c69522218d4a33fc62f081dec4a25b21798 | Python | 2,598 | 71 | # Node-group asset "Curve Transform" (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... |
3787c9b8620bb716180e9314cd4dcdaa2a6d5378d5312df4740f82bd560ae150 | Python | 2,599 | 73 | import pandas as pd
import numpy as np
import os
import pysam
fa_file = os.path.join('../hg38.fa')
fa = pysam.FastaFile(fa_file)
# Get HAR sequence (Reference Genome and SNC Altered Genome)
HAR_df = pd.read_csv('../GSE180714_HARs.bed', sep='\t')
HAR_df.index = HAR_df['HAR_ID']
HAR_df = HAR_df.drop_duplicates()
Overl... |
b9f4d5399518c67e327ecab8d1a7993ae609ef45a80fa8795648287074683abf | Python | 2,599 | 60 | from __future__ import annotations
from pathlib import Path
import pytest
pytest.importorskip("phonopy")
pytest.importorskip("seekpath")
from ase.build import bulk
from quacc.recipes.emt.phonons import phonon_flow
def test_phonon_flow(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
atoms = bulk("Cu")... |
80c90fad397b204719148cf549653fcba7e998cdbc056342db086a93f11918ac | Python | 2,600 | 95 | from tqdm import trange
import numpy as np
def action_perception_loop(
env,
agent,
steps=100,
stop_when_done=True,
record_frames=True,
record_agent_info=False,
progress_bar=True,
observable_reward=True,
callbacks=None,
observable_light=False,
):
obs, _ = env.reset()
a... |
a72cff2db2af0fe8d5a9d8511d4891e7f8f0a3d29d6d9787a742592943fb679f | Python | 2,600 | 62 | from typing import Dict, Sequence, Union
import torch
from torch.nn.functional import interpolate
from ..base_transform import EEGTransform
class Resize(EEGTransform):
r'''
Use an interpolation algorithm to scale a grid-like EEG signal at the spatial dimension.
.. code-block:: python
transform... |
2b415db2f652d97d73945dfab1542c2e4d4ebaa8cc557118c219626f9eee4337 | Python | 2,601 | 63 | """
Optuna example that optimizes a simple quadratic function with constraints.
This setup is called `constrained optimization`.
Constrained optimization is useful when we would like to optimize some metrics under
some constraints. For example, we would like to maximize the accuracy of a deep neural networks
while gua... |
2985437adaa8a1ec56068987baab13c99556a0f285d81845d87f17e6687edd1b | Python | 2,602 | 78 | import numpy as np
from scipy.spatial.distance import *
import bct
from struct_consensus import struct_consensus
import os
from utils import make_dir
direc = os.path.abspath('../../data/preprocessed_data/')
scaling_path = os.path.join(direc, 'scaling_analysis')
make_dir(scaling_path)
#loading Euclidean distance mat... |
335c0b72cbcaac0d9ac42a9ec12dbe6676cbf5cf53433227ee2071963ad1efd9 | Python | 2,602 | 42 | # -*- coding: utf-8 -*-
import argparse
from supar import CRFConstituencyParser
from supar.cmds.run import init
def main():
parser = argparse.ArgumentParser(description='Create CRF Constituency Parser.')
parser.set_defaults(Parser=CRFConstituencyParser)
parser.add_argument('--mbr', action='store_true', ... |
f1569973b8f7b29b04330025bd45ec4192c9f972f3cd72e8e81b2b5dff1019ed | Python | 2,602 | 41 | """posthoc_v2r_per_side_2026-10-02.py (post hoc, after DAMPING_SOURCE's per-side reading of the LEFT v2LN30). Does the
RIGHT v2LN30 (root 720575940614956072), made excitatory, break its own side the same way? Whole brain, my simulator,
50 channels x 3 trials, seed 11 (as DAMPING_SOURCE and WB_KEYSTONE). usage: python... |
5d640575045e70a13de5e78c6ab0358c9909eaf868fb0774febb363dab67e7e8 | Python | 2,603 | 55 | #!/usr/bin/env python
## this script visualizes the results of the anova movie comparison of the ISC values
## it reads in the results of the anova and visualizes the results on a glass brain
## it also writes the results to nifti files (if needed)
## import libraries
import os
import pandas as pd
import matplotlib.py... |
c67a723b9f29cb034da414d36e1bb1c09ecfcddce137f84066a41323f2f21936 | Python | 2,603 | 75 | # Node group ".MN_constants_atom_name_nucleic" (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 access... |
698ecc34900f2068d4f220924f35441e21020059b8e3bd45877b45cf15b269e3 | Python | 2,604 | 83 | """RegistrationTab drains its worker QThreads on teardown.
A QThread still running when the tab is destroyed aborts/hangs the process on
Windows ("QThread: Destroyed while thread is still running"). _shutdown_workers()
- called from closeEvent, and by the conftest autouse fixture after each test -
quits+waits eve... |
7f42ed21df11b2abd996cd473c8e7274c6c6d3caa26fc69e7737c57148ab4893 | Python | 2,604 | 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... |
a27deeb570118a1ffb2a4c801199d925fe22abad557ae36187a6174aca868fdf | Python | 2,604 | 56 | import numpy as np
def before_hook_normalize(data: np.ndarray,
eps: float = 1e-6,
axis=0) -> np.ndarray:
r'''
A common hook function used to normalize the signal of the whole trial/session/subject before dividing it into chunks.
It is used as follows:
... |
146b4bae5a541907829562ce6bf2fbc056e41372dbec0fa59766f9e0a55cce6a | Python | 2,605 | 82 | from unittest import TestCase
from codex.data.versions import (
DEFAULT_DATA_SNAPSHOT_VERSION,
)
from codex.utils import stats
from tests import get_testing_neuron_db
class Test(TestCase):
def test_format_for_display(self):
self.assertEqual(
{"d1": {"a": "6,555"}, "d2": {"b": None, "c": 0... |
29bd9d1de74ef0e22ecb9ee36ee82ac5324e7db0a2c765837f7b847d7bf890ca | Python | 2,605 | 83 | from os.path import join as pjoin
import os
from dimension_encoding.b5k import B5kLoader
from scipy.stats import zscore
from dimension_encoding.glm import LinRegCVPermutation
import argparse
def parse_arguments():
parser = argparse.ArgumentParser(
description="Replicate our behavioral dimensions brain fit... |
57aa592a2ad6f61980aaa645de98af121b7f9f7479c355062d46c257b11d11dd | Python | 2,605 | 87 | 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("... |
b79d240adf185dc4c2f62eeea8e41851857c75382b041ccb5708acdf23d908a8 | Python | 2,605 | 84 | from torch import Generator
from torch.utils.data import DataLoader
from pathlib import Path
from ..prixfixe import DataProcessor
from .utils import (preprocess_df,
DataloaderWrapper)
from .dataset import SeqDatasetProb
class AutosomeDataProcessor(DataProcessor):
def __init__(
... |
cfed590b344411f5f0f5262de57da9abd03c08a27d55bd27c23ba0af68dd0582 | Python | 2,605 | 71 | import numpy as np
import sys
from theano import function
from theano import tensor as T
_, model_path, sigma = sys.argv
from pylearn2.utils import serial
model = serial.load(model_path)
from pylearn2.config import yaml_parse
dataset = yaml_parse.load(model.dataset_yaml_src)
dataset = dataset.get_test_set()
from pyle... |
d4834b3d37e2a3c6ce7edd11489564ea2a90042c728bd58d3406c072b3dfdee8 | Python | 2,605 | 79 | from typing import cast
import elasticai.creator.nn.fixed_point as nn_creator
from elasticai.creator.file_generation.in_memory_path import InMemoryFile, InMemoryPath
def test_vhdl_code_matches_expected_prelu() -> None:
expected = """-- /////////////////////////////////////////////////////////////////////////////... |
69c289eb07e4a2119145e9002f010a32a16a4dfd20c641507829f1d9a0980d7d | Python | 2,606 | 100 | from __future__ import annotations
import pytest
prefect = pytest.importorskip("prefect")
from pathlib import Path
from quacc import flow, get_settings, job, redecorate, strip_decorator, subflow
from quacc.wflow_tools.customizers import customize_jobs
def test_strip_decorators():
@job
def add(a, b):
... |
a0005cec1cebc25b0888d922f4990f18722ff1d8ef339f00204f5bc7bdd25fc2 | Python | 2,606 | 69 | # split_rules: Split rules whose conditions fall into different "connected
# components" (where to conditions are related if they share a variabe) into
# several rules, one for each connected component and one high-level rule.
from pddl_to_prolog import Rule, get_variables
import graph
import greedy_join
import pddl
... |
e0fd8d3126a710bdb3c5fccbd10fa0fa70778f59c1560d09272686cce75c82f2 | Python | 2,607 | 48 | """
June 2024 by Paulien Voorter
paulien.voorter@gmail.com
https://www.github.com/paulienvoorter
Code is uploaded as part of our paper in MRM: 'Diffusion-derived intravoxel-incoherent motion anisotropy relates to CSF and blood flow'
"""
import torch
import numpy as np
#most of these are options from the article a... |
27a18d42b88441eb86978b0441c149c11cd71f561bd679969dcbfe9e83ee9e18 | Python | 2,608 | 92 | from .utils import AtomsDataset, register_dataset
from typing import List, Optional, Union
from ase import Atoms
from ase.io import read
from ase.db import connect
@register_dataset("ase")
class ASEData(AtomsDataset):
def __init__(
self,
frames: Union[List[Atoms], str, None] = None,
indic... |
c80cd511145daf776e27e652704b0405aeb30482f42fd1cae3655fad852c85ab | Python | 2,608 | 64 | """
https://github.com/MIPT-Oulu/Collagen/blob/master/collagen/modelzoo/segmentation/_model_wrapper.py
"""
from torch import nn
from model_utils.modules import Module
from model_utils.segmentation import backbones
from model_utils.segmentation import constants
from model_utils.decoders import FPNDecoder
from model_ut... |
b9e5efd5188c2c0b9c693b84bd70025d7e51eb8fd6726f1bd59b6ac7845de712 | Python | 2,609 | 53 | from typing import Any, Dict, Sequence
from pip._vendor.packaging.markers import default_environment
from pip import __version__
from pip._internal.req.req_install import InstallRequirement
class InstallationReport:
def __init__(self, install_requirements: Sequence[InstallRequirement]):
self._install_re... |
1294a2378bc40f8c4581c5b63dd247db019f159a1acbec83df7bb76dbfe43104 | Python | 2,612 | 79 | import argparse
import numpy as np
def generate():
parser = argparse.ArgumentParser()
parser.add_argument('--vocab_file', default='vocab.txt', type=str)
parser.add_argument('--vectors_file', default='vectors.csv', type=str)
args = parser.parse_args()
with open(args.vocab_file, 'r') as f:
w... |
25189812303d90b901e678e5446dbac206dd6c4a062cc976982f099efd73bf23 | Python | 2,612 | 69 |
# Collect predictions
from glob import glob
from pathlib import Path
import sys
from unittest import skip
import pandas as pd
import numpy as np
# sample used
pipe = sys.argv[1]
#opts = '_averaged-source_Schaefer400x17_WM+CSF+GS_hcpaging_695_zscored-beh_'
#opts = '_averaged-source_Schaefer400x17_WM+CSF+GS_hcpya_771... |
29a27c76b8c59892eeebc5fadf6a5ac62b6a0fce16f09966374314a6989b731c | Python | 2,612 | 56 | # Extraction of MeSH qualifiers Associations in PubMed
from Bio import Entrez, Medline
import os
Entrez.email = 'turkiabdelwaheb@hotmail.fr'
with open('output/rellist.tsv') as f:
data = f.readlines()
data = [word.replace("\n", "") for word in data]
# Getting the MeSH ID of the subject and object as well as the Wi... |
ac23b07c462c9340115807788488757a56a3fb71533717bea132a1c2b0657a69 | Python | 2,612 | 86 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 4 15:00:55 2023
@author: emma
"""
SEED=1
import numpy as np
import pandas as pd
import tensorflow as tf
tf.random.set_seed(SEED)
from tensorflow.keras.layers import Dense
def get_reweigh_params(dataset):
'''
from the training data file,... |
5300aa1cfeafcb7a7ad259c140c80cfc131cc088b55d556715144ac18ee26878 | Python | 2,613 | 76 | """
Specifies parameters common to different individual tomogram (synapse)
processing scripts in order to make setting up multiple scripts easier.
This file is normally placed in another directory at the seme level as this
on (e.g. ../common). Scripts that need to use parameters defined here need
to import this scri... |
8ebe8ec7aa2109fb6e25db1040f5a9a871f41aa1f466a1721ce95d643381ff42 | Python | 2,613 | 62 | #! /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 = ["issue535-base", "issue535-v6"]
CONFIGS = [
IssueConfig(
... |
d1565eff927e590e878fa7a1afae5b8ad4fc369ac4268268f8815e7ac651939c | Python | 2,613 | 96 | import matplotlib.pyplot as plt
import numpy as np
import meep as mp
resolution = 50 # pixels/μm
cell_size = mp.Vector3(14, 14)
pml_layers = [mp.PML(thickness=2)]
# rotation angle (in degrees) of waveguide, counter clockwise (CCW) around z-axis
rot_angle = np.radians(20)
w = 1.0 # width of waveguide
geometry =... |
0ae0512e1ddf216aaab523f6f276c447775b9d0924358995a98b7af7f168f11b | Python | 2,615 | 83 | # Node group "Sorted Bundle Paths" (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 accessors are rege... |
b8e585b65f8e1f8387fad712a1a12c8b18438f842c63204d249021f90506c613 | Python | 2,615 | 66 | import os
import wget
url_dict = {
"train_pbmc": "https://www.dropbox.com/s/wk5zewf2g1oat69/train_pbmc.h5ad?dl=1",
"valid_pbmc": "https://www.dropbox.com/s/nqi971n0tk4nbfj/valid_pbmc.h5ad?dl=1",
"train_hpoly": "https://www.dropbox.com/s/7ngt0hv21hl2exn/train_hpoly.h5ad?dl=1",
"valid_hpoly": "https://... |
3f32da8182955606152c48fe10c3b9d513e0ee69d1380949b544cbc857da69cf | Python | 2,616 | 71 | import math
import numpy
from OnlineDetectors.online_nab_detector import OnlineAnomalyDetector
def normalProbability(x, mean, std):
"""
Given the normal distribution specified by the mean and standard deviation args, return the probability of
getting samples > x. This is the Q-function: the tail probabil... |
4d733be48fa2ccf56913a164ce9550216ea001cafe391b97158da1a06b0145fb | Python | 2,616 | 62 | """The napari reader must be discoverable through packaging, not only at runtime.
``register_with_napari()`` registers the manifest on the npe2 PluginManager
singleton of the CURRENT process - it works for viewers regtools constructs
itself, but it cannot make the plugin visible to a napari process regtools did
n... |
b20009f264bd988b5231a1019530731e08ac58bfc74a683dc89efb41d06272a7 | Python | 2,616 | 75 | """Headless tests for the GUI h5ad field-picker dialog."""
import os
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
import numpy as np
import pandas as pd
import anndata as ad
import pytest
pytest.importorskip("PySide6")
from PySide6.QtWidgets import QApplication
from regtools.registration.gui.r... |
fd50228cc0bd2adfb887f3e6dc1eb7f04a645359f43a6d64e6bba664c2c86f64 | Python | 2,616 | 90 | from collections import defaultdict
import numpy as np
from typing import List
from src.data_analysis.constants import *
from src.data_analysis import Assessment
class ReyFigure:
def __init__(self, fn: str, age_group: int):
self.__filename = fn
self.__age_group = age_group
self.__assessm... |
300a06b0efe09a7ba81bea597331a7e70a73a372d1bf271862255e8b59a40a79 | Python | 2,617 | 84 | # set QT_API environment variable
import os
import glob
import argparse
os.environ["QT_API"] = "pyqt5"
import qtpy
import sys
# qt libraries
from qtpy.QtCore import *
from qtpy.QtWidgets import *
from qtpy.QtGui import *
# app specific libraries
import control.gui_hcs as gui
from configparser import ConfigParser
fr... |
586ee77d4d369261ffa1168f495ff4da1eb8bc0003a1a1fe077ef3dbd985fc6e | Python | 2,617 | 83 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
import numpy as np
import os
import albumentations as A
import torchvision.transforms as transforms
from timm.models.layers import to_2tuple
def build_target(label, num_class):
target = label.clone()... |
ea60691aa363820156738a83d9c7ab415f3381c419b75153b69b452b7923c3eb | Python | 2,617 | 96 | from typing import Any, List, Dict
import torch
from pytorch_lightning import LightningModule
import hydra
from dms import DMS
from cl_3d.models.components.layers import GatherLayer
from cl_3d.utils.loss import contrastive_loss
from cl_3d import utils
log = utils.get_logger(__name__)
class ContrastiveLitModule(Li... |
3ee11145d2c57dbf935431bf06235955e52421abcf2bf42075369e2c05d48e26 | Python | 2,618 | 33 | """posthoc_uncalled_origin_2026-09-30.py (POST HOC, descriptive; answers a review point: is the "default" really a default?)
For the 150 antennal-lobe local neurons without a FlyWire nt_type call: where does the sign in Shiu et al.'s v783 file come
from, and what do their own synapses vote? Output: 06-OUTPUT/posthoc_un... |
b3a63796ada53ef2e044f46362790613e275dd09c8615b6eef3b204e59a51f91 | Python | 2,618 | 56 | import wandb
import os
import numpy as np
import torch
from datetime import datetime
class CheckpointSaver:
def __init__(self, dirpath, model_name, decreasing=True, top_n = 5):
"""
dirpath: Directory path where to store all model weights
decreasing: If decreasing is `True`, then lower met... |
317ffbc3a3143d27b7f07458b92b9a44ecec3add2d5940bbb31c0582647787da | Python | 2,619 | 100 | from __future__ import annotations
import pytest
prefect = pytest.importorskip("prefect")
from pathlib import Path
from quacc import flow, get_settings, job, redecorate, strip_decorator, subflow
from quacc.wflow_tools.customizers import customize_funcs
def test_strip_decorators():
@job
def add(a, b):
... |
87a2207d576b38cf651462d8d84abe553e15297b4e9209b643e48bc7b5333178 | Python | 2,619 | 150 | from __future__ import annotations
"""
MorphoGlia raw-preprocessing presets.
Public presets
--------------
MG1
Full MorphoGlia fluorescence workflow.
MG2
Background subtraction + directional grayscale enhancement.
MG3
Compact Gaussian-background workflow.
MG4
Compact percentile-background workflow.... |
a82d3286afaf9b3586aa5370b18d38d4652ce31f438f13c9be12ccaf0423f01e | Python | 2,619 | 57 | import os, h5py, math
import numpy as np
import pandas as pd
import tensorflow as tf
from optparse import OptionParser
from tensorflow import keras
from keras.models import load_model, Model
from keras import backend as K
from deepexplain.tensorflow import DeepExplain
batchsize = 500
def main():
usage = 'usage: ... |
263a455b2d55aa484df2e885867354ae39897e98f666914084a804f2b74f5820 | Python | 2,620 | 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... |
639a247ecc47f1fd0c03e37372740b5c4a7abc10f40d6ddef38cfd759c3e95ed | Python | 2,620 | 106 | import numpy as np
from scipy.io import loadmat
# Import neural networks models
from models import MLP, MLP_KAN, \
Hu1DCNN, Hu1DCNN_KAN, Hu1DCNN_FULL_KAN, \
M1DCNN, M1DCNN_KAN, M1DCNN_FULL_KAN, \
Luo3DCNN, Luo3DCNN_KAN, Luo3DCNN_FULL_KAN, \
He... |
7eedcd38271c9f019cf352ef8ca7bba644f2177045cdea882da150431f0588d0 | Python | 2,620 | 110 | # XuLab-RegTools Utilities
# Common utilities shared across the codebase
from .io.tiff_io import (
read_tif_section,
read_tif_wrapper,
get_stacked_data,
read_multipage_tif,
read_tif_page,
is_multipage_tif,
get_tif_page_count,
)
from .cell_utils import get_cell_locations, remove_... |
c721567df5045d8836f37607472337be927454b60c10c5da55f6d28bb249af0c | Python | 2,620 | 53 | import sys
import os.path
from ckg.graphdb_builder import builder_utils
from ckg.graphdb_builder.experiments.parsers import clinicalParser, proteomicsParser, wesParser
from ckg import ckg_utils
ckg_config = ckg_utils.read_ckg_config()
log_config = ckg_config['graphdb_builder_log']
logger = builder_utils.setup_logging(... |
6a6303e1679430b0c0e5e716933b11465e6dfaa952995c00d11632b26c23f586 | Python | 2,621 | 62 | #!/usr/bin/env python
import os
import pandas as pd
import matplotlib.pyplot as plt
from nltools.data import Brain_Data
from nltools.mask import expand_mask
from nilearn import plotting as nplot
import warnings
warnings.filterwarnings("ignore") # suppress warnings
## location of main project directory on HPC
projpa... |
a98a3f1eeed9ad61e33bbadb14d3cafaffed429472015c1cfdad40fc3b0a37f5 | Python | 2,621 | 63 | """The Nissl downloader must agree with the registry on where files land.
The registry declares Nissl variants at ara_nissl_{25,10}.nii.gz in the CCF
template dir; the downloader must write exactly those paths (converting the Allen
NRRD with the same PIR affine as average_template, since Nissl shares the grid).
I... |
b67f49434472ce31347a09a33603e40adffdfe495cb2d537e5bc0d26f5e07d81 | Python | 2,622 | 87 | """Misc helpers: bounding box, equal-arc-length interpolation, overlap."""
from __future__ import annotations
from typing import Tuple
import numpy as np
def bounding_box_corners(image: np.ndarray) -> np.ndarray:
"""Return the 9 reference corners of the bounding box of a binary image.
Port of ... |
d208b94fa313c801d13f4790ae5bb8eb2118b9180e50544f0df33da851d19a85 | Python | 2,622 | 70 | import matplotlib
matplotlib.use("Agg")
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
from utilities.script_func import init, post, ScikitFeat_pre
import pickle
import logging
logging.info("")
def main():
import Models.models as Models
import Models.model_func as Model_F... |
bf678cfd9b094cd494f0624bd085fc274965e1d6515cf5532a1d525ed22d0a5a | Python | 2,623 | 73 | import argparse
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
from tabulate import tabulate
from src.inference.model_initialization import get_classifiers_checkpoints, init_regressor, init_classifier
from src.inference.predict import do_score_image
from constants import RESULTS_DIR
f... |
fd2bef36aab446976b0b2e59cf0bdddbdda27a626c7c28381824ebdb85db29a3 | Python | 2,623 | 71 | from elasticai.creator import ir
from elasticai.creator.ir2vhdl import Shape
from elasticai.creator.ir2vhdl import factory as _factory
from elasticai.creator_plugins.grouped_filter import FilterParameters
def network(
input_shape: tuple[int, ...], kernel_size: int, out_channels: int, stride: int = 2
):
out_le... |
0bbe23280f5fa2f4c10a7a4e58679a2455ce702179dd86f0f9bb122b64f187bf | Python | 2,624 | 66 | import os
from tempfile import mkdtemp
from urllib.request import urlopen, urlretrieve
from ..modules.flagser_pybind import AVAILABLE_FILTRATIONS
files_with_filtration_results = ["d5.flag"]
large_files = ['medium-test-data.flag', 'd10.flag']
def pytest_addoption(parser):
parser.addoption("--webdl", action="stor... |
28b7b4866df3a6e75882d6bf7f5b89a8f264d1eabaaea7dd2d7d77c055df3056 | Python | 2,624 | 86 | import fnmatch
import cocotb
from cocotb.clock import Clock
from cocotb.triggers import FallingEdge, RisingEdge, Timer
from elasticai.creator.testing.cocotb_func import all_within_tolerance
from elasticai.creator.testing.cocotb_prepare import read_testdata
@cocotb.test()
async def layer_computation_test(dut):
d... |
2c78a2375e077cbed9483f6209c1b4791d92baeceddd6293150cecaf14a50f3b | Python | 2,624 | 62 | """Implementation of CLI find command."""
from treem.morph import Morph
from treem.io import SWC
def find(args): # pylint: disable=too-many-branches
"""Locates single nodes in morphology reconstruction."""
morph = Morph(args.file)
types = args.type if args.type else SWC.TYPES
nodes = filter(lambda x... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.