sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e3e3c2ce02d4a40419c638f445e58711ee24afc544444f4e93cf8b94c7518dfe | Python | 3,153 | 110 | from maldi_nn.utils.data import DRIAMSSpectrumDataModule
import torch
from maldi_nn.spectrum import *
import h5torch
import sys
import argparse
def boolean(v):
if isinstance(v, bool):
return v
if v.lower() in ("yes", "true", "t", "y", "1"):
return True
elif v.lower() in ("no", "false", "f"... |
524e3ae1cb73db3b7407038fd26b25de946f6b9bedbce85c3d72b366de23f6f2 | Python | 3,154 | 102 | # Node-group asset "Clear Instance Transforms" (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 T... |
a4f80cec25d13ee63ab34f1077dfc3ce29412b682755ca69d80425348b442495 | Python | 3,154 | 86 | from dataclasses import dataclass
import numpy as np
from imutils import rotate_bound
from skimage import transform
from scipy.ndimage.interpolation import map_coordinates
from scipy.ndimage.filters import gaussian_filter
from src.preprocessing.helpers import cutdown, resize_padded
@dataclass
class AugmentParameter... |
d7a99c2e6855e33bfab8b4e89789f52bd744c44fed9b957702f5584014ca2657 | Python | 3,155 | 83 | import lightning.pytorch as pl
import torch
import torch.nn as nn
from model import initialize_weights
from torchmetrics import PearsonCorrCoef
from training_config import TrainingConfig
class LitModel(pl.LightningModule):
def __init__(self, tr_cfg: TrainingConfig):
super().__init__()
s... |
3a0cbfb804ca29ea837ce147fb311f0ad3dacde2b9752abd4986590a5cc28fbd | Python | 3,156 | 106 | # %%
import sys
import os
sys.path.append(os.path.abspath("../.."))
sys.path.append(os.path.abspath("../../.."))
sys.path.append(os.path.abspath("...."))
sys.path.append(os.path.abspath("..."))
sys.path.append(os.path.abspath(".."))
sys.path.append(os.path.abspath("."))
# %%
import torch
import pandas as pd
from path... |
68691aab8f1897a36d7e389a2982d20c7965391e4ca7c4f115b26c386f2beab6 | Python | 3,156 | 56 | """BUILD_COMMITMENT.py 2026-09-30. A dated fingerprint of unreleased work.
Zips my code, pre-registrations, outputs, sandbox and report draft (sorted, fixed timestamps: the same files give the same
zip), keeps the zip outside the project, and writes the only file meant for publication: the SHA-256 of the zip and of its... |
12016bfd3f492a768190c94b65a7ac16cddc8a626a7ab1ae63336d8c6e87f12f | Python | 3,158 | 75 | """RGB composites must render with levels matching their own value range.
Regression guard for the "red/cyan overlay is a big white box" and "foreground-init
preview is all white" reports. ``_show_array`` seeds percentile levels for a
grayscale slice; ``_show_rgb`` used to call ``setImage(..., autoLevels=False)``... |
5b92c1d49b6fc52fa57ce410003282b1191634fd2220e89e0615dce8220a7668 | Python | 3,158 | 122 | import numpy as np
import pandas as pd
import torch
def average_structures(X, tids):
'''
Averages the coordinates of all distinct structures of each protein
Parameters
----------
X: np.ndarray
The latent coordinates of all structures
tids: list
The protein target ids of each s... |
a6e310e6b763e59ff16621dd385b862ccca6604870092700eecac40006431e81 | Python | 3,158 | 80 | #!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import numpy as np
from pybullet_tools.pr2_problems import create_floor, create_table
from pybullet_tools.pr2_utils import get_top_grasps, get_side_grasps
from pybullet_tools.utils import connect, get_pose, set_pose, Point, disconn... |
5c2076f7c019128ae12ac290f5d576cd39637bb04a09c6bec57bcdd38eca7782 | Python | 3,159 | 105 | """
Select randomly a set of rows of an input STAR file
Input: - Input STAR file
- Number of rows for the output STAR file
- A list with the classes to consider
Output: - Output STAR file
"""
__author__ = 'Antonio Martinez-Sanchez'
###### Global variables
################# P... |
e10069d5e4638b50a9ed476c54e3b1f10ff30014df5ef767488fdd7216b77397 | Python | 3,159 | 96 | '''
Script that docks compounds using vinaGPU.
NOTE: This script requires a folder with the .pdb files of the kinases
and a folder containing the coordinates of the boxes that surround the binding pocket for each kinase structure.
'''
import os
import pandas as pd
from vinagpu import parallel_dock
import time
def pr... |
15ec152755cf9270897ad75b61690c28b5cfab641025608fc30797cde5a67acf | Python | 3,160 | 75 | import pytorch_lightning as pl
from albumentations import Compose
from albumentations.augmentations.geometric import transforms
from torch.utils.data import DataLoader
from data_loading.phdfm import PHDFM
class PHDFMDataModule(pl.LightningDataModule):
def __init__(self, **kwargs):
"""
Initializa... |
55c8401c9b139bb874e25733c580bb6732a47147e0c677302863f9c08c4d130e | Python | 3,160 | 93 | #! /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... |
20486bf14d80e325279a5c940f56b8a6e44a94a0c339161ba0b69585274938e6 | Python | 3,161 | 67 | from torch.utils.data import Dataset
from torchvision.datasets.folder import ImageFolder, default_loader
import os
import numpy as np
RSNA_MEAN = (0.24190991913821105, 0.24190991913821105, 0.24190991913821105)
RSNA_STD = (0.06858030350893875, 0.06858030350893875, 0.06858030350893875)
class RSNAData(ImageFolder):
... |
7e4c93717e03e30c653136e1c2e18040566a920ea676afc7bf800c0f8df1b816 | Python | 3,161 | 120 | #!/usr/bin/env python3
"""Prepare analysis-ready SEA-AD cell metadata.
This joins AnnData cell-level metadata to SEA-AD CPS scores. It does not analyze
gene expression and does not generate biological findings.
"""
from pathlib import Path
import pandas as pd
import scanpy as sc
ROOT = Path(__file__).resolve().par... |
a5d917f9e8970a9c42881a22ec96fe03ae22b90f09e705baba7c241647036a37 | Python | 3,161 | 84 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 5 11:07:50 2023
@author: emma
Protected group models: fine tune model on each bias group
based on Puyol-Anton et al,"Fairness in Cardiac MR Image Analysis: An Investigation of Bias Due to Data Imbalance in Deep Learning Based Segmentation" (2021)... |
fe39ceca4fe67d84f73488979e1b77f11bf4b1af9c8aee529327626cb19a5d73 | Python | 3,163 | 105 | # Node-group asset "Evaluate Ordered Bundles" (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 TY... |
2f9f39d31ecf3e151b5c8e003e03ba2aba158a4e05b5b8c01b7504cde70df69c | Python | 3,164 | 94 | import pytest
import numpy as np
from scipy.linalg import eigh, lstsq
from test_utils import get_matrix
from sella.hessian_update import (
update_H, symmetrize_Y, _MS_TS_BFGS, _MS_PSB,
)
@pytest.mark.parametrize("dim,subdim,method,symm, pd",
[(10, 1, 'TS-BFGS', 2, False),
... |
41a86d29d86af32247d0a26fdab91218984000ac87d592738e365af4a86a2a50 | Python | 3,165 | 78 | #
# 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,... |
42aa9a5db9e37fea8ee99f8ed0cfb22b3558bcb1a083d496f6654c8ecdd3106b | Python | 3,166 | 77 | from math import sin, cos
import torch
from torch import Tensor
class Texture:
"""
Base class for textures.
"""
def value_at_coordinate(self, x, y):
raise NotImplementedError()
def fill_tensor(self, height, width) -> Tensor:
xs = torch.arange(height)
ys = torch.arange(width... |
868c92abf79b0574c2fa69282893771a9cef710598dc3ad04df1b9448262fa32 | Python | 3,166 | 88 | """
Modify a trace until the model no longer classifies it as a spike
"""
from src.model import ModelSpikeSorter
from src.data import MultiRecordingDataset
from src.plot import set_ticks
import matplotlib.pyplot as plt
from matplotlib.axes._axes import Axes
import torch
import numpy as np
from pathlib import Path
MOD... |
928d0ea7cf4d6c22d8e1254daf70d0a728c814ef51b5aed5749e18aa604f4f8a | Python | 3,166 | 106 | # Node-group asset "Group Pick Index" (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_CHECK... |
1a038f3d00c7624971639a6d29253775221fbd6752de1c68de96ad0d4456346e | Python | 3,168 | 92 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This script is used to visualize the time-delay projection maps on a brain template.
For a better view, I chosed to map them on the brain surface.
NOTE:
1. nilearn, panda and numpy are the required packages for running.
2. The TD projection map is supposed t... |
39650dc2f7b0e732d990e484f0d37e667bd7789874ad12da75655ae30bfc5b93 | Python | 3,168 | 86 | """
DeepLabCut2.0 Toolbox (deeplabcut.org)
copyright A. & M. Mathis Labs
https://github.com/AlexEMG/DeepLabCut
Please see AUTHORS for contributors.
https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
Licensed under GNU Lesser General Public License v3.0
"""
import wx
import deeplabcut
import os
from deeplabcut... |
5d9fdab47095edafca331f80508699c94241276ad6e4be03f24032b17d136b8c | Python | 3,168 | 114 | from __future__ import annotations
import os
import platform
from pathlib import Path
import pytest
from typer.testing import CliRunner
from quacc import __version__, _internally_set_settings
from quacc._cli.quacc import app
FILE_PATH = Path(__file__).parent
TEST_YAML = FILE_PATH / "test_quacc.yaml"
@pytest.fixtu... |
6a5bd73386a5bb8fc1cf529eab95d433aa55d98ce24bab2f09d49a3168b9f34d | Python | 3,168 | 113 | """Core recipes for Onetep."""
from __future__ import annotations
from typing import TYPE_CHECKING
from ase.optimize import LBFGS
from quacc import job
from quacc.recipes.onetep._base import run_and_summarize, run_and_summarize_opt
from quacc.utils.dicts import recursive_dict_merge
if TYPE_CHECKING:
from ase.a... |
2afd2280a03f1273c8b7c260a49bee3387b448fe04a2433bbdd5666b72b8d7cd | Python | 3,169 | 107 | # 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... |
59f5a8c233b09af579855e0a81d1f3d7bee5659c732f23c34eb246a836efa807 | Python | 3,170 | 74 | import numpy as np
import torch
from ase.calculators.calculator import Calculator, all_changes, PropertyNotImplementedError
from ase.neighborlist import neighbor_list
class MiaoCalculator(Calculator):
implemented_properties = [
"energy",
"energies",
"forces",
"stress",
"di... |
a54cde0b2bef9b6f24f7c8a605968f025b9ced9dbac5cab1a4402b7638970beb | Python | 3,170 | 102 | from pathlib import Path
import numpy as np
import pandas as pd
import pytest
from calvados.sequence import (
SeqFeatures,
get_qs,
patch_terminal_mws,
patch_terminal_qs,
seq_from_pdb,
)
def test_get_qs_standard_charges():
qs, qs_abs = get_qs("KRHDEpA")
expected = np.array([1.0, 1.0, 0.0... |
b0f00ecabc194cf7ef9ae198e5fd329e7d1a7d908c434e688aa8b19ce05f7509 | Python | 3,170 | 72 | import sys, os
import numpy as np
import pandas as pd
import pickle
from scipy.stats import zscore
from scipy.io import loadmat, savemat
sys.path.append('/m/cs/scratch/networks-pm/effects_externalfactors_on_functionalconnectivity/src/analysis')
from utils import get_behav_data_15days, get_pval
#######################... |
bc89f980b102db94d769bf94c96d1adb46f80cfb8b06c221556beae9f8d1200d | Python | 3,170 | 78 | # --------------------------------------------------------
# DaSiamRPN
# Licensed under The MIT License
# Written by Qiang Wang (wangqiang2015 at ia.ac.cn)
# --------------------------------------------------------
import torch.nn as nn
import torch.nn.functional as F
class SiamRPN(nn.Module):
def __init__(self, ... |
daa8d0ac7f4a5a2e51a1abf40ae47bbdcee15a6e2e3a2ff497ab69dc448a0c73 | Python | 3,172 | 108 | import sys
from optparse import Values
from typing import AbstractSet, List
from pip._internal.cli import cmdoptions
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import SUCCESS
from pip._internal.operations.freeze import freeze
from pip._internal.utils.compat import stdlib_pkg... |
15928188e50ad0b2816534edb20a423107d09f5f758548f4d22681d447737018 | Python | 3,174 | 56 | from utils.scGraphformer import *
def parser_add_main_args(parser):
# dataset and evaluation
parser.add_argument('--dataset', type=str, default='Baron Human')
parser.add_argument('--data_dir', type=str, default='/home/xyfan/data/Datasets/baseline_datasets')
parser.add_argument('--device', type=int, de... |
59b5f1e75aa7eab4d0980b66b5b50b7f77f63005ff06598c572b109908aaf235 | Python | 3,174 | 94 | from logging import getLogger
from numpy import expand_dims, log10
from .select import select
from .math import math
lg = getLogger(__name__)
def apply_baseline(data, baseline='ratio', **axis_to_select):
"""Apply baseline correction to ChanTime or ChanFreqTime data.
Parameters
----------
data : in... |
cdecabe653ccfba32dd8be180eaf44c553f7df21b4f7f99c1b4a33a2faad4b57 | Python | 3,175 | 82 | # 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... |
f7f2539c844850506247880d0b39d3ba162f65931b3c5e957f168f2d51021c82 | Python | 3,176 | 98 | import os
import h5py
import pydicom
import numpy as np
from barbell2.imaging.dcm2npy import Dcm2Numpy
from barbell2.imaging.tag2npy import Tag2NumPy
HOME = os.environ['HOME']
ROOT_DIR = '/Volumes/USB_SECURE1/data/radiomics/projects/deepseg/data/mega/final'
H5_MEGA = '{}/Desktop/data_mega.h5'.format(HOME)
def cou... |
34f6caafe1502e25bf9492ddaaf0d449d6798aac2d94d050eca63d7fdf3c41e4 | Python | 3,177 | 93 | """Compare installed venv package versions against requirements.txt floors.
Pure logic + one subprocess helper (query_installed, Task 2). No third-party
imports: a hand-rolled version comparator replaces `packaging` because that
library is not guaranteed present in the bare system Python the wizard runs on.
"""
... |
20dc1f532ec3c050e5e1c86df26ad37111771c2a7fedc7fa7b0cca38892f4867 | Python | 3,178 | 107 | import pathlib
import sys
from unittest import mock
from unittest.mock import MagicMock
import keyring
import pytest
import NDATools
from NDATools.clientscripts.downloadcmd import parse_args as download_parse_args
from NDATools.clientscripts.vtcmd import parse_args as validation_parse_args
# prevent check_version f... |
2b258b8dcbdf85b9a5a9962ff5958e3d201e4eb92928e3fdabde0dbd6fbaa90b | Python | 3,178 | 95 | from unittest import TestCase
from pyseg.globals import *
from pyseg.disperse_io import *
from pyseg.vtk_ext import vtkFilterRedundacyAlgorithm
from psd import PsdSynap
import vtk
import numpy as np
__author__ = 'martinez'
# Test variables
TEST_RESOLUTION = 1.888
TEST_MB_THICK = 5
TEST_MB_THICK_2 = TEST_MB_THICK * 0.... |
6adda67ef83a401fd05b09fdb917c3b09eee9885a9c55067771896d82c56959a | Python | 3,180 | 70 | # +
import numpy as np
from sklearn.metrics import precision_score,recall_score,accuracy_score
from sklearn.metrics import average_precision_score
def print_topl_statistics(y_true, y_pred):
# Prints the following information: top-kL statistics for k=0.5,1,2,4,
# auprc, thresholds for k=0.5,1,2,4, number of tru... |
aa3cd0694f5efd2e50d30a84eeb4979ed07c76cf5a969d679f4f6ba2ccdc81b2 | Python | 3,180 | 101 | # Node group "Vector in Angstroms" (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... |
31c6d9e189a536fad6512380d8f7272f31a563e6cd317ccae51ea361be54d78b | Python | 3,181 | 104 | # Node-group asset "Between Vector" (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_CHECKIN... |
c88726e66ec929f3128b6a40784fe40272deb11ee5196c5731a7b05572bc06f1 | Python | 3,181 | 98 | # 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... |
71411c894adf5f39a64744077c138ab91b606daf4fbf151bba1d806c72a48230 | Python | 3,182 | 114 | from __future__ import annotations
import os
import platform
from pathlib import Path
import pytest
from typer.testing import CliRunner
from quacc import __version__, _internally_set_settings
from quacc._cli.quacc import app
FILE_PATH = Path(__file__).parent
TEST_YAML = FILE_PATH / "test_quacc.yaml"
@pytest.fixtu... |
2978eabb01b336192f75cf02455f64105c5f587581a29ab81a0fbbc17f621cb8 | Python | 3,183 | 89 | import os
import stat
def create_desktop_shortcut_simulation(directory_path, script_name):
squid_suffix = script_name.replace("main_","")
icon_path = os.path.join(directory_path, "icon/cephla_logo.svg")
if squid_suffix != "main" and squid_suffix != "":
shortcut_content = f'''\
[Desktop Entry]
Name=S... |
4599e69386cdcf2f8069c7be81adce4b6e11c664a68a952623ee40d13ecebc27 | Python | 3,183 | 105 | #!/usr/bin/python3
import os
import glob
import argparse
import tensorflow as tf
from osgeo import gdal
def get_codings(description_file):
"""Get lists of label codes and names and a an id-name mapping dictionary.
:param description_file: path to the txt file with labels and their names
:return: list ... |
84d0858d0e760c43173a4625af7145a033f5674be0aff4dcd3ffb3b858c64788 | Python | 3,183 | 92 | import fire
import os
import json
import csv
import pandas as pd
from tqdm import tqdm
IDS = ['id0', 'id1', 'id2']
# Combine the stats from a Mapper results into a big stats file and then group by Mappers
def combine_compute_stats(cohort_path, mapper_dir, output_dir=None, skip_uncomputed=False):
if not os.path.isfi... |
c47b4d23fc8b6584efe00dac8c73499abdab38d617408f74d280cfb5cee6beea | Python | 3,184 | 125 | import numpy as np
class Episode_Memory:
"""
Used to store episode information
"""
def memory_init(self, episode: int) -> None:
"""Create a memory dict
Parameters
----------
episode : int
episode index
Returns
-------
... |
cff76b8cdd57dc918f41d4cd573d97eac74c34eceffc62ce96aaa8f86387f94f | Python | 3,184 | 95 | # 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... |
78c00b869a6c96cfac5cf96c812a33fc3f21055daabcedaab8e5a6d7c6789669 | Python | 3,185 | 104 | # 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... |
fdac1317b06ef59fd67b6884ed42bc72eac59897786019ab1f4ed644f60d04d3 | Python | 3,185 | 90 | # -*- coding: utf-8 -*-
"""This file implements loaders for the QM7b dataset.
"""
import re
from pinn.io import list_loader
import tensorflow as tf
import numpy as np
ds_spec = {
'elems': {'dtype': tf.int32, 'shape': [None]},
'coord': {'dtype': tf.float32, 'shape': [None, 3]},
'ptensor': {'dtype': tf.... |
a38117c9b1c100c8451b3ccc507f7311f6a40e25ef598d68875f50f1e7f493c1 | Python | 3,186 | 79 | ##batch Proess_TargetP2.0 similar to script Algorithm_predicted_proteins, but only for targetP, and useful to process a large number of targetP outputs
import pandas as pd
file_path = # TargetP output file for a given genome
df = pd.read_csv(file_path, sep="\t", comment='#',header=None,skiprows=2)
df.columns=["I... |
aa6c14350ff169f3752acfa0993584f460b52edcc10843e8844d78518d85dd71 | Python | 3,186 | 99 | from __future__ import division
from functools import partial
import logging
import numpy as np
import pandas as pd
"""
Created on Fri Nov 16 17:45:36 2018
@author: Hannah Choi
"""
"""
This code contains functions needed for mapping TC clusters to FF/FB by
maximizing the global hierarchy score of the ... |
d502023ebcde9cf3e53bbb8c4314ead6f7561099c6334f38b511d924054541e2 | Python | 3,186 | 35 | """POST HOC (after SHIU_LATERAL_EXCITATION.py): is the antennal-lobe saturation a property of Shiu's published v630
matrix too, or an artefact of my v783 >= 5 network? Same simulator, Shiu's own 'Excitatory x Connectivity' weights.
ORNs/PNs identified by v783 annotations for root ids unchanged between v630 and v783. Dr... |
ef6168a640b5f4544e0a4f4f192c8c69f9dff3945bd54eac7e199c5e8c50f7f8 | Python | 3,187 | 81 | import numpy as np
from ...utils.collections import dotdict
def loadDefaultParams(Cmat=None, Dmat=None, seed=None):
"""Load default parameters for the FHN model
:param Cmat: Structural connectivity matrix (adjacency matrix) of coupling strengths, will be normalized to 1. If not given, then a single node sim... |
b448fb141a2978de2cdcfbdc8eec0eb8653d4d58a5fc4c61919901eb7bdc468d | Python | 3,188 | 127 | # 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... |
db048fb7dc9faf7afa83eb364b92fa3ef46d687355c9be13ba874c4ad277f5cc | Python | 3,188 | 92 | import logging
from optparse import Values
from typing import Any, Dict, List
from pip._vendor.packaging.markers import default_environment
from pip._vendor.rich import print_json
from pip import __version__
from pip._internal.cli import cmdoptions
from pip._internal.cli.req_command import Command
from pip._internal.... |
7f82ac639f7e351ea9283750377aa4a51e59978d42c89165f137e670d75808ac | Python | 3,189 | 98 | # Node group "Unit Convert" (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 regenerated... |
e77832473e5d29ff09ff23801a4b129a9ea2e28d1f9bb7ccfbb148669df01317 | Python | 3,190 | 70 | import pupildata,updater
import tkinter as tk,threading
from tkinter import messagebox
from PIL import Image,ImageTk
from imageio import get_reader
from traceback import format_exc
from time import sleep
import os
class RunnerWindow(tk.Toplevel):
def __init__(self,app):
super().__init__()
self... |
f3849bb4ab4957e211e351028a430fd34f168444c6386dc61e8e8573f6dbf073 | Python | 3,190 | 81 | import numpy as np
from plan_tools.common import TABLE
from plan_tools.samplers.generators import compute_forward_reachability
from pybullet_tools.utils import ClientSaver, get_aabb, add_segments, wait_for_duration, \
WorldSaver, user_input, add_text, PoseSaver, set_pose, unit_pose, draw_base_limits, \
draw_ci... |
238808c2953520c301e3c37c61686ab83f736805ab216639e35bd0928d441c51 | Python | 3,191 | 89 | import os
import time
import logging
import math
import argparse
import numpy as np
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torch.utils.data as data
from utils.util import setup_logger, print_args
from models import Trainer
def main():
parser = argparse.ArgumentParser(descri... |
757f9429ed2924ff9fb3d01289673e401fcee9b89cf7809a39a40405f67d7a19 | Python | 3,191 | 62 | #!/usr/bin/env/python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
from utils import str2bool
import sys
def add_params(parser):
##Cole added args
... |
79181c4f9e90a00cafe6935c80f706fc58b1e72533f628e42bec2221846745c0 | Python | 3,191 | 89 | # regtools/tests/test_ccf_canvas_lock_mixin.py
import os
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
import pytest
pytest.importorskip("PySide6")
from PySide6.QtWidgets import QApplication, QWidget
from regtools.ccf_boundary_editor.canvas_lock_ui import CanvasLockMixin
_app = QApplication.instanc... |
c8a79bc14021297b9cf41f86f165595ba34d1f5962823bc76cef46fe9401991d | Python | 3,193 | 83 | import logging
from downward.reports.absolute import AbsoluteReport
class Check(object):
"""
Compare the attribute values x and y of two runs and check whether
*min_rel* <= y/x <= *max_rel*. Even if the check fails, only report the
failure if the absolute difference is greater than *ignored_abs_diff*... |
d87499eb78d76385b5ab5ad04051eb71d80acbaab7dd1bce0109ba7c4daa12fa | Python | 3,193 | 103 | import os
import toml
import glob
import shutil
import logging
from ase.io import read
from ase.atoms import Atoms
from quacc import get_settings
from quacc import strip_decorator
from typing import List, Dict, Any
from quacc.recipes.mace.ts import ts_job, irc_job, geodesic_job
def geodesic_ts_no_hess_irc_mace(
... |
4d00e7e558d2371cd190e738ce92d5685f97edc25ff000574cee8c761ac41251 | Python | 3,194 | 98 | import meep as mp
from meep import mpb
# Compute modes of a rectangular Si strip waveguide on top of oxide.
# Note that you should only pay attention, here, to the guided modes,
# which are the modes whose frequency falls under the light line --
# that is, frequency < beta / 1.45, where 1.45 is the SiO2 index.
# Sinc... |
fb6ce45bbe005e35eea4c3f52f0b83d6f7d903b5e9198c76cb985efe060d7ef1 | Python | 3,194 | 102 | """A multi-layer perceptron for classification of MNIST handwritten digits."""
import itertools
from data import load_mnist
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd import grad
from autograd.misc.flatten import flatten
from autograd.misc.optimizers import adam
from autograd.scipy... |
add0e7d7f376d3e6e1f6d4bb1d3be7fb8f0448828e49a28643c9eae5e7e03197 | Python | 3,195 | 100 | # Node-group asset "Fallback Float" (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_CHECKIN... |
306604ef1e52ba09e2c5271ca0530e15f6255c9482b9e25c76bfccf98a442876 | Python | 3,196 | 73 | import os
import random
import shutil
import unittest
from torcheeg import transforms
from torcheeg.datasets import DEAPDataset
from torcheeg.datasets.functional.hooks import before_trial_normalize, after_trial_normalize, after_trial_moving_avg
class TestHooks(unittest.TestCase):
def setUp(self):
if os.p... |
36f9c3c61d1625428d8cc708e7f0449559b4897ee8c58a800c6a4a424d57ce80 | Python | 3,196 | 126 | """Atoms handling with Phonopy."""
from __future__ import annotations
from importlib.util import find_spec
from typing import TYPE_CHECKING
import numpy as np
from monty.dev import requires
from pymatgen.core import Structure
from pymatgen.io.phonopy import get_phonopy_structure, get_pmg_structure
has_phonopy = boo... |
915ee742d828e52d078bf06b42c1f8976ca208e90ad9f932a717ace260db3b6a | Python | 3,196 | 82 | 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.design.design import Design
from elasticai.c... |
6881a9b63e40c46903be89a6bb3ba48769c8adf0f8b2513d502b0605e0bc8932 | Python | 3,197 | 84 | # Node-group asset "Atom Name" (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
fro... |
e21900e0d6f37400986cda3c8d25ea2e8bfe8866f89ea02a9351b386e90733c1 | Python | 3,197 | 89 | # 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... |
c7dcc12c849e8c5390936fd1227335a645cb5da83f68d4fc461b71d1bbcf9e38 | Python | 3,198 | 91 | '''Preprocess events from the presentation logs to the BIDS events file for the
nback task.
Parameters
----------
path : str
path where the raw data is stored
savepath : str
BIDS folder
'''
import os, sys
import re
import pandas as pd
import numpy as np
from glob import g... |
cfa5b8e5eadb8f20e10aa882cdb53fc065950445e82951d00f0e55e61a66466d | Python | 3,198 | 105 | import pytest
import torch
from elasticai.creator_plugins.lutron_filter.precompute.int_encoding_lutron_convolution import (
LutronBitsToTwoComplementsWrapper,
)
from elasticai.creator_plugins.lutron_filter.precompute.truth_table_generation import (
generate_input_tensor_1d as generate_input_tensor,
)
from torch... |
e3c5cb67dda50ce25881a379350f9625cf64065df28dff8d6d67c07eb459df8d | Python | 3,198 | 87 | import os
os.environ["CUDA_VISIBLE_DEVICES"] = "7"
import torch
import scipy.io as scio
from Dataset.mydataset import Dataset
from BDNN_Model import BBP_Model
from BDNN_Model_Wrapper import BBP_Model_Wrapper
import numpy as np
def init_world_model(Exp, file_name):
#%% dataset
dirs = './Dataset/out/2... |
8144e0b85f69f6f9a2b077a2b5d2fd209b11b52483e93ccce7b3293d1f67e735 | Python | 3,199 | 128 | #!/usr/bin/env python
"""
Format significant Schaefer IS-RSA results.
This script reads the IS-RSA output CSVs, joins Schaefer parcel labels,
filters for FWE-significant parcels, and saves formatted result tables.
"""
import os
import pandas as pd
# ------------------------------------------------------------------... |
e63d31ae539b4ac176b635f6cdb382bb9a3ff55f0dea5183cf1616c3d8654a89 | Python | 3,199 | 113 | # 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... |
7642ead634366c4daf760fe44aa0ca1d3eb4c77c964e281896b6e25217b748a1 | Python | 3,201 | 84 | # ----------------------------------------------------------------------
# Originally by NAB, modified to fit online operation.
# ----------------------------------------------------------------------
import abc
from datetime import datetime, timedelta
class OnlineAnomalyDetector(object, metaclass=abc.ABCMeta):
... |
3d2003c4773559d325e42bb7bb57707d3e4cca6ace77084451879ccbc9a7cb9f | Python | 3,202 | 91 | import argparse
import time
import warnings
import numpy as np
from scipy.ndimage import zoom
from plantsegtools.evaluation.rand import adapted_rand
from plantsegtools.evaluation.voi import voi
from plantsegtools.utils.io import smart_load
# Add new metrics if needed
metrics = {"voi": (voi, 'Split and Merge Error'),... |
536cde8432661cfef0b8ca1db5ad5e50827616c3903922560f111eea2996819a | Python | 3,202 | 106 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Example script loading and execiting a simulation with the
Hay et al. 2011 L5b-pyramidal cell model, which is implemented by default
using templates.
This script assume that the model files is downloaded and unzipped inside
this folder from ModelDB:
http://senselab.med... |
97871df1b9f542d132218a2ecfb142181b0846b55377c38a6c9161037cacf438 | Python | 3,202 | 72 | # -*- coding: utf-8 -*-
import tensorflow as tf
default_ekf = {
'class_name': 'EKF',
'config': {
'learning_rate': 0.03}}
class EKF():
"""The EKF implementation follows mainly Singraber et al.'s description
(Singraber, Morawietz, Behler and Dellage, JCTC, 2017), with some difference
in the... |
5c8497a0ce76e49db78922d98cd96877bd6a25d3bda5e6a981869425cc86fe3a | Python | 3,204 | 89 | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import build_activation_layer, kaiming_init
class LinearModule(nn.Module):
"""A linear block that contains linear/norm/activation layers.
For low level vision, we add spectral norm and padding layer.
Args:
in_fea... |
c4033e998e09fafbe50af41d0cc2cc3ad69dc00bc39e9dd4dee4adce0887fbff | Python | 3,204 | 102 | from typing import Tuple
from time import strftime
from typing import Dict
from util.lsl import LSLPollerNode, LSLPollerConfig
from util.ecg import ECGSimulator, ECGConfig
from util.bandpass import BandPass, BandPassConfig
from util.qrs import QRSDetector, QRSDetectorConfig
from util.control import Control, ControlCon... |
fa164352a79dc26c22d2338f569bd801ad89ad86a409ae110c31c5f6a2df7219 | Python | 3,205 | 82 | """
Nerfstudio Depth Config
Define your custom method here that registers with Nerfstudio CLI.
"""
from __future__ import annotations
from edge_nerf.datamanager import (
DepthDataManagerConfig,
)
from edge_nerf.model import DepthModelConfig
from edge_nerf.pipeline import (
DepthPipelineConfig,
)
from edge_ne... |
43b0223ab8d6e258a1b8ee7e90e3b4d3831606ce6e291a0dd0d8c88aad0782cd | Python | 3,206 | 106 | #!/usr/bin/env python
# Copyright (c) 2020 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module provides the base class for user-defined actor
controllers. All user-defined controls must be derived from
this class.
A ... |
da5128b2a0599ec0c4130b9f88b866dd7a101b8a72c54d2cea5336dca7caf658 | Python | 3,206 | 157 | import numpy as onp
import autograd.numpy as np
from autograd import grad
try:
from autograd.core import VJPNode, backward_pass, vspace
from autograd.tracer import new_box, trace
MASTER_BRANCH = False
except ImportError:
from autograd.core import backward_pass, forward_pass, new_progenitor, vspace
... |
e85d6d736adc29a0999a07d5c2c13a39b21efcfbb1db799455803ed83f700857 | Python | 3,206 | 87 | from typing import Optional
from pip._internal.models.direct_url import ArchiveInfo, DirectUrl, DirInfo, VcsInfo
from pip._internal.models.link import Link
from pip._internal.utils.urls import path_to_url
from pip._internal.vcs import vcs
def direct_url_as_pep440_direct_reference(direct_url: DirectUrl, name: str) ->... |
5a6ff2bc0e4bcfac6da144a779ecb0e29daa84f68afa907740e5a9200f1750ec | Python | 3,207 | 68 | import warnings
import argparse
import nibabel as nib
import random
from pyrelimri import brain_icc
warnings.filterwarnings("ignore")
# running below after 100 random seeds are generated using
# random.seed(100); [random.randint(1,10000) for _ in range(100)]
parser = argparse.ArgumentParser(description="Script to run... |
45c371bfb1e890b3eee6b9209b80e7cdf7ab5cc53db05e36c3274b0f8986dcc4 | Python | 3,208 | 91 | import torch
import numpy as np
from monai.transforms import Compose, LoadImage, EnsureChannelFirst, Lambda, Resize, NormalizeIntensity, GaussianSmooth, ScaleIntensity, AsDiscrete, KeepLargestConnectedComponent, Invert, Rotate90, SaveImage, Transform
from monai.inferers import SlidingWindowInferer
from monai.networks.n... |
412e78aa58a56d573476bf7d1adf104357614575cacb72e259ffcf65a676affb | Python | 3,209 | 44 | """POST HOC (8 Oct 2026, after IDENTITY D4). The combined model says P(glutamate | v2LN30) = 0.94, but on the 44 "hard" types
(the classifier's call wrong or absent — v2LN30's kind) its Brier score is 0.748. How right is it on hard types, and on the
absent-call ones in particular? And what do the lineage-only model and... |
9ab23c482ad21de909b9c9a4f01628154b33617687e6f715cd5a0e7bdbdb57b6 | Python | 3,209 | 95 | from fastapi import FastAPI
from pydantic.main import BaseModel # Updated import for BaseModel
from pydantic.class_validators import validator # Updated import for validator
from sitetack.app.enums import PtmKind, OrganismKind, LabelKind, kind_to_dict
from sitetack.app.fasta import Fasta
from sitetack.app.model impor... |
db0af23216260510c68c6f404fbe00008f52a666032c006aa5251bc3f172f005 | Python | 3,209 | 127 | from __future__ import annotations
# built-in
from itertools import takewhile
from typing import Sequence
# app
from .base import Base as _Base, BaseSimilarity as _BaseSimilarity
from .types import SimFunc
__all__ = [
'Prefix', 'Postfix', 'Length', 'Identity', 'Matrix',
'prefix', 'postfix', 'length', 'ident... |
1a96aa6dd55c72295a55ac0bdb83dd3c57f8458b0be6902894c1c685115c48b5 | Python | 3,210 | 90 | """Argparse tests for regtools.ccf_boundary_editor.launch."""
import pytest
class TestBuildParser:
def test_no_args_defaults(self):
from regtools.ccf_boundary_editor.launch import build_parser
args = build_parser().parse_args([])
assert args.annotation is None
assert a... |
39fafeaa8ba79b494233ec0a58c255c2d5123d9c4cca07bbda13d67489169bf6 | Python | 3,210 | 59 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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
#
# ht... |
31994db329099396f859a433894c52b280c666b3522524b589ac2ca7f96fd269 | Python | 3,211 | 99 | #
# 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,... |
339c594a25a6efee79339c1ecd3ef38312a4c94e949cf1da6ddd3cf06fcecd9d | Python | 3,211 | 98 | import numpy as np
from scipy.ndimage import zoom
from skimage.filters import median
from skimage.morphology import ball, disk
try:
from vigra.filters import gaussianSmoothing
except:
from skimage.filters import gaussian as gaussianSmoothing
def parse_crop(crop_str):
'''Return a tuple with a slice object... |
3ac783c0f418dbfb9c8d0f376fddb83074b6e7dd618d52414413b04d21b65b31 | Python | 3,211 | 80 | """Build a bilaterally-symmetric MERFISH density from the Zhuang density template.
The Zhuang whole-brain MERFISH density (``merfish_density_25.nii.gz``) is
LEFT-heavy - it is built from real section coverage, not a symmetric model - so
the under-sampled hemisphere is dim. This reflects the BETTER-sampled hemisphe... |
c6aac16ec88da7a2aa378282c1e3659144592b4b4e2ad0901728e87ad76dfc91 | Python | 3,211 | 96 | import pandas as pd
import numpy as np
import statsmodels.api as sm
import statsmodels
import dodiscover as dod
import hyppo
import scipy as sp
import sklearn as sk
from rpy2.robjects.packages import STAP
from rpy2.robjects import numpy2ri
import os
numpy2ri.activate()
# Get the directory where cond_ind.py is located
... |
2040c70e6adb8bfdd5104bd1b208cdda67ecc1577208cc9a09761d6a43eca507 | Python | 3,212 | 99 | """Plotting utilities."""
import numpy as np
from treem.io import SWC
# pylint: disable=invalid-name
def plot_tree(ax, tree, data, **kwargs):
"""Plots entire branch.
Args:
ax: matplotlib axes object.
tree (treem.Node): branch start node.
data (NumPy ndarray): raw data of morphology... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.