sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c755b3accfe155c6da2c6ec896f144a95fc2bfe0ff74db01e1557132fbb03779
Python
5,769
162
# 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...
f1af240169a0249894000b875574a20764d3f3f7251965fc74d6a025b6462e1c
Python
5,769
117
# * currently consider directly read the CG original files (organized as the original generation form from MARTINI) * import os import logging import warnings from tqdm import tqdm from torchdrug import data, utils from torchdrug.core import Registry as R from cg_steps import cg_protein logger = logging.getLo...
2d08b3abc198f3f5d6373629ebd9f275e154a22af4659ea433596a3f3669886a
Python
5,770
162
from collections.abc import Iterator from typing import Generic, TypeVar from .graph import Graph T = TypeVar("T") TP = TypeVar("TP") class State(Generic[T, TP]): def __init__(self, graph: Graph[T]) -> None: self.order: dict[T, int] = {n: i for i, n in enumerate(graph.successors.keys())} self.or...
a094404ff83ed59970a9d4848f174f587db0ef2468c57664cbfce5e9f7bcd951
Python
5,771
177
""" Script for drawing GraphMCF instances as graphs Input: - File with a GraphMCF (.pkl) Output: - Output view (interactive window or .pdf file) """ __author__ = 'Antonio Martinez-Sanchez' # ################ Package import import sys import time import getopt from graph import GraphGT from globals ...
770a8fa00ae75bbe8443244ed3aa5b783131d58fb6322f6128e54a20a4b43562
Python
5,772
144
import matplotlib.pyplot as plt import os from constants import ABSOLUTE_ERROR from src.analyze.utils import init_mpl from src.dataloaders.semantic_transforms_dataset import TF_BRIGHTNESS, TF_PERSPECTIVE, TF_CONTRAST, TF_ROTATION colors = init_mpl(sns_style='ticks', colorpalette='muted') _CSV_PATTERN_ROT = "rotatio...
74d13861c4c6d57b56cb2110183ad5011470b7e68c0549809b8046e9818b30ab
Python
5,773
158
#!/usr/bin/env python2 from __future__ import print_function import sys import os import json import stat import argparse import subprocess import datetime import re import glob import csv import warnings def main(): epilogstr = 'Examples:\n.../runpostproc.py /path/to/rootdir --prmfiles prmfile1.mat#prmfile2.mat...
a1c7a4f1fc9f800c6a7ce8dd25308ad3afa80f68fb3da0cf39d3a79fe004de15
Python
5,773
162
""" Pre-process PyTo segmentation of the pre-synaptic vesicle. Each vesicle is cropped in a sub-volume, also membrane segmentations for PySeg application are generated Input: - Reference tomogram - Segmentation tomogram Output: - A set of subvolumes with the original density map, segment...
d15c085988d797408c48b4d29681eb4a22381afb8411bf7bd37c68b71a60d311
Python
5,775
149
# # 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,...
ca9813aaa2b02d3746bbf518f748c92806615fdf150ce52e100df27de2017f7e
Python
5,776
198
from collections import namedtuple import logging import warnings from typing import List, Sequence import numpy as np import pytorch_lightning as pl import rich.syntax import rich.tree from omegaconf import DictConfig, OmegaConf from pytorch_lightning.utilities import rank_zero_only from pytorch_lightning.loggers.l...
80c68b7be555c02de459940437032d8583315e8d615ea8800c45092b661ca531
Python
5,777
170
import bct import numpy as np from tqdm import tqdm from sklearn.utils import check_random_state def strength_preserving_rand_sa_reheat_trajectory(A, rewiring_iter = 10, nstage = 100, niter = 10000, temp = 1000, frac ...
65aa9295c70ec87bc5bcae86be7a57add6895567d43df77732576864343409aa
Python
5,778
154
"""Interface class for dimensions.""" from __future__ import annotations from dataclasses import asdict, dataclass, field from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from collections.abc import Callable, Iterable from typing import Self def _dict_factory(items: Iterable[tuple[str, Any]]) -> dict[...
8ef4edea22a6bfe66a963dd3c95d129c3bc8fd7b074fa20857da40ef720a5ded
Python
5,779
215
#!/usr/bin/env python # coding: utf-8 # ### Neural network hidden layer size experiments, per gene # # We want to see whether smaller models (i.e. models with smaller hidden layer sizes) tend to generalize to new cancer types better than larger ones; this script compares/visualizes those results. # In[1]: import o...
d8f2907e8d1bb2a44bcd56addff2c286b1e9c1a320ebc9c147e6018e2b4848e6
Python
5,780
98
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from lab.reports import Attribute, gm from downward.reports.compare import CompareConfigsReport from common_setup import IssueConfig, IssueExperiment import os def main(revisions=None): suite = suites.suite_optimal_with_ipc11() conf...
3524962b44524b2cfac2f78213f22417914a59729baf52ca7f5aa38f433e99e7
Python
5,782
180
# Node-group asset "Periodic Box" (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 ...
3c7572261737093d47530e7c497270de7132c02b0d3dc1e60959a1588cef8d2d
Python
5,783
190
# Node-group asset "Nucleic Dihedral" (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...
76ed6d29c26e8eae34dc072df7b71060e843881895cbdcb97f222b5dcefaa078
Python
5,784
197
#!/usr/bin/env python """ Reads a labels file containing discs and writes another labels file with the discs extending to balls having same centers and radii as the discs. This script may be placed anywhere in the directory tree. ToDo: - see about excentricity $Id$ Author: Vladan Lucic (Max Planck Institute for Bi...
dadfbaff4d2b55765ecef9031a25abe622fa97f72552ee7ab248a7acc92a01ae
Python
5,785
152
from dreamcoder.program import * class TowerState: def __init__(self, hand=0, orientation=1, history=None): # List of (State|Block) self.history = history self.hand = hand self.orientation = orientation def __str__(self): return f"S(h={self.hand},o={self.orientation})" def ...
303d95564910bea37a98412712533bf5e733b92abdffc37232118374e0796e94
Python
5,786
170
import numpy as np from elasticai.creator.file_generation.savable import Path from elasticai.creator.file_generation.template import ( InProjectTemplate, module_to_package, ) from elasticai.creator.nn.integer.math_operations import get_padded_count from elasticai.creator.nn.integer.ram.design import Ram from e...
8742ae4117993d4a25ba8bd78f074b6ecd9dd1c7d6c4b38820622097ddcfe898
Python
5,786
138
"""Cell points land on the anatomy in the input pane, for every 2D-ish input type. Two defects this pins: 1. Scale. ``load_preview_array`` strides the section down to <= 256 px in-plane, but the tab handed the panel point coords at ORIGINAL resolution - so on a 6000x8000 section (stride 32) nearly every ...
18e6c113cd62ffa20200f50d6201d3a7e8f84a79195c17fdeef83c66cef34e8d
Python
5,787
101
"""Steering diagnostics: numerics, step alignment and zero effect on inference (tiny random weights).""" import json import math from threading import Event import numpy as np import pytest import torch from conftest import assert_no_hooks from liquidaion_fly.observatory_engine import ChatSession from liquidaion_fly....
33c89baff8613620102420bd89fa031d11fc1249848990d1519f7421283abdf0
Python
5,788
187
# 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...
9647390c470946f99b3b0741d1bb951eaef6a6b6970a778c7b46521c331681a8
Python
5,788
118
# * currently consider directly read the CG original files (organized as the original generation form from MARTINI) * import os import logging import warnings from tqdm import tqdm from torchdrug import data, utils from torchdrug.core import Registry as R from cg_steps_energy_injection import cg_protein log...
2aa9a954cabac9fbea2c6190502a15bdb9fac03d998b28c56709238bbf14a7f5
Python
5,789
134
import numpy as np import pytest from SurvivalEVAL.nonparametric_estimator.competing_risks import ( AalenJohansenCompetingRisks, ) from SurvivalEVAL.nonparametric_estimator.multi_state import AalenJohansenMultiState def test_multistate_product_with_return_transitions(): transitions = np.zeros((2, 3, 3)) ...
7f950212cc97b704ef7fcdf8408949c210df87aff9311ff3edd3f350603bd6f7
Python
5,789
132
import os import numpy as np import cv2 import pandas as pd from annotation_module import process_video_folder # Import the function from the previous script def read_last_annotations(csv_path, image_shape): df = pd.read_csv(csv_path) print("Column names in the CSV file:", df.columns) # Print column ...
bdabd4c5d46124d328c9b983a488125e173ddbce3d4bbb0345cc55e138bec272
Python
5,790
196
# # Configuration dataclasses for ACME # # Copyright © 2026 Ernst Strüngmann Institute (ESI) of the Max Planck Society # # SPDX-License-Identifier: BSD-3-Clause # # Builtin/3rd party package imports import logging from dask.distributed import Client from dataclasses import dataclass, field from typing import Optional,...
0185dcd11fd474f87235cd91c8403b6c2136076c1bea9ea87f4994051349aa33
Python
5,791
126
########################################################################################## # This Script # 1) imports the blocks based on the condition name in EEGLAB form from the BIDS directory # 2) removes the stimulus artifact iv: -1.5 to 6 ms, for ESG use -7 to 7ms - linear interpolat...
b4209b31ebb8eb1c83704fbef701cf6159649aa6e0051d1524501fdbae429dd7
Python
5,792
157
from __future__ import annotations import threading import time from concurrent.futures import ThreadPoolExecutor from functools import partial from typing import TYPE_CHECKING, Literal import pandas as pd from pertpy._types import cast_frame from ._look_up import LookUp from ._metadata import MetaData if TYPE_CHE...
503c9afe89efb9e3db29077968134448b634bebc18013b198591e211c07e8c33
Python
5,793
135
#! /usr/bin/python import argparse import os def _read_one_mod_freq_file(freqfile): freqinfo = {} with open(freqfile, "r") as rf: for line in rf: words = line.strip().split("\t") m_key = (words[0], int(words[1]), words[2]) pos_in_strand = int(words[3]) ...
6a057179e11f5bd448365b389b7a74a820c1a974f8b34521840fa0596b886513
Python
5,793
192
# 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...
bcc1029b163340406074e0f64da3c0e9c151816187c4eb7d1f2480a3cb769647
Python
5,793
199
# 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...
5245387cf0afbf39299c544ad7bef5b670a0b717a8eb8408702b1d798b93e1c8
Python
5,794
229
#! /usr/bin/python # -*- coding: utf-8 -*- import tensorflow as tf from tensorflow.python.util.deprecation import deprecated __all__ = [ 'identity', 'ramp', 'leaky_relu', 'swish', 'sign', 'pixel_wise_softmax', 'linear', 'lrelu', ] @deprecated("2018-06-30", "This API will be deprecate...
b63637893bac0504f809ad8dfe5e243b0cfc9158b764fe658551633113a68a85
Python
5,794
122
""" HEMIBRAIN_CONF_CONFOUND.py Open item 4 in NOW.md section 7: "The hemibrain conf column. Is the undetermined set just low-confidence T-bars?" hemibrain-v1.2-tbar-neurotransmitters.feather carries a per-T-bar detection confidence `conf`. If the within-neuron transmitter heterogeneity that drives the effective-sam...
bad3aa63bdfce45f83e2c6c09d99ba13d9620477445b63122f35eaf324d16115
Python
5,794
168
''' Modified by Mayank Kabra From LEAP https://github.com/talmo/leap by Talmo Pereira ''' import cv2 import numpy as np import keras from keras.utils import Sequence import PoseTools import easydict def transform_imgs(X, theta=(-180,180), scale=1.0): """ Transforms sets of images with the same random transformatio...
334ef22943abac13f5e380550db58d2d69629931cd13bb35b7cb097213df4dcb
Python
5,795
172
import argparse import pickle from collections import Counter class TorchVocab(object): """ :property freqs: collections.Counter :property stoi: collections.defaultdict, string → id :property itos: collections.defaultdict, id → string """ def __init__(self, counter, max_size=None, min_freq=1, ...
3058d35161456905504df19ae0e946f701a46f28ee1887b22c150c6778d1fc52
Python
5,796
130
import sys import unittest from unittest.mock import patch import pandas as pd import os import sys sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../src") sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../scripts") from predict import args, predict class TestPredict(unittest.Te...
ed0926d82150c9fa98522f97e6367313cd38761481beb229581db3c9c5febf5c
Python
5,796
166
# Write the benchmarking functions here. # See "Writing benchmarks" in the asv docs for more information. # http://asv.readthedocs.io/en/latest/writing_benchmarks.html import autograd.numpy as np from autograd import grad class RNNSuite: """ Checking speed on a vanilla RNN. """ # NOTE: this is run ea...
04b3e9abd1f6e4404713a2f408f1a891ee61fa8d6bd6f105314c4a1c3159ced1
Python
5,797
166
#!/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 a weather class and py_trees behavior to simulate weather in CARLA according to the astronomic behavior of the su...
4e70d699fffe218a3b9eb88ecdfe92febee3a5aef86a675b2a21f0174b7da0b5
Python
5,797
203
# # 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,...
d7e50bbb5f69a2beb562449b1c7ac56c2924bd308a079828f721f0478eaa1364
Python
5,797
162
import json import os from glob import glob from lxml import etree as ET import cv2 from stitcher import stitch_slide, compute_overlap_percent import sys def get_pixel_size(slide_path, default_pixel_size=1.85, default_tube_lens_mm=50.0, default_objective_tube_lens_mm=180.0, default_magnification=20.0): parameter_p...
03371a4aef17d16129d962617ed5da506e1fa0ff03738438974bd82a3dcab460
Python
5,799
163
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' Script to do stats on ROI data ''' # Append path proj_name = 'MINDLAB2020_MEG-AuditoryPatternRecognition' wdir = '/projects/' + proj_name + '/scratch/working_memory/' scripts_dir = '/projects/' + proj_name + '/scripts/working_memory/' import sys sys.path.append(scrip...
79d64a193493624b48c61eccdbb872cf769aff856a3195525e0b3a32e68880bf
Python
5,799
174
# 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...
ab3d431529c522f0fdb60e10669e5877493287b9f8a26ed10831e76d2efa54b8
Python
5,799
136
# set QT_API environment variable import os os.environ["QT_API"] = "pyqt5" import qtpy from pathlib import Path # qt libraries from qtpy.QtCore import * from qtpy.QtWidgets import * from qtpy.QtGui import * # app specific libraries import control.widgets as widgets import control.camera as camera import control.core...
d9ae41c2e51ded2ab8e617c0930709d5e6c456215fb7d7d6e3f91764a7761601
Python
5,799
148
"""Tests for the TissueCyte base-reorientation option in the 2D registration path. Covers: the CLI flag round-trip, the param threading across the three layers, and the behavioural effect (the transpose swaps the moving's H<->W) in _load_and_orient_2d. GUI dialog wiring is checked under a QApplication. """ imp...
53db0efb5b9b7ce56e824ecdc44539f19b1d293f5e8ece4b32fedf2396875872
Python
5,802
163
# Manuel A. Morales (mmoraleq@bidmc.harvard.edu) # Beth Israel Deaconess Medical Center # Harvard Medical School import time import matplotlib.pyplot as plt import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed import torch.fft import numpy as np from Config import *...
7fdf4812becb36ae1cf21da087a5e7f9407100d02e880c27e265d430cf390e85
Python
5,803
165
### # This file will: # 1. Generate and save Alexnet features in a given folder # 2. preprocess Alexnet features using PCA and save them in another folder ### import glob import torch import InternVideo import numpy as np import urllib import torch import cv2 import argparse import time import random fro...
2ca62ac25d0b733d88eb98f1f6d12d9d47965adf00c708cb0b134c74ca1927ce
Python
5,804
156
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
be307aeec7a0dd24bc8daf04e3780ce31996a309164fd6af57adbb5feb92b73a
Python
5,804
133
import sys import traceback from joblib import Parallel, delayed import pandas as pd import csv import os import ray ray.init(num_cpus=16) from src.utils import logger, parse_config, SegmentationVideo, Canvas, contain_substr def plot_appear_features(args, run, tag): # FPS is used to visualize, should be inferre...
2370b1280c961abaa5cd5417a5626d40b87884e9e0da47c9b736d1fea537aedb
Python
5,805
178
from __future__ import annotations from functools import cached_property import pandas as pd from cuppa.misc.utils import check_required_columns from cuppa.logger import LoggerMixin class SampleMetadata(pd.DataFrame, LoggerMixin): def __init__(self, df: pd.DataFrame, *args, **kwargs): super().__init__(...
b1ac2fac8498b44f3d465fc0120ecf5d7419a83644166df7cb99e5931611ecfa
Python
5,807
146
# Code adapted from the appyter-catalog github repository (https://github.com/MaayanLab/appyter-catalog/tree/main), # distributed under an Attribution-NonCommercial-ShareAlike 4.0 International license. # Librairies import os import sys code_path = os.path.split(os.path.split(os.getcwd())[0])[0] sys.path.append(code_p...
fbe7274c5578b251d9d7a78be02dfb592c1e865f2942784d29be6632f52250b9
Python
5,808
118
"""The foreground the 2D pipeline initialises from must not depend on working resolution. ``foreground_init`` reduces a mask to two scalars - foreground area and centroid - and applies them as ANTs spacing and origin, so a mask that changes with the sampling grid corrupts the initialisation rather than merely look...
b061ed35ea9ab511a23cf48f9add6955fb3512d99907de1b78a77f69a66ec904
Python
5,809
193
"""Module to show video, if the file format supports it. """ from logging import getLogger from platform import system from PyQt5.QtCore import QTimer from PyQt5.QtWidgets import (QFrame, QGroupBox, QPushButton, QVBoxLayout, ...
0bda4eaeed454150d23db93d6bb29c54a8dd7d55db715212b2e34df7fd2b2c2c
Python
5,811
110
from typing import List import torch import torch.nn as nn from .mmd_like import _MMDLikeTrainer def _maximum_mean_discrepancy_linear(x_source, x_target): delta = x_source - x_target loss = torch.mean(torch.mm(delta, torch.transpose(delta, 0, 1))) return loss class DDCTrainer(_MMDLikeTrainer): r''...
6f83f3f15f7733a3ffe58487e5f919e243e5995f5f3ca36d4982b6cc9a66223e
Python
5,811
189
from numpy import arange from numpy.random import seed from numpy.testing import assert_array_equal, assert_array_almost_equal from pytest import approx, raises from wonambi import Dataset from wonambi.attr import Annotations from wonambi.utils import create_data from wonambi.trans import select, resample, frequency, ...
c2112adf88f98b1480bf255f21361d21680c962bc6c82943694548de2d9fa965
Python
5,811
199
from collections.abc import Callable, Iterator from typing import Protocol, cast, overload import pytest from elasticai.creator.function_dispatch import ( KeyedDispatcherDescriptor, KeyedDispatcherWithRegistrars, create_keyed_dispatch, dispatch_method, registrar_method, ) def test_can_register_n...
dc56d79b64827074a9835ffd6680a555d44759de7c78989fb7362f10018bf474
Python
5,811
210
import numpy as np import graph_tool.all as gt from scipy.sparse.linalg import spsolve def get_sorted_label(u, msfa): fu = u.copy() mfas_filter = fu.new_edge_property('bool') mfas_filter.a = msfa fu.set_edge_filter(mfas_filter) sort = gt.topological_sort(fu) return sort def get_sort...
9ffdc92fe23a253624eb63e4d30db83a3994f751142011dfab33b6546de81d5b
Python
5,812
167
from torch import nn from torch.nn import functional as F from torchdrug import layers class ProteinResNetBlock(nn.Module): """ Convolutional block with residual connection from `Deep Residual Learning for Image Recognition`_. .. _Deep Residual Learning for Image Recognition: https://arxiv.org/p...
f034031e5f706fd11683034e669456fa408d340e8e0553b197a9ced6f8c69a10
Python
5,812
183
from __future__ import annotations import os from pathlib import Path import pytest from ase.build import bulk from ase.calculators.emt import EMT from quacc import change_settings, get_settings from quacc.runners.prep import calc_cleanup, calc_setup, terminate def make_files(): with open("file1.txt", "w") as ...
fd6704966dc30df9a44b6765f9bc6684302fbf83b528a1e80083a902fc0676d8
Python
5,812
197
# 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...
5a95a5a605e131b9c826e18c7206e81c6cfefbb61ec9b961b443529e6812764a
Python
5,815
138
import math import numpy as np import torch import torch.nn as nn import torch.optim as optim from typing import Any, Dict, Optional from models.model import Model class M2DCNN_Net(nn.Module): @staticmethod def weight_init(m): # [All the trainable parameters in our CNN should be initialized to ...
a161cf84b76cabeb279590cc6b0d9db25702033e6ddb14818d5f02e27fca4bec
Python
5,816
110
"""Shared threshold helpers for tissue/background masking. Two consumers derive a tissue threshold from intensity and must not drift apart: the 2D registration foreground (``registration_2d._clean_foreground_mask``) and the standalone tissue-masking tool (``tissue_masking.core.masking.compute_tissue_mask``). They ...
1e5e86f1253c1fe7ea62ec0aebe97c76eccddcc2f69111ea6bc684453cf3f647
Python
5,817
118
''' Script to create a table of results ''' import pandas as pd import db import os from scipy import stats from sklearn.metrics import mean_squared_error from collections import defaultdict DATABASE = db.setup('PATH_TO_DATABASE') ROOT = 'PATH_TO_ROOT' VARIATIONS = ['random', 'compounds', 'kinases'] for VARIATION in...
84a6a48f157192400ee7e391be3c22b7b7d4c94ce2564fb8e6fbdb24660447e0
Python
5,817
179
import numpy as np from numba import njit @njit(nogil=True) def _calc_mean_shrunken_residuals( data_chrom, indices_chrom, indptr_chrom, start, end, smoothed_vals, n_cells, chrom_len, shrinkage_factor=1, ): shrunken_resid = np.full(n_cells, np.nan) if start > chrom_len: ...
15b04d9a350463d0ae9041331563b71a6436f3714638067c131ff220d6a1ad5d
Python
5,819
136
import numpy as np import pandas as pd import vireoSNP def load_ground_truth(n_mut, af_pct, size=None, tree=None): if size is None and tree is None: ground = pd.read_csv('data/' + str(n_mut) + '_clonal_variants_fixedAF' + str(af_pct) + 'pct/clonal_var.csv') elif tree is not None: ground = pd.re...
501df7551beaafb576a143c3f521b47fa3664d7f362ee9b4364fa4c9110bfa0a
Python
5,820
164
import torch import torch.nn as nn import torch.nn.functional as F from ..initializer import create_initializer class BottleneckBlock(nn.Module): expansion = 4 def __init__(self, in_channels, out_channels, stride, stage_index, base_channels, cardinality): super().__init__() ...
d69ba8cb6a7330abab1dd8a0c65a7a937bd1551f624a255c21c3b325c4ea45aa
Python
5,820
191
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import os import pathlib from argparse import ArgumentParser import pytorch_lightning as pl from fastmri.data.mri_data import fetch_dir fro...
fac90ed9f81807ca772a0fff1b6d1e1386a41e5ee27f5919b243a9a358b1c723
Python
5,820
180
"""Column name constants for the DataFrame representation of HED schemas.""" from hed.schema.hed_schema_constants import HedSectionKey KEY_COLUMN_NAME = "rdfs.label" # Known tsv format suffixes STRUCT_KEY = "Structure" TAG_KEY = "Tag" UNIT_KEY = "Unit" UNIT_CLASS_KEY = "UnitClass" UNIT_MODIFIER_KEY = "UnitModifier" ...
6c34e822d42e288c94a9e2446412bb7f06ef72f7c4c64500eef958d0f3100db9
Python
5,821
137
#!/usr/bin/env python # -*- coding: utf-8 -*- """ """ import os import warnings import numpy as np import SFC_backprop def restore_weights(datadir=os.path.join(".", "saved_weights"), index=0): files = os.listdir(datadir) files = [f for f in files if 'final_weights' in f] files = np.flip(np.sort(files)...
8d4aedf9718c40135620d9e6631ef284887a231fc2360936044d9b94e28bb8ad
Python
5,821
166
import numpy as np from scipy.ndimage.interpolation import map_coordinates from scipy.ndimage.filters import gaussian_filter from cv2 import imwrite import csv from cv2 import imread import os from imutils import rotate_bound from skimage import transform, filters from helpers import * import time from config import DA...
3f14b53591c8bb2420ba427302e4c06b37851eb4750a10eae608b4e6858a2ad4
Python
5,822
144
"""First-launch welcome dialog for the CCF Boundary Editor. The editor used to present a blank canvas on first launch with no guidance, leaving the user to discover the Atlas picker, region activation, brush controls, multi-region delete, and shortcut overlay on their own. :class:`WelcomeDialog` is a single-scree...
5aaa8c8c356eb652820acd8ad2cab499dbffed3dc3a30e151489f7bc13377b43
Python
5,822
170
#!/usr/bin/env python # # Copyright 2009, 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...
bfd01a19dbe56778c9f54c80db7f673185e57370c2f4128409c606308119134a
Python
5,822
141
# 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...
f7de006bfb32639f134aa616350d74792b75c56a13ffbf9e1f6bf5461f251d8e
Python
5,822
166
from __future__ import annotations # module use /cm/shared/ex3-modules/202309a/defq/modulefiles # module load python-fenics-dolfin-2019.2.0.dev0 # . ~/local/src/smart-comp-sci/venv/bin/activate from pathlib import Path import pandas as pd import json from typing import NamedTuple, Any from itertools import cycle import...
fa7dc7c3758d2e7ed405ea951071bfdc08be7f6e1ee8f5627c9a5f7cad1e07aa
Python
5,822
114
""" Python implementation of EPI registration """ import os import sys import numpy as np import fsl.wrappers as fsl from oxasl import struc def epi_reg(wsp, epi_img, use_fmap=False, **kwargs): """ Do EPI registration """ struc.segment(wsp) wmseg = wsp.structural.wm_seg bbr_sch = os.path.joi...
18bd69beb0c04372f3b48d74607a10928c1bb44a32c4b133f262a0d2f1feae77
Python
5,823
139
"""Per-section tissue masks for the tissue-masked vignetting-correction mode. A section's raw tiles are laid on a clean, non-overlapping grid (a "montage") and segmented once with the project's seeded Multi-Otsu-4 GrabCut. Because the montage is non-overlapping and warp-free, each tile's mask block crops straight...
0f74f88c4ac714c534ae68ac7ba4533c099ae3063a9e99eb622d5422cd56137f
Python
5,824
136
import argparse from splitters import random_split, species_split from loader import BioDataset from dataloader import DataLoaderFinetune # from torch_geometric.data import DataLoader import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from tqdm import tqdm import numpy as ...
8460a2fadf9ab097ae2377c8ecae65668484ca608380bc94b8dbd7e2c34987dc
Python
5,824
175
"""Prepration for runners.""" from __future__ import annotations import logging import os from pathlib import Path from shutil import move, rmtree from typing import TYPE_CHECKING from monty.shutil import gzip_dir from quacc import get_settings from quacc.utils.files import copy_decompress_files, make_unique_dir i...
d201ad6f449bf4a42d3884f7ebfe55d478bb8f0e079b36e489a6ba172d860f3b
Python
5,824
149
import numpy as np import torch class Normalizer(object): def __init__(self,params=[],method = '-11',dim=None): self.params = params self.method = method self.dim = dim def fit_normalize(self,data): raise NotImplementedError def normalize(self, new_data): rais...
c3980d7a9041720634da8035fa0c12dc010299ffc6a238ef3e0c7e4098618fcd
Python
5,825
153
# 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...
fb6237c3abf14bba6ddb9bd3fdc34ec07ff89c3cb3e0ed9efd3d34b4180e91a4
Python
5,825
198
# 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...
168838cac479da228fcfcc6fafa827eff1b085925632fe3f07d1e766850f611c
Python
5,827
141
import pandas as pd import os def wrapper_table(f,pd, caption): f.write('\\begin{table}\n') f.write(pd.to_latex()) f.write('\\caption{'+caption+'}\n') f.write('\\end{table}\n\n') if not os.path.exists('stats'): print("Error: Please run firs the script 'combine_tables.py'") else: p...
21106392abce9062214c97257a128a9b5e6e169f9c8a1256eaa2c1a0a71e9115
Python
5,827
209
# LIBRARIES from argparse import ArgumentParser from pytorch_lightning.callbacks import ModelCheckpoint # Pytorch import pytorch_lightning as pl from pytorch_lightning.loggers import TensorBoardLogger from datamodules import ImagePairsDataModule import torchvision.transforms as T # Extras from pl_bolts.models.self_su...
511188f140eabee25c52f88d96d270d95f63691f737f28f582a19f7d1b71c537
Python
5,828
178
# implementation independent network parameters from model.network_params import ComputationBackendType, NetworkParams # warn about usage of some method from model.dev_utils import internal class LagrangeNetwork: """ Wrapper over all implementations to make it easier to switch between them. """ de...
744a16145f04e714094c817a41503905b17f32b42fe73a0f07a0bd104b77ba94
Python
5,828
131
import matplotlib.pyplot as plt import networkx as nx from eworm.network import * from eworm.utils import * import _pickle as pkl import os import os.path as path import sys import matplotlib.patches as ptc import numpy as np import numpy.random as nr import scipy def spectral_layout(A): c = (A + n...
b45e4e89ff6590e99dfd8c120b915ccf3d29b1904661e54735d583021c67f93a
Python
5,829
161
"""Unit tests for UndoHistory. These are pure-Python - NO QApplication, no Qt - which is the whole point of extracting the class out of the viewer: the stack invariants can be verified at unit-test speed (~0.01s per test) regardless of GUI state. """ import pytest @pytest.fixture def history(): fro...
2b54aa488d3990354f0702c071201c41236a66ff88e74ce1a88e7149c658403d
Python
5,830
171
import bct import numpy as np from tqdm import tqdm from sklearn.utils import check_random_state from utils import cpl_func def strength_preserving_rand_sa_trajectory(A, rewiring_iter = 10, nstage = 100, niter = 10000, temp = 1000, f...
57544b5a85569f40425cdeb6f3440012468c5dabe60ac9029fecc9928df84694
Python
5,830
122
# -*- coding: utf-8 -*- """ Created on Thu Oct 21 15:16:19 2021 @author: CY """ from typing import Callable import time from tqdm import tqdm import copy import torch from nnunet.training.ssl.base import Model from nnunet.training.data_augmentation.data_augmentation_batch import get_batch_augmentation d...
0741642c1b18c071204674a1f366c5a88b4d6f353570fdb2df6a7f1e7743664c
Python
5,831
218
import numpy as np from moabb.datasets import ( Zhou2016, BNCI2014004, BNCI2014001, MunichMI, Weibo2014, Cho2017, ) from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA from mne.decoding import CSP from pyriemann.classification import MDM from pyriemann.tangentspace impo...
8cc8025eed396302871fb9d51964fd4fae537741d1f0874c0c85d1c5cd988116
Python
5,831
132
"""The batch masking pipeline's reference-free quality check. Every mask failure measured in this project moves when the working resolution moves, so re-segmenting at half scale and comparing detects a bad mask without ground truth. That is the only kind of check available on real sections, and a batch run is exac...
25bda7c668505d58c4cd6c412996cf843a7cdda78d6ab1cdaa62ce057b83dc76
Python
5,832
192
"""Utility functions for dealing with defects.""" from __future__ import annotations from importlib.util import find_spec from typing import TYPE_CHECKING from monty.dev import requires from pymatgen.core.periodic_table import DummySpecies from pymatgen.entries.computed_entries import ComputedStructureEntry from pym...
562b5ca6c7f39958c6c283c10aeb24c98132711df2f5174d36d1993546f36cdc
Python
5,833
135
import math import numpy as np import torch import torch.nn as nn import torch.optim as optim from typing import Any, Dict, Optional from models.model import Model from models.kan_layers import KAN, FastKANConv2DLayer class M2DCNN_Net(nn.Module): @staticmethod def weight_init(m): # [All the trainabl...
0a2dfff5203881ccbce56391a565eea945d537f699ca5a46d7243426aed6dce7
Python
5,834
148
import math from abc import abstractmethod from collections import defaultdict from typing import Protocol from elasticai.creator.arithmetic import FxpConverter, FxpParams from elasticai.creator.file_generation.savable import Path from elasticai.creator.file_generation.template import ( InProjectTemplate, modu...
3e5c1da734b6a298c69db893cd2644d7e5c1604bf80c291ad90f2082706253d3
Python
5,834
188
import argparse import datetime import os import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from config import Raviv1 from learning_experiment import LearningExp from modeling import MLP, RelaxedLinear, TiedRnnGS from training import Trainer try: import wandb except ImportErro...
a1996f770df139b6d1c61bb0709fb89d46fe790083f169f584c10210ef778f61
Python
5,836
151
##### MODEL AND DATA LOADING import time start = time.time() import torch # torch.cuda.empty_cache() import torch.utils.data import torchvision.transforms as transforms from torch.autograd import Variable import numpy as np from PIL import Image import re import os from helpers import makedir import train_and_test a...
e2ab9a38a2a4c4d1d61f2988c965bae481ff92156a44b07001b10f7f674e970e
Python
5,836
119
from typing import Tuple import torch import torch.nn as nn class MTCNN(nn.Module): r''' Multi-Task Convolutional Neural Network (MT-CNN). For more details, please refer to the following information. - Paper: Rudakov E, Laurent L, Cousin V, et al. Multi-Task CNN model for emotion recognition from EEG Br...
f31c789d299b4486e9ab414774265dbb95ef99085dc56f304c46f1de60f12eab
Python
5,837
139
import os.path import gzip from collections import defaultdict from ckg.graphdb_builder import mapping as mp, builder_utils def parser(databases_directory): directory = os.path.join(databases_directory, "PhosphoSitePlus") builder_utils.checkDirectory(directory) config = builder_utils.get_config(config_nam...
9ee3d948514644f9f94f3638feea1534a253e6b8fe65b0fc961aa21e88b3d1b3
Python
5,839
140
import os import pandas as pd from scipy.io import loadmat from sklearn.model_selection import train_test_split from datasets.SequenceDatasets import dataset from datasets.sequence_aug import * from tqdm import tqdm signal_size = 1024 #1 Undamaged (healthy) bearings(6X) HBdata = ['K001',"K002",'K003','K0...
a8769ce22d674ec8d188023f5952b35712e220f41fbfc5c3621ed44d1cec3f72
Python
5,839
144
# 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...
b5e4d9006368dc6c57602754755870200cf4f76617d6c81de6a5cd6097bbfe66
Python
5,841
184
#!/usr/bin/env python #================================================================ # Copyright (C) 2023 Yufeng Liu (Braintell, Southeast University). All rights reserved. # # Filename : bouton_analyzer.py # Author : Yufeng Liu # Date : 2023-01-03 # Description : # #===============...
0b81b76fdfe0b62aba94d5c81c483f737a83b76603ef11463783e04c46541140
Python
5,842
169
#!/usr/bin/env python # encoding: utf-8 """ tl train ======== (Alpha release - usage might change later) The tensorlayer.cli.train module provides the ``tl train`` subcommand. It helps the user bootstrap a TensorFlow/TensorLayer program for distributed training using multiple GPU cards or CPUs on a computer. You nee...
4a16c59e09dd8ff7b415acd869adb2da3d5605c9ce12ffafba93c0efb83472db
Python
5,842
125
"""Shared two-stage ANTs helper: explicit affine pass -> nonlinear-only pass, composed into a single [warp, affine] transform list. Extracted from mind_driver (the descriptor path proves this pattern); the intensity path seeds the nonlinear stage via initial_transform (no moving pre-resample). """ import glob ...