sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
838b8eb108fc49c44ce2fea64eb6123b47aad0d6972024ebd7b815df79e924da
Python
2,450
60
import sys import os import gzip from optparse import OptionParser import numpy as np import pandas as pd from inmoose.pycombat import pycombat_seq def main(argv): if len(argv) == 1: argv.append("--help") usage = "usage: %prog -i counts.tsv -b batch.tsv -o batch_corrected.tsv" desc = "Batch corre...
8ed9f883287cf54440a57277a686f3490ee8de3727e2bce85c7293387634a8c9
Python
2,450
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...
92e4bec79d69cc768d0c6b1448806b2b9bc2d8ca6277ea3cdaee9bf32387e504
Python
2,450
88
#!/usr/bin/env python #================================================================ # Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved. # # Filename : anatomy_vis.py # Author : Yufeng Liu # Date : 2023-02-22 # Description : # #===================...
6188d000441139ffec3cfc09992afc12c82569b6b7f348a429b257b242826512
Python
2,451
74
import pytest import numpy as np @pytest.fixture(scope="session", autouse=True) def set_seed(): np.random.seed(42) # noqa: NPY002 import logging import torch from ase.io import read from pathlib import Path from quacc import get_settings from ts_workflow_examples.geodesic_ts_with_hessian.using_newtonnet import...
b89ecef281353e73297a70f02a3b25eef534db036b7a8b6483c4685a77328268
Python
2,451
66
import os import numpy as np import pytest from regtools.atlas.registry import ANNOTATION_IMAGE from regtools.geometry_registration import ccf_bridge def test_edges_from_label_slice_marks_region_boundary(): # Two regions: background (0) and a 6x6 square of label 5. labels = np.zeros((20, 20), np....
beded04386daf6d341b428e4a88cb9c4954585e24da7c58779ced7aa647a7b2a
Python
2,451
81
""" The skeleton id should be computed and set after all other code is generated. """ import logging from collections.abc import Iterable from pathlib import Path from warnings import warn from elasticai.creator.hw_function_id import _HwFunctionIdHash from elasticai.creator.vhdl.hw_function_id import _replace_id_in_v...
ca94b1f64c01bf25133282cffc00e61349c98457639bbca8bb0f040dbe535386
Python
2,451
86
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Author: Maximilia F. S. Degenhardt <frazaodesouzam2@nih.gov> Hermann F. Degenhardt <degenhardthf@nih.gov> """ import os, sys import pandas as pd sys.path.append("../src") from hornet.input import prepare_inputs def help(): return """ prepare_input...
e83903d2ee1a5d4bb029f727ad7fdf23204c058fc5a3a5319c4255ac311c0b12
Python
2,451
63
#! /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 = ["issue717-base"] CONFIGS = [ IssueConfig( "lama-firs...
075f9b87fc4122fa2ee80a4a4f6074d7c1606e565612d2b47683646b84f64861
Python
2,453
49
import numpy as np class TransferFunction: def __init__(self, cond_vec, radius_vec, max_l=300): self.cond_vec = cond_vec self.radius_vec = radius_vec*10**(-2) ## cm to m self.max_l = max_l self.eps = 0.0001*10**(-2) def create_frequencies(self, max_nx, max_ny): ...
3221b713170ab6157cbb7ceadfbd6e59fa048d3b4568e5ed6f2937b08a309190
Python
2,453
66
import matplotlib matplotlib.use("Agg") import torch device = torch.device("cuda" if torch.cuda.is_available() else "cpu") import yaml, io with open("./config/simul_study_config.yaml", 'r') as stream: config= yaml.safe_load(stream) config["default_path"]= str(config["default_path"]) config["split"]= float...
a2b34eafd61852590a098364579407ee304928a480b901a398617709ef3ce4b8
Python
2,453
71
# Publication: "Protein Docking Model Evaluation by Graph Neural Networks", Xiao Wang, Sean T Flannery and Daisuke Kihara, (2020) #GNN-Dove is a computational tool using graph neural network that can evaluate the quality of docking protein-complexes. #Copyright (C) 2020 Xiao Wang, Sean T Flannery, Daisuke Kihara, and...
ae7b7ed02ff5bffc77a5c2a444414ed50999d87c30dcbf276fd994e965708a1e
Python
2,453
66
import matplotlib matplotlib.use("Agg") import torch device = torch.device("cuda" if torch.cuda.is_available() else "cpu") import yaml, io with open("./config/MNIST_config.yaml", 'r') as stream: config= yaml.safe_load(stream) config["default_path"]= str(config["default_path"]) config["cuda"]= str(config["cud...
d945621d412c81dc5418d543a72bf4da8e89d08b705bdbbc028ca5ea1c6cfd6b
Python
2,453
74
import os from six.moves import urllib import pandas as pd import magic import matplotlib.pyplot as plt import datetime def create_new_folder(path): """Create a folder in 'path' if it does not exist yet.""" try: os.makedirs(path) except OSError as e: if e.errno == 17: pass ...
dc3acfcf518b344190929339d3f240394dbc6edf4a9bcc6e8a699f2219962062
Python
2,453
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...
e5251ad95339c16ae6be02969541f2e359ab27259fdabb293aafa80c08acaf32
Python
2,453
49
# Publication: "Protein Docking Model Evaluation by Graph Neural Networks", Xiao Wang, Sean T Flannery and Daisuke Kihara, (2020) #GNN-Dove is a computational tool using graph neural network that can evaluate the quality of docking protein-complexes. #Copyright (C) 2020 Xiao Wang, Sean T Flannery, Daisuke Kihara, and...
8bc4ba21bd4e4237082c0fa5e2093392d3197b5f1369e50d238f4f2d1a7a3815
Python
2,454
90
import functools import warnings import re import textwrap import email.message from ._text import FoldedCase from ._compat import pypy_partial # Do not remove prior to 2024-01-01 or Python 3.14 _warn = functools.partial( warnings.warn, "Implicit None on return values is deprecated and will raise KeyErrors."...
a75955a0ff4d1dfc00269d3253e8819ae8099b8264000a4be2ef13a9943819d0
Python
2,454
83
import os import pandas as pd from calvados.cfg import Config, Job, Components import subprocess import numpy as np from argparse import ArgumentParser parser = ArgumentParser() parser.add_argument('--name_1',nargs='?',required=True,type=str) parser.add_argument('--name_2',nargs='?',required=True,type=str) args = pars...
e5652aa31ae3a2f11ef4f7297042046847109bb90b190228bab17bde68824025
Python
2,454
43
import torch import torch.nn as nn import numpy as np from .utils import categorical_to_one_hot def cal_dice_per_case(pred_logit, target, smooth = 1e-8): # target is one hot pred_classes = pred_logit.max(dim=1)[1] batch_size, n_classes = pred_logit.shape[:2] pred_one_hot = categorical_to_one_hot(pred_cl...
05bdcd342427512895a91e932b39aac68e2fa24e47a3a817016e1d031d7d9007
Python
2,455
93
""" Helpers for distributed training. """ import io import os import socket import blobfile as bf from mpi4py import MPI import torch as th import torch.distributed as dist # Change this to reflect your cluster layout. # The GPU for a given rank is (rank % GPUS_PER_NODE). GPUS_PER_NODE = 2 SETUP_RETRY_COUNT = 3 d...
3259592f583aa3979e6c291d3afe1a2a65ab9af7420fb960c01cfec1ec494290
Python
2,455
70
import torch import torch.nn as nn import numpy as np from evaluate import * def train(model, criterion, optimizer, data_loader, device, transform=None, shuffle_feat=None, class_map=None): """ Train a neural network for one epoch. """ model.train() epoch_loss = 0. epoch_count = 0. epoch_total ...
58f2adf852afa336c94d4711a347993c623593e39d686a877277c289e05410d8
Python
2,455
89
from typing import Tuple import numpy as np def euler_to_homo(Xe: np.array) -> np.array: """ convert euler to homogenous coordinates """ num_points = np.shape(Xe)[0] Xh = np.column_stack((Xe, np.ones(num_points))) return Xh def homo_to_euler(Xh: np.array) -> np.array: """ convert homo...
79874e00e21823a2babe324b66893a5acc35900e6edb26a63bdbdc52bd4ad088
Python
2,455
43
"""AL_SUBNET.py 2026-09-25. The antennal lobe cut out of Shiu's LIF (v783 >= 5 network) so that one odour runs in ~1 s instead of ~40 s. Kept: olfactory receptor neurons, AL projection, local, input and output neurons (~3,400 cells). Everything outside is removed, so feedback from the rest of the brain is lost; `valida...
7ee6739c290d42626128c0f0835cf22b459310b166d7c4149da380438bebee6a
Python
2,455
81
# 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...
ce39e712ac41ec422d09cc20ab7eb5868d841d9a3179b043e430f6a1b3fd6ea3
Python
2,455
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...
270e1b8d754c96638392ba0820302f807d44606f1e292bf9766f011d9b4700e9
Python
2,456
64
"""Transform paths containing commas (or brackets) must be staged to a safe temp path before ANTs point transformation. ANTsPy formats an inverted transform as the bracket argument ``[<path>,1]`` and ITK splits that on commas with no escape, so a comma anywhere in the path (e.g. a microscope output folder named a...
3222a48290e82372c2cddbbe03c8d2c52713e71542ec6de82c9747f6ad612cd9
Python
2,456
81
#!/usr/bin/env python3 """ Author: David Kappel Copyright (C) 2024, by the author. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at you...
827bdb2110ba1df193a2e9e81fe4562e6d645bc7567e1132fea2cef3605a06bc
Python
2,456
76
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn.preprocessing import MinMaxScaler ##this function is adopted from Sample et al. (2019)## ###################################################### def one_hot_encode(df, col='utr', seq_len=50): nuc_d = {'a':[1...
9affb144806ebc6542bd0a73622670f48256c2ab7310531e58b447d127e5e843
Python
2,456
64
import os import torch import pandas as pd from run import * from data import * from utils import read_params def main(): # # get patient list # df = pd.read_csv('./RecurrentGBM/biopsies69_3marker_5_5_threshold0.5.csv',sep=',') # patients = df["Patient"] # p = patients.drop_duplicates().to_list() # dire...
b7f2f7db60df5ba6815483f966952564b82be267310b65b605fab5c0e48cf579
Python
2,457
63
"""computeAllMetrics overlap= skip + mask_scale plumbing (PR: metric flags). - overlap=False must skip Dice/Hausdorff AND the (expensive) GrabCut mask, so the intermediate delta-only call costs nothing on masking. - mask_scale must thread to _get_brain_mask and be part of the cache identity. """ import numpy...
e9f291f505a0be7ef2a0576a6b3af6e05690556cbe4a9092c1ba851f678e6f10
Python
2,458
65
#!/usr/bin/env python import sys import os import argparse import requests if __name__ == "__main__": parser = argparse.ArgumentParser(description='Download genomic data') parser.add_argument("genome", help="genome to download: hg19, hg38, mm10, hg18", type=str)...
c18c5fe429fcd10fb84dba1a79a9f635363e1d0efdfcdc7e91a882bd2bbd0716
Python
2,459
70
import os import torch from torch.utils import data as torch_data from torchdrug import data, utils from torchdrug.core import Registry as R @R.register("datasets.SecondaryStructure") @utils.copy_args(data.ProteinDataset.load_lmdbs, ignore=("target_fields",)) class SecondaryStructure(data.ProteinDataset): """ ...
59f4cb6b3643d7de03251f85c98838b1bd4479f78ccaabd755838dcaa69902f5
Python
2,460
55
from rdflib import Graph, plugin from rdflib.parser import Parser from rdflib import URIRef, Literal, Graph, RDF, Namespace # Set the paths to your CSV file and the ontology file csv_file = "Seri.csv" # Replace with the data source ontology_file = "foo.ttl" # Replace with the ontology # Create an RDF gr...
a07f900cdcb2ba1f00aaef4a0b09d618a119aba7c0d2f59e47508b2d9d136bc2
Python
2,460
79
#!/usr/bin/env python3 ## this script creates dataframes from the distance matrices ## (upper triangle) for each movie and parcel (HCP 7T version) import pandas as pd from pathlib import Path # ------------------------------------------------------------------ # settings # -------------------------------------------...
d90e5e99fb01a816da2be5e5f69ee822cc60737c0d365fe48b7218ace7288b91
Python
2,460
64
""" Optuna example that demonstrates a pruner for XGBoost.cv. In this example, we optimize the validation auc of cancer detection using XGBoost. We optimize both the choice of booster model and their hyperparameters. Throughout training of models, a pruner observes intermediate results and stop unpromising trials. Yo...
4f1dfeb3ffe3b0a4a55683f0c116ab1525667662410e6473142564013c924651
Python
2,461
59
TEST_ID = '00001' # used when saving some files MODE = 'II' # 'I' or 'II' # 'I': run VMD every timestep, need labelled anomalies # 'II': run VMD once at the beginning, normal data only L = 200 TRUNCATE_MODES_STAR = False OFFLINE_DATA_DIR = 'data_offline' ONLINE_DATA_DIR = 'data_online' PP_OFFL_DATA_DIR = 'datapp_...
98b66135402589fa6634fec03cbb58113481cc28747ab0d8c887859d4886660b
Python
2,462
100
from math import floor import numpy as np from scipy import stats from scipy.signal import butter, filtfilt def smooth(data, W=10): return filtfilt(np.ones(W) / W, 1, data) def getBinsX(minbin, maxbin, nbins=101, step=None): if step: nbins = int((maxbin - minbin) / step) + 1 bins = np.linsp...
d910c247bc899a2dce405c99e3f0855643fdd6c58b420c5e96dea623d222aa3f
Python
2,462
66
import os import tempfile import unittest from torcheeg.model_selection import train_test_split, train_test_split_cross_trial, train_test_split_groupby_trial from .test_utils import _make_dataset class TestTrainTestSplit(unittest.TestCase): def setUp(self): self._directory = tempfile.TemporaryDirectory...
dac0fde19e58a53e2355995fa99af0b6ec7aa91a1c373173bf85f6a2102420c7
Python
2,464
62
import numpy as np import pandas as pd import sklearn from . import types def standardized_mutual_information(y_true: types.Array, p_label: types.Array) -> float: """MI(ground truth, predicted binary labels) / MI(ground truth, ground truth).""" return sklearn.metrics.mutual_info_score(y_true, p_label)/sklearn...
dae4e8348440edd1bdf79a5ff28c7c6b8afb9c9b4feb6fa1a4b873b118ab9f1d
Python
2,464
58
"""setuptools.errors Provides exceptions used by setuptools modules. """ from distutils import errors as _distutils_errors # Re-export errors from distutils to facilitate the migration to PEP632 ByteCompileError = _distutils_errors.DistutilsByteCompileError CCompilerError = _distutils_errors.CCompilerError ClassEr...
f9317e49644cacfbad16df72278d069f95c106a89ce06305b2392557e1caf286
Python
2,464
69
#! /usr/bin/env python3 import os import subprocess import logging import APT_interface class cd : """Context manager for changing the current working directory, and automagically changing back when done""" def __init__(self, path): self.path = path def __enter__(self): self.old_path = ...
57b3adb01a27bc8e765bb095c16657951da308828f2970bc4704242bf6834ed9
Python
2,465
58
"""Report actual hardware rather than assuming the target machine is present.""" from __future__ import annotations import importlib.metadata import os import platform import sys import shutil import subprocess from pathlib import Path import torch def _ram_bytes() -> int | None: try: return os.sysconf("S...
ddd08a29e4a824aef60fa61660b2f4ecc352b788e61f282ed037b6e3d556b792
Python
2,466
69
# coding=utf-8 # Copyright 2021 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/LICENSE-2.0 # # Unless required by applicable...
5e7de131d994347c3ca1ad58d7fabc1f8d46222fd06c96a21af6022b2c3bb7fe
Python
2,467
73
### Parsing the result! import tensorflow as tf import os import numpy as np import pickle def get_test_acc(event_file): val_auc_list = np.zeros(100) test_auc_list = np.zeros(100) for e in list(tf.train.summary_iterator(event_file)): if len(e.summary.value) == 0: continue if e.s...
6681c89c1814e5ebb9f3cac79abc208b89f6c18fc1123c2f55e6ed8250c84424
Python
2,467
78
#!/usr/bin/env python3 ## this script creates dataframes from the full distance matrices ## for each movie and parcel (HCP 7T version) import pandas as pd from pathlib import Path # ------------------------------------------------------------------ # settings # --------------------------------------------------------...
78851940c334d50aa99ae05ec5434f37891206f6c240f47e46b974e66bedf1a0
Python
2,467
60
import glob def get_files(datasets: list, directory: str, file_format: str = '*', num_levels: int = 1): """ Updates the list "datasets" with the list of files in the "directory" with the appropriate "format". Takes into account the number of directory layers supplied by the user. :param datasets: A li...
8ab97763395b155f89125ec6a1336840f1f960492356b827aa6af1c836fe7dea
Python
2,467
95
from __future__ import annotations from logging import WARNING, getLogger from types import MappingProxyType import pytest from quacc import Remove from quacc.utils.dicts import recursive_dict_merge, remove_dict_entries LOGGER = getLogger(__name__) LOGGER.propagate = True def test_remove_dict_entries(): d = {...
2f3e1c80416a667d9e7fa3ffd56e15f66bfe671996047d3a2477c048c86ab02b
Python
2,468
82
# Compute principle component regression functional connectivity import numpy as np import os os.environ['OMP_NUM_THREADS'] = str(1) from sklearn.decomposition import PCA def pcaFC(stim,resp,n_components=500,nproc=10): """ stim - time x feature/region matrix of regressors resp - time x feature/region matrix of ta...
8bde71f6a5c3a5d15b7fa0fddd8c03472c9133758f1996124ab6ddce5cafb84c
Python
2,468
102
import pandas as pd import numpy as np from cuppa.components.preprocessing import Log1pTransformer, MaxScaler, NaRowFilter class TestLog1pTransformer: def test(self): X = pd.DataFrame([[2.718-1]]) X_trans = Log1pTransformer().transform(X) assert round(X_trans[0][0], 3) == 1 class TestM...
2ee1eaf6f0f19b30fa2d79222378f6f3bd861ddb41b12d39ccee2c2f7c390c38
Python
2,469
75
import platform import nox NIGHTLY_INDEX_URL = "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" UV_NIGHTLY_ENV_VARS = { "UV_INDEX_URL": NIGHTLY_INDEX_URL, "UV_PRERELEASE": "allow", "UV_INDEX_STRATEGY": "first-index", "UV_NO_CONFIG": "1", } nox.needs_version = ">=2024.4.15" nox.opti...
b40b964f386bc7e386e586c7d28e4e802352924f120b24949bc232a0d04bae0f
Python
2,469
78
""" Nerfstudio Depth Pipeline """ import typing from dataclasses import dataclass, field from typing import Literal, Optional, Type import torch.distributed as dist from torch.cuda.amp.grad_scaler import GradScaler from torch.nn.parallel import DistributedDataParallel as DDP from edge_nerf.datamanager import DepthD...
e7062fc2156811ed77ee4519e95c46bf21f70a87e0cbb2962d8b1b12366907d4
Python
2,469
72
from __future__ import print_function from . import axioms from . import predicates class Task(object): def __init__(self, domain_name, task_name, requirements, types, objects, predicates, functions, init, goal, actions, axioms, use_metric): self.domain_name = domain_nam...
2d9d1f1bbfaab2478dc91eac062c4bc4723e2d0028ff80fd5c3a7f4fd0d9c499
Python
2,470
73
import os import argparse import nibabel as nib import numpy as np import glob def separate_masks(combined_img): """ Separates a combined lesion mask into binary masks for each label. Assumes labels: SV=1, V3=2, V4=3. """ combined_data = combined_img.get_fdata() # Create binary masks sv_m...
c92a79659bc7a929866acf7325068760a3a65083b2eeccde9b7da4f1498c8bdd
Python
2,470
79
import click from tqdm import tqdm from pathlib import Path from PIL import Image import numpy as np import torchvision.transforms.functional as F import segm.utils.torch as ptu from segm.data.utils import STATS from segm.data.ade20k import ADE20K_CATS_PATH from segm.data.cityscapes import CITYSCAPES_CATS_PATH from ...
cdb55a85bbd260a4d2b5933bc35ae9c7c62a94ca8a095b50c778f8acf2455756
Python
2,470
77
#!/usr/bin/env python3 ## this script creates dataframes from the similarity matrices ## (upper triangle) for each movie and parcel ## and saves them to a new CSV file import pandas as pd from pathlib import Path # ------------------------------------------------------------------ # settings # ----------------------...
03390fc721b5d1f7fcd159b3958cc9e8c44a234426c3e2b743b878af054ed34c
Python
2,471
90
import os import sys import math import pickle from rdkit import Chem from rdkit.Chem import rdMolDescriptors from torchdrug import utils module = sys.modules[__name__] path = os.path.dirname(__file__) # Calculate synthetic accessibility of molecules # Code adapted from RDKit # https://github.com/rdkit/rdkit/blob/m...
b19547f0d7b21c28f08af8b36cd91a08023bf984c5ec3b261394227a6a0f5d2e
Python
2,471
72
# # 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,...
87ffdc497d3f4a7efe706a96d7aa89c7d7c731e424256aa5df2f1a02d88d7db4
Python
2,472
69
#! /usr/bin/env python import argparse import os def str2bool(v): # susendberg's function return v.lower() in ("yes", "true", "t", "1") def filter_one_signal_feature_file(sf_fp, wfp, label): wf = open(wfp, 'w') with open(sf_fp, 'r') as rf: for line in rf: words = li...
1417f61d2a5bbd78ca829136fcac9734131e621ca961c81e8a4598e734ff292b
Python
2,473
50
from collections import defaultdict from ckg.graphdb_builder import builder_utils import re def parser(ontology, files): """ Multiple ontology database parser. This function parses and extracts relevant data from: Disease Ontology, Tissues, Human Phenotype Ontology, \ HUPO-PSI and Gene Ontology databa...
9e1a94d2da9bd5c7d0051b3fc41beabe46c0952758f2a59588ed284361d8f56b
Python
2,473
61
import unittest import numpy as np import torch from torcheeg.datasets.constants.emotion_recognition.deap import (DEAP_ADJACENCY_MATRIX, DEAP_CHANNEL_LIST, DEAP_CHANNEL_LOCATION_DICT, DEAP_LOCATION_LIST) from torcheeg.datasets.constants.emotion_recognit...
7c20d790d6082fb97d4fed2b5b492d4b7d1823eccaf36b01d0de0a29a695485d
Python
2,474
67
#!/usr/bin/env python # # Copyright 2008, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
fa7ce249ae54cdba55b7bc2deaefdc64247b583b797c4b47bb75d81df54fd092
Python
2,474
71
"""""" """ Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free softw...
42f96960cfa4f8df713eb0f6baa5cc33ff2528a01be04472c1f922fe7bc0d5c4
Python
2,475
81
import math import numpy as np import pandas as pd from scipy.spatial.distance import cdist from scipy.interpolate import RBFInterpolator from visualize import plot_pts def filter_outliers(fpath_src: str, fpath_dst: str): src = np.loadtxt(fpath_src, delimiter=' ') dst = np.loadtxt(fpath_dst, delimiter=' ') ...
bf5a05f9c85cbd1bb63b582ea126cac40bbdfd5c7bfb80e6d7076d6f3a5778d5
Python
2,475
63
#!/usr/bin/env python # # Copyright 2018 Google LLC. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of...
3ab3778f099f5d0e15385d32071416ddc8aec16f12dc62d7593b79466aab557e
Python
2,476
83
""" Saving model output. """ import json import pickle from copy import deepcopy import os import numpy as np import xarray as xr def save_to_pickle(datafield, filename): """ Save datafield to pickle file. Keep in mind that restoring a pickle requires that the internal structure of the types for the pi...
837249d863baff440b265897699a9bcb0d8cbeeb86020cbafe9f144df3e5a069
Python
2,476
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...
129a99ef602ab186e9deb40f6e3320a7d9113685a2a6e9bc4443c6bf1a714b68
Python
2,477
71
import os from cirrocumulus.util import get_fs def get_path(dataset, dataset_path): path = dataset["url"] if path[len(path) - 1] == "/": # remove trailing slash path = path[0 : len(path) - 1] if path.endswith(".json"): path = os.path.dirname(path) path = path + "/" + dataset_path ...
2ce89ff890147b94b0ee9f5198eefe1b3e68dab89883c647dd8c2c6b5b08fe42
Python
2,477
60
# coding=utf-8 # Copyright 2020 The Allen Institute for AI team 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/LICENSE-2...
6d260d300d9bfc7b69286d76a4714c796c44f256651bf07567bf56d8294166f4
Python
2,477
76
import matplotlib.pyplot as plt import matplotlib.pylab as pl from Functions.f_AnalysisFunctions import * from Functions.f_SignalProcFuncLibs import * from Functions.f_ECGAnalysis import * from Functions.f_AnalysisGraphs import * from Functions.f_AnalysisStatistics import * import os import pandas as pd import...
f6e20fde9715c75039131b0c47c0a73fb6d87a2442475312021d80ade4ec02d0
Python
2,477
70
import os import dllogger as logger from pytorch_lightning.utilities import rank_zero_only from dllogger import JSONStreamBackend, StdOutBackend, Verbosity # inspired by the NVIDIA nnU-Net GitHub repository available at: # https://github.com/NVIDIA/DeepLearningExamples/tree/master/PyTorch/Segmentation/nnUNet # logg...
b9847233228f28c1550d30ccd5cbd68b15c74b683a58f4321f2bd41b6d9876ce
Python
2,478
77
import torch import torch.nn as nn from torch import Generator from typing import Any from abc import ABCMeta, abstractmethod class FirstLayersBlock(nn.Module, metaclass=ABCMeta): """ Network first layers performing low-resolution feature generation """ @abstractmethod def __init__(self, ...
dad7e1e829858dfec550ba74ef072daa12a4aa1dc80ca59ec84e749f519c3b61
Python
2,478
83
from collections.abc import Callable, Collection, Iterable, Iterator, Mapping from typing import Self, overload, override from .datagraph import DataGraph, Edge, Node _registry_types: list[type] = [] def is_registry(obj: type) -> bool: return obj in _registry_types def mark_as_registry[T](object: type[T]) -> ...
f105d6be91b12f4fdfca441ed4e70308b7b5200e8bba29206cf7b068fd8efa95
Python
2,478
64
from __future__ import print_function import sys import os import argparse sys.path.extend([ 'ss-pybullet', ]) from perception_tools.common import get_models_path from pybullet_tools.utils import ensure_dir, connect, create_obj, approximate_as_cylinder, wait_for_user, remove_body from retired.mesh_tools.create_o...
c48f571ce11c77b0cd08a27ed08514dbfd36a49ad10bd8911e9adcc4d6de7d75
Python
2,479
75
from .base import AtomsDataset from typing import List, Optional from ase import Atoms from ase.io import read from ase.db import connect class ASEData(AtomsDataset): def __init__(self, frames : Optional[List[Atoms]]=None, indices : Optional[List[int]]=None, ...
4009df76587406ee303b2f5e1cfd8793e8f0bfbcc1dcacdc88fdae0b3b1c37ca
Python
2,480
79
""" Yu Group's implementation of sklearn_NMF """ """ Source: https://github.com/Yu-Group/staNMF/blob/master/staNMF/nmf_models/sklearn_nmf.py """ from sklearn.decomposition import NMF #from sklearn.decomposition.nmf import _initialize_nmf import numpy as np class sklearn_nmf(NMF): ''' Train non-negative matri...
d19f0502bd0e1258a555d9d7901a788429f654fcfb5974cfcebf1e9e23029c9a
Python
2,480
82
#!/usr/bin/env python import matplotlib.pyplot as plt from matplotlib.pyplot import figure import warnings from scipy import stats import numpy as np import seaborn as sns # def FittedMixturePlot(gm, outdir,comb, NoisedIDs): # with warnings.catch_warnings(): # warnings.simplefilter('ignore') # #Mixture Plo...
037c993ba9108a931c7f81bddef14014ce8dc8b6058070b02ebcb926ba4d52ac
Python
2,481
31
"""SEROTONIN_MATCHED_CONTROL.py 2026-09-24. Regenerates an orphan number of Act 4 (from an 11 Sept briefing with no surviving script): re-signing the 1,021 SER-called neurons excitatory, from the Pospisil convention, moves rho(W_EE) by ~1.49x; re-signing 1,021 GABA/glutamate neurons matched on synapse budget moves it ...
70e6ab1548007c1654082602bd41f3cf5e1c9b254027950765af1968787d8dd8
Python
2,481
62
import numpy as np import pytest from SurvivalEVAL import QuantileRegEvaluator @pytest.fixture def quantile_evaluator() -> QuantileRegEvaluator: """Build two piecewise linear survival curves with medians two and four.""" return QuantileRegEvaluator( pred_regs=[[1.0, 2.0, 3.0], [2.0, 4.0, 6.0]], ...
9e640c0ff9da8c4274ff1436d33b289883ab864db4254e68c194cefb9fd0dcb8
Python
2,481
60
"""_peek_shape_and_spacing reads a header without materializing the volume. registration_2d used to `load_volume(...).data` the fixed image just to test 2D-vs-3D and read spacing - a ~616 MB float64 materialization of the 25um CCF, once PER SECTION in registration_batch_2d. For a 3D NIfTI atlas the peek now reads...
ad120767faca7d9f38240f9579e78d21bf1a336e73b7f8e2847c008e82d1c2ae
Python
2,481
81
# dataset settings dataset_type = "ADE20KDataset" data_root = "data/ade/ADEChallengeData2016" img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True ) crop_size = (512, 512) max_ratio = 4 train_pipeline = [ dict(type="LoadImageFromFile"), dict(type="LoadAnnotations", r...
59d15329a40beef91a4b3285ea3cc59a35407753d35c8baf7915f749a4a7da59
Python
2,482
91
# Node-group asset "Color Backbone" (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...
65a6871468336bd8dcce36e76fac33c079d363ab5a77805df4a2ac6554dfb0ad
Python
2,482
32
"""posthoc_sign_worlds_smell_2026-10-08.py (POST HOC, descriptive). In the U and V worlds of SIGN_WORLDS (H6, FlyWire v783), which sign did each v2LN30 draw, and how much of s do the 150 uncalled local neurons carry? Same draws as SIGN_WORLDS_ANALYSE.smell(). Output: 06-OUTPUT/posthoc_sign_worlds_smell.txt""" import sy...
d7470a5e11447ca284c57f4e3ae98eaccf9bf26d8620701b1dbf2136bc3ea0cd
Python
2,483
63
from elasticai.creator.file_generation.savable import Path from elasticai.creator.file_generation.template import ( InProjectTemplate, module_to_package, ) from elasticai.creator.nn.integer.ram.design import Ram from elasticai.creator.nn.sequential.design import Sequential as _SequentialDesign from elasticai.cr...
dc6d975ab99e0e48b16e5fa48ec9fa9dedd1f5f69e9e6708554f814cf38d5ae6
Python
2,483
63
# # 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,...
fc286429cb6a9bd3eb809e8b0343597162372f7592be4debfb43f3a1a97faa63
Python
2,483
66
from typing import Any, cast from elasticai.creator.arithmetic import ( FxpArithmetic, FxpParams, ) from elasticai.creator.base_modules.conv1d import Conv1d as Conv1dBase from elasticai.creator.nn.design_creator_module import DesignCreatorModule from elasticai.creator.nn.fixed_point.conv1d.design import Conv1d...
42765b9d2f9bc9c1afd02fa15ff05693eb56b51ddeaf91bf7f7ba37171c9d80f
Python
2,484
72
# 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...
652049f1f387815c8016a0d7a9481f60822f7dc72bd00209b72f4fe8675844a3
Python
2,484
76
import cocotb import pytest from cocotb.triggers import Timer from elasticai.creator.arithmetic import FxpArithmetic, FxpParams from elasticai.creator.testing import CocotbTestFixture, eai_testbench from elasticai.creator_plugins.act_func.utils import load_and_plugin def act_heaviside(xin: list[float], config: FxpPa...
8058e999484bfe5515c92cbe17d025d3f30d586c8a6568bef86243bcb7b1f8cb
Python
2,484
54
# 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...
3c4cc186537f0d3503f147b58f7997115b94cba5a01c982a76eb8955037fd838
Python
2,485
99
# Node-group asset "Color OKLab Mix" (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...
756707eb5e0efc922b7623964f055feb47a45aa9dbd75945872a1721e2a36f41
Python
2,486
72
# 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...
7749b595ba3f71ce36c7f039b817c1683e84e97ffab483f2c0bb97c099948b8a
Python
2,486
47
from sklearn.preprocessing import StandardScaler import numpy as np # Definition of CustomScaler that scales all columns except the ones in columns_to_exclude (mole fraction here) class CustomScaler: def __init__(self, Embedding_BERT): self.scaler = StandardScaler() self.columns_to_exclude = [1] # ...
f6dc6aa31b71dbbdcc78e3eff84070a8b51c94c1cf5ba0c5f3e50af21f7c5592
Python
2,486
71
# 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...
151b2b581cf84e6e1d021eb3184853a79bf404078047f4b9517bd306b217eee6
Python
2,487
66
"""Selectable affine-stage methods for the 01_affine registration stage. Each non-'default' method maps to an ANTs linear `type_of_transform`. 'affine' is tuned to reproduce the affine sub-stage baked into the fused `SyN` preset (verified against antspyx registration.py: shrink 4x2x2x1, conv 2100x1200x1200x0, smoo...
261b645b9be28cb1467398e2b5b5747c09aaf0b5d95d3b897eeaf50c5893ecb0
Python
2,487
66
import unittest from torcheeg.transforms import Select, Binary, BinariesToCategory, StringToInt, BinaryOneVSRest, FixCategory, Mapping, Multilabel, Normalize class TestLabelTransforms(unittest.TestCase): def test_normalize(self): t = Normalize(min=0.0, max=1.0) self.assertEqual(t(y=0.5)['y'], 0.5...
e06bf7d911e1b2289e6e48a4bd51676ceee8df7d6a420e99ce9c2a495a309141
Python
2,487
69
from typing import Callable import torch from torch import Tensor, optim from torch.nn import Module from elasticai.creator_plugins.quantized_grads.base_modules import parametrized_modules class _QOptim(optim.Optimizer): def __init__( self, model, *args, buffer_quantizations: dic...
2c8e29779e38a0bdd6aec3e979029e2c3279d07641b1a21be0532afb1617e80e
Python
2,488
81
import torch import torch.nn as nn import torch.optim as optim from torch.utils import data from .autoencoder import autoencoder_loss # Import utilities for Cluster distributed runs # from mle_toolbox.utils import set_random_seeds # Minimal VAE implementation # Adopted from https://github.com/Atcold/pytorch-Deep-Lear...
8720191f659e20f9025a6da58f5550cb4e04e935dbe2ba1f391a2bd4d1a5a89a
Python
2,488
94
#!/usr/bin/env python3 import os import pandas as pd # ------------------------------------------------------------------ # paths # ------------------------------------------------------------------ proj_path = '/project/3011157.03/Simon/proj_2022_CABB_movie' # location of R output files r_path = os.path.join( pr...
3bd10740c5b12124aefec56575e7f7759451267ef2b60f747ee227e41ac99653
Python
2,489
80
from typing import cast from elasticai.creator.file_generation.in_memory_path import InMemoryFile, InMemoryPath from elasticai.creator.nn.fixed_point.relu.layer import ReLU def test_vhdl_code_matches_expected() -> None: expected = """-- This is the ReLU implementation for fixed-point data -- it only checks the h...
612b1a3a869ed7a997c0416f1f607261be93e26e0c96a7031a74d1c8a7ecd1d5
Python
2,489
76
# 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...
b8529538f75d055257dba22bdb95b40e50a561a1b6a7186afbb8e87860a6e494
Python
2,489
84
## # \file siena.py # \brief # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date Nov 2016 # # Import libraries import SimpleITK as sitk import numpy as np import sys import os import re from skimage.measure import compare_ssim as ssim # Import modules import pysitk.simple_itk_helper as sitkh imp...
d8511b765adb891c8b48c53d416ec2428dac6ef3671591de5170807c4260c8b4
Python
2,490
61
from optparse import OptionParser ### help and usage ### usage = "usage: %prog [options] args" description = '''Function: calculate biallelic minor allele frequency''' version = '%prog 08.15.2021' parser = OptionParser(usage=usage,version=version, description = description) parser.add_option("--in_snp", ...