sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
a2adab5a20d528fd7c420a7da70c171133e2ee81cd09aab1e3fd259e7a009c75
Python
8,789
251
# -*- coding: utf-8 -* import os import re from argparse import ArgumentParser import sys import gc from torch.utils.data import DataLoader from prefetch_generator import BackgroundGenerator import numpy as np import torch import torch.nn.functional as F from matplotlib import pyplot as plt from tumor_detector.Dataload...
da72f698a0d57298404c3c5dce3ea949166a69c0bc1c90d8966988d383d1e497
Python
8,790
237
"""Defaults and UI constants for Quadrant Folding background subtraction.""" from __future__ import annotations from typing import List, Dict, Any # Spinbox Ranges RMIN_RMAX_RANGE = (-1, 5000) EQUATOR_HEIGHT_RANGE = (1, 1000) EQUATOR_CENTER_RANGE = (1, 1000) LAYER_LINE_RANGE = (1, 1000) N_PEAKS_RANGE = (0, 20) PEAK_...
64669fb25d15f34880226d3f471b3961478250ab75ccf5aa16153bf2fe161951
Python
8,791
340
from typing import Dict import pytest import yaml from deepreg.config.v011 import ( parse_data, parse_image_loss, parse_label_loss, parse_loss, parse_model, parse_optimizer, parse_reg_loss, parse_v011, ) @pytest.mark.parametrize( ("old_config_path", "latest_config_path"), [ ...
f625dd518d0a94f30c75e8bac6a8e90d9493905bfdbced22a22b8d04e6e065f3
Python
8,792
206
import subprocess, glob, os from loguru import logger import re from typing import Tuple, Union, Type from rdkit import Chem from rdkit.Chem.rdchem import Mol from rdkit.Chem import AllChem, rdDistGeom logger.add("../logs/optimization.log", format="{time} {level} {message}", filter="my_module", level="INFO"...
c7655a8105deb2501c73e2044e3575a1bec65dc709e651f96070fd4ec6ffcf3f
Python
8,793
209
"""Test per-pipeline version numbers: where they come from, and where they go. Run from the repo root:: uv run python python/test_versions.py Three pipelines ship from this repository and move at different speeds, so a single number cannot describe them — and a result is only reproducible if it records the versi...
1cfe4a91725bfe19ed99256c677f2eb54b33ec2c7e927dfdfe19e700ea444dc9
Python
8,796
251
# -*- coding: utf-8 -*- """ Created on Sat Apr 6 02:59:52 2024 @author: aka2333 """ # In[] import numpy as np from scipy import stats import pandas as pd # In[] def scale(x, upper=1, lower=0, method = '01'): if method == 'std': x = (x - x.mean()) / x.std() if x.std()>0 else (x - x.mean()) /...
674a0b1f750994f66f1db16afc1f388133a3ad800eb41206419d000d409b5aa8
Python
8,796
224
import numpy as np from scipy.sparse import coo_matrix import skimage as ski import scipy.ndimage as ndi import warnings from . import util def compute_voxel_offseted_linear_indices(pos_ind, mask_size, offset=1): pos_ind = np.array(pos_ind) if isinstance(pos_ind, (list, tuple)) else pos_ind mask_size = np.ar...
bc7848b4d032e04f1139cba83ef265f9dd01731eb84bcb13736e2e48518258e0
Python
8,798
208
"""Test the functions in the yasa/spectral.py file.""" import unittest from itertools import product import matplotlib.pyplot as plt import mne import numpy as np import pytest from scipy.signal import welch from yasa.fetchers import fetch_sample from yasa.hypno import Hypnogram from yasa.plotting import plot_spectr...
17847fcf3decc5b48f600d822723ae63ad349ba52d9c6efc83a103fadcc9be37
Python
8,801
250
# Copyright (c) DP Technology. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from unicore.data import BaseWrapperDataset from . import data_utils from numba import njit from functools import lru_cache from sci...
7789e23704e2ee87a542ad43e460d963705a534e00a144ba5fa1e2502cd0772d
Python
8,803
232
# functions_MoCo2DProject.py # Functions file used in conjuction with dense_process_MoCo2DProject.py for the post-processing of the DENSE single-slice motion study data # Not all the functions in this file are used in the dense_process code, some are just superfluous. import numpy as np import random import math impor...
5ccdda0b78a973c8005cb8cc52dcfc5ce0296be288da0418cfa94bf519f96b55
Python
8,806
210
"""Reusable Deep Agent workflow for workspace and coding tasks.""" from __future__ import annotations from collections.abc import Sequence from copy import deepcopy from typing import Any from deepagents import create_deep_agent from deepagents.backends import CompositeBackend, LocalShellBackend, StateBackend from d...
edc42179d6695ebc24e8c319828a505cda0af2383e9a7cd898c8f9743c3a3ff0
Python
8,807
193
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script to resample a tractogram to a set number of streamlines. Default behavior: - If the number of requested streamlines is lower than the streamline count: DOWNSAMPLE - If the number of requested streamlines is higher than the streamline count: UPSAMPLE (to preven...
13e4dbf4b72b0a29addcbde139ac472e0dc83eef6ff76a17fd0d433ac5245e0a
Python
8,808
270
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import csv import json import os import random import sys from itertools import product NAME = "comments" def read_rules(name): rules = [] with open(os.path.join(sys.argv[1], f"{name}.csv")) as f: reader = csv.DictReader(f) ...
1787918ab06b7a9154c2e2c097367af2168d8a2b0b6b9b3241e78159f9f81017
Python
8,808
243
""" Calculate model trainable parameters and memory usage """ import torch import torch.nn as nn import torch.optim as optim from models.resnet3d import ResNet3D18 from models.efficientnet3d import EfficientNet3DB0 from models.eTSCnet_dual import sTSCnetDual from models.resnet3d_dual import DualResNet3D def count_par...
36ea5671c6a788b74e94cee0658a2c6ec62f18e68d1d1200376d5c4c348d9a89
Python
8,810
258
from typing import Literal import numpy as np from PIL import Image from matplotlib import pyplot as plt, animation from matplotlib.patches import Ellipse from tqdm import tqdm from neuralib.typing import PathLike from neuralib.util.verbose import fprint from stimpyp import AbstractStimlog __all__ = [ 'compute_w...
9ca545d3939e307686b772051f7c7171f6d349d970218da9528087528a0c3e14
Python
8,810
211
import json import os import os.path as osp from collections import defaultdict from typing import Callable, Dict, List, Optional import torch from torch_geometric.data import ( HeteroData, InMemoryDataset, download_google_url, extract_zip, ) class HGBDataset(InMemoryDataset): r"""A variety of h...
fee79e97ffbfd3795f3733da57e75293d3dd3b4c0ea5aa0bba75355603ed8b1b
Python
8,810
218
#!/usr/bin/env python from __future__ import print_function from logging import info import random import numpy as np import datetime from ltlib.evaluation import conll_summary, per_type_summary, is_iob_tagging from keras.models import Model from keras.layers import Input, Embedding, merge, Flatten, Dense from kera...
615a96f94d7b17130cd2472ffe1d02eeb2b03051a4b2b9db9cf05d4c5eb6b4e3
Python
8,811
223
from subprocess import run from tempfile import gettempdir, mkdtemp from uuid import uuid4 import nibabel as nib import numpy as np from harmonization.model_architectures import Generator from tensorflow import convert_to_tensor from tensorflow.config import list_physical_devices from HD_BET.run import run_hd_bet from ...
b74925ebc3ee420737f88fff0fdd0c960d1d01e4fb5783dcb807b70dd03d50ca
Python
8,813
158
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'lockdisplay.ui' # # Created by: PyQt5 UI code generator 5.7 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_GroupBox(object): def setupUi(self, GroupBox): GroupBox.se...
03294433599b6e3ca489970200f5b3dbb86d2f8f22c4f66f78b61ab831c7e7d5
Python
8,815
273
import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import Normalize import matplotlib.cm as cm import json with open('results/tables/mechanistic_benchmark.json', 'r') as f: mech_results = json.load(f) R = 8.314 F = 96485 T = 25 + 273.15 i_target = 150e-3 electrode_thicknesses = ...
f8adfe897d64f4b7f9a37c572dd46e09287d755399582abeea1c36a7bd560376
Python
8,819
259
"""Execution backend configuration and factory. Reads the ``[execution]`` section from ``config.toml`` (or env-var overrides) and returns an initialised :class:`ExecutionBackend` instance. Environment variables --------------------- ``CHEMGRAPH_EXECUTION_BACKEND`` Override the backend name (``"parsl"``, ``"ensemb...
7156e495feaa7ec87eeef43414d71ce600a30fd3317014dc7603f2209f6ff88c
Python
8,822
196
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['others.zip']) tmp_dir = tempfile.Tempo...
e594baff327a5122f93682c504f84d9792a1a0f68aa17a52c9e16fecc7d0e0a3
Python
8,822
240
#!/bin/env python import os, sys import numpy as np import cPickle as cp import matplotlib matplotlib.use('AGG') import matplotlib.pyplot as plt import matplotlib.font_manager as ftman import matplotlib.colors as colors import matplotlib.cm as cmx import matplotlib.colorbar as cb INP = sys.argv[1] OUT=sys.argv[2] X =...
8cb27b2aa8fa02428377d6d83342575a70d24a6ec761f9a831b890d03f207a88
Python
8,824
243
# -*- coding: utf-8 -*- """ DWI_functions.py ==================================== This module can be used to calculate ADC/IVIM maps. IVIM fitting is done in a segmented fashion: https://doi.org/10.3389/fonc.2021.705964 @authors: s.zijlema, p.vhoudt, k.baas, e.kooreman Group: Uulke van der Heide - NKI """ import nump...
3c8bba5162c3dddb487fea1c776a75ff71937f33b37adfa572661aebdc83f3e6
Python
8,825
249
import json import argparse from chemgraph.tools.ase_tools import run_ase from chemgraph.tools.cheminformatics_tools import molecule_name_to_smiles, smiles_to_atomsdata from chemgraph.models.ase_input import ASEInputSchema import datetime import subprocess def get_smiles_from_molecule_name(name: str) -> dict: """...
519793fbd8dceee905abfc606e85ffedcc68ec90a0fe0a4ca6b33136fc21defe
Python
8,825
270
#!/usr/bin/env python3 # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import argparse import os import os.path as osp import re import shutil import sys import textwrap from collections.abc import Callable from glob import iglob from inflection import underscore class Processor: _referenc...
a3e7ff2f3dd3f30c754a57ffe53fef8811aced46c5920043aba3f966ead11afc
Python
8,828
202
import pathlib import time import numpy as np import h5py from postprocessing_modules.axonal_delay_kernel import get_axonal_delay_kernel from neuron_interface.neurosim.simulation.dendritic_delay_simulation import DendriticDelaySimulation from helper_functions import __file__ from helper_functions.cell_type_lib import...
831769d0fb7981f5922fe3d31c3c91110d392cbde81bb84194cbe62b53e4488d
Python
8,829
235
import logging import dipy.tracking.streamline as dts import dipy.tracking.utils as dtu import nibabel as nib import numpy as np from scipy.spatial.distance import cdist import AFQ.recognition.utils as abu logger = logging.getLogger("AFQ") def clean_by_overlap( this_bundle_sls, other_bundle_sls, overla...
ca5aa97c29b4d12baf0f57533b1afd65315301b107a3deb13af122d2a4ef4cf7
Python
8,831
253
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved """ Text Tokenizer. Copied and lightly adapted from VE repo, which in turn copied from open_clip and openAI CLIP. """ import gzip import html import io import os import string from functools import lru_cache from typing import List, Optional, U...
b56355ff22f5ee353b11499731239fc55f5f066c6611cb1c0cba52fe9f989cc2
Python
8,833
229
# -*- coding: utf-8 -*- """ ClearMap default parameter module. This module defines default parameter used by various sub-packages. See Also: :mod:`~ClearMap.Settings` """ #:copyright: Copyright 2015 by Christoph Kirst, The Rockefeller University, New York City #:license: GNU, see LICENSE.txt for details. import ...
4b11f1dc67584897963d47abefb5501ba20a98d9390b5b9e6a4ee9b87e3caaf4
Python
8,834
164
from pathlib import Path import numpy as np import pandas as pd from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly from brainscore_core.supported_data_standards.brainio.packaging import package_data_assembly ''' Experiment Information: - 25 or 50 subjects depending on condi...
8db68a75bafa3e2f87b2317b222b82bd9e32da6f6702395939878fe215bf309f
Python
8,834
212
"""The machine report: what it says about this computer, and what it warns about. The page exists for two questions — *which of our computers should run the batch* and *why is MEA-NAP slow on mine* — and both are answered by numbers that must be the ones the pipeline will really use. So the checks here are mostly abou...
98bdd8f9bc275aed74d99a1cc37acc7e6d04af556b48e29dc19a3d2ab4598c16
Python
8,834
193
############################################################################################## ### Script to average data from the same columns in data files stored in different folders ### ############################################################################################## ### Copyright 2017-2022 Jannik Lub...
b1f67ef93e642d0c652c73e6cb664381cfd400199aaab7e811d92ad389ee91ef
Python
8,840
178
## ------------------------------------------------------------ ## IMPORTS ## ------------------------------------------------------------ import torch import torch.nn as nn ## ------------------------------------------------------------ ## Explain the block ## --------------------------------------------------------...
b9ed7acb54ac012d2b9226e982d74dd2011f8822468f904a735993995701645e
Python
8,841
249
# 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 math import numpy as np import torch import torch.nn as nn class RowSelfAttention(nn.Module): """Compute self-attention over rows...
298a7f4ed6d1894c69052f6743e737a0c3cbce93587bae6ef93fd363616a74c5
Python
8,842
231
""" Tests for `bx.phylo.newick`. """ import pytest from bx.phylo.newick import ( Edge, newick_parser, Tree, ) trees = [ r"(B:6.0,(A:5.0,C:3.0,'Foo ''bar':4.0)Q_X:5.0,D:11.0)label;", "((raccoon:19.19959,bear:6.80041):0.84600,((sea_lion:11.99700, seal:12.00300):7.52973,(( monkey:100.85930,cat:47.14...
f50caeeb44ae262d7f6dfa7ed38cfd0ddda50e6abf6fbefd1196f07be2c1ea68
Python
8,845
294
# myelinfccoupling/model.py from typing import Dict, Optional import numpy as np import pandas as pd import statsmodels.formula.api as smf from .config import Config def _ols_r2(X: np.ndarray, y: np.ndarray) -> float: """ Compute R^2 for OLS y ~ X (with intercept) using linear algebra. Assumes X, y ar...
07040d6a401b511f64ffab5f281ea60abcbe972d35f99d82cef9f01697884185
Python
8,846
198
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from copy import copy from typing import Any import torch from ultralytics.data import ClassificationDataset, build_dataloader from ultralytics.engine.trainer import BaseTrainer from ultralytics.models import yolo...
a1542c56c467522cd3bcdd82500f28e4f6576db2d59f9796a3e992a7bfc0fbdd
Python
8,846
211
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: Agatha Schmidt, Henrik Zunker, Khoa Nguyen # # Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file excep...
60838f1086f6caf2f93acde7394ecbacc12af666e93fa9aa83d5a5fa9b7eb35c
Python
8,849
206
import os.path import unittest import tests.bam import tests.base_test import tests.gtf import tests.output_parser as output_parser import tests.test_config import tests.util class Test(tests.base_test.BaseTest): def setUp(self): super().setUp() self._test_base_dir = tests.test_config.TEST_BASE_...
19a45bde3115896a787ec77d6dcac7983018c17bb394761b7fec1f4361814e3f
Python
8,850
203
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved import torch from sam3.model.model_misc import SAM3Output from sam3.train.utils.distributed import get_world_size from .loss_fns import CORE_LOSS_KEY, Det2TrkAssoc, Masks class DummyLoss(torch.nn.Module): """A dummy loss that always retu...
bcb0c2560adef5c7cf5f4712272815e761c886499586f9e400aefe03c879af5e
Python
8,853
216
""" This class overrides the behavior of the parent ViewBox to handle operations for for scaling and translating of one or more linked axes """ import pyqtgraph as pg from PyQt5.QtWidgets import * import numpy as np import pyqtgraph.functions as fn from PyQt5 import QtCore, QtWidgets import platform class lasagna_...
28e984fe233f9d9b7aed0ef1e4f7dbb2386542d042df58eb511bdc526820a4e3
Python
8,854
253
from __future__ import annotations import re import urllib.parse from types import NoneType from typing import Any, ClassVar, Protocol from uuid import UUID import attrs from django.utils.html import escape from rq.job import Job as RQJob from cvat.apps.redis_handler.apps import ( QUEUE_TO_PARSED_JOB_ID_CLS, ...
009f7b9a8ee5cc45b4127e1f602a5b7d22fb6717e9b18de87f035b25f27e87e9
Python
8,855
241
import torch import torch.utils.data as Data from model.network_947331 import Network from torch import nn import time import random import numpy as np from torch.optim.lr_scheduler import ReduceLROnPlateau from torch.utils.data import Dataset import pandas as pd import os # Configuration parameters CONFIG = { "cu...
8cc3342c601c6e41d969bc956d3bdea652ac18d21cb31973c2bbca1ce9a724da
Python
8,857
247
''' Quick script to traverse all participant data in the experiment folder and estimate the free energy model at any point in time for each participant. Note that this script handles _all_ spaces, but not necessarily at once. E.g., a 'normal' run of this will run spaces for speaker-specific and -invariant priors with...
84f96e741a8242a5c9bf767591ebf201c9a6d1b68b18d30679fb81cb34df67e7
Python
8,860
164
from __future__ import division import nipype.pipeline.engine as pe from nipype import SelectFiles import nipype.interfaces.utility as util from nipype import IdentityInterface, DataSink #from .utils import * from utils import * import os def create_bullseye_pipeline(scans_dir, work_dir, outputdir, subject_ids, na...
37d627dfee69f676d3fca78f352ec28f09c00baf3cb77fd470f6abdfd4887681
Python
8,862
293
############################################################################### #################### Boilerplate ######################## ############################################################################### import pandas as pd import matplotlib.pyplot as plt import os import matplotl...
95bd752547200641109b128db53f43a1eaf8d3280bf89e71866b3113b353404f
Python
8,863
275
#!/usr/bin/env python3 import os import argparse from typing import Tuple, List, Optional import numpy as np import nibabel as nib from PIL import Image from fury import window, actor def robust_norm_nonzero(vol: np.ndarray, p_low: float, p_high: float, eps: float = 1e-6) -> Tuple[float, float]: v = vol[np.isfi...
f555508fd1eebd3c6582d4cea1a5d27168b8988059392c833bba677e8699b6a6
Python
8,863
242
from subprocess import PIPE import unittest import numpy as np class TestFileIO(unittest.TestCase): def test_feed_pipe(self): from python.segmentation.FileIO import feedPipe from unittest.mock import Mock mockPipe = Mock() mockPipe.communicate.return_value = ("result", "") ...
faf5450e90e356fceaa760a1e761943d382d9c48370c3af00ee0f32ad25af12b
Python
8,863
202
#!/usr/bin/env python """ HAL module for controlling a Pi controller. Adapted from Hal module for a tiger controller by Hazen 05/18. This module connects to a PI controller (model E873) which controls 3 translation stages (model Q545.140) that are assembled in a 3D stage configuration Alistair 10/19 """ imp...
3d454b2e5a46c4591f5ee781ea021f7de2443c57660d75b489ac2dc2c9573e75
Python
8,866
313
# user feature generation: Alhosseini import re import json import datetime from operator import itemgetter from math import log import pandas as pd import numpy as np import csv import collections def read_json_1dict(path): """ 读取json,用于一个dict :param path: 路径 :return: 一个dict """ with open(path...
37f81fcabd252938bfbc2cae49ea818a923af023bebdb96d2f541214fb9392ef
Python
8,868
225
from collections import OrderedDict import logging import os import numpy as np from PIL import Image from brainscore_vision.model_helpers.activations.core import ActivationsExtractorHelper from brainscore_vision.model_helpers.utils import fullname SUBMODULE_SEPARATOR = '.' class PytorchWrapper: def __init__(s...
db5c5f06387df0762888bdbaeb13c2a227e79967c75e27a5bf3c370c2d1112d6
Python
8,868
300
"""dataclasses.py.""" import logging from dataclasses import dataclass from typing import Any import jax.numpy as jnp import numpy as np import numpy.typing as npt import pandas as pd from jax import Array from jax.tree_util import tree_map logger = logging.getLogger(__name__) NUM_DIMENSIONS = 2 @dataclass class ...
e915684a024e987924890f8c0e654806d4636bcd2d0be3d9d299d0e10c8e4c69
Python
8,868
178
""" Generate validation set comparison report """ import pandas as pd import numpy as np import os def generate_comparison_report(): """Generate complete comparison report""" val_flair_csv = './results/val_predictions/val_predictions_flair.csv' val_t2_csv = './results/val_predictions/val_predictions_t...
857ecdbbe5e367e999b2c1cec9ed48540d3dd53ad5292f58665791fb0a4346d7
Python
8,870
276
# -*- coding: utf-8 -*- """TODO""" import os import time import numpy as np from mpi4py import MPI from core.logger import LogMessageType from core.core_definitions import (simulation_mindelay, simulation_timestep) from core.sync_buffer import SyncBuffer def _progress_bar(fraction): """TODO""" bar = "" ...
0a1b2d547cdcb8babaa6f3bb8dd733be4fde85ee01bd6530fd4126f038b661a8
Python
8,873
314
#!/usr/bin/env python3 # coding: utf-8 import sys import os import re import numpy as np from neuron import h # This is super annoying: without neuron.gui, need # to explicit load 'standard' hoc routines like 'run', # but this is chatty on stdout, which means we get # junk in our data if capturing output. def hoc_e...
65e8a548db3442bcd998e20718ebe514d8543a67b756a77f55fb1167697f16ab
Python
8,878
288
#Pure training, the analysis of the network can be done with the app #The images and their names are in the images_compressed.npz and names.py import numpy as np import os, torch, h5py, time, sys import torch.nn as nn from torch.utils.data import DataLoader, Dataset from torch import optim import torch.nn.functional a...
eec9fa0965c8c57ae5c76df36b9d46afbaec1df280c29360799934f698a5d6f1
Python
8,878
248
import os import random import shutil import zipfile import nibabel as nib import numpy as np from tensorflow.keras.utils import get_file from tqdm import tqdm # if wget is installed remove the following line from comment # import wget # if already in the abc/DeepReg directory then do nothing, otherwise # use os.chd...
f650225f6212ed4747be0e9f944f2b7b24281df9821c0c5d43a4b2e686a675eb
Python
8,881
240
# Copyright (c) 2020, Soohwan Kim. All rights reserved. # # 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 la...
f04597240fe6459722dd9ae6bb46fc62dfeffe15fe6f3982a378de3e4795e5a7
Python
8,885
251
import json import argparse from chemgraph.tools.ase_tools import run_ase from chemgraph.tools.cheminformatics_tools import molecule_name_to_smiles, smiles_to_atomsdata from chemgraph.models.ase_input import ASEInputSchema import datetime import subprocess def get_smiles_from_molecule_name(name: str) -> dict: """...
6bf649c3bf2031260988bbf83a4296d928a256de7a36fa00090724adbff61b97
Python
8,887
237
# -*- coding: utf-8 -*- # @Author : LG from PyQt5 import QtCore, QtGui, QtWidgets from ISAT.ui.category_edit import Ui_Dialog from ISAT.widgets.undo_commands import ( ShapeStateCommand, _snapshots_match, snapshot_shape, ) class CategoryEditDialog(QtWidgets.QDialog, Ui_Dialog): def __init__(self, pa...
73ec4f331716e3d7b56f8ac188546d4c4995e1ba4016354ac95d29bae45065e9
Python
8,887
211
import torch import torch.nn as nn import torch.nn.functional as F import math class BasicBlock(nn.Module): def __init__(self, in_channels, out_channels, stride=[1, 1], padding=1) -> None: super(BasicBlock, self).__init__() # 残差部分 self.layer = nn.Sequential( nn.Conv2d(in_channe...
9e6b2c87bfef3065e698c9ca39a6f1de6deff3042f129d166fdb04482dd46bdb
Python
8,888
302
# Copyright 2025 BDP Ecosystem Limited. All Rights Reserved. # # 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...
45a293bdcb4914b6044dc1b335b44409fa3d1f95a268f8bd54c0203ecea096fb
Python
8,890
276
import os from langgraph.graph import StateGraph, START, END from langchain_openai import ChatOpenAI from langgraph.checkpoint.memory import MemorySaver from langgraph.prebuilt import ToolNode from chemgraph.tools.cheminformatics_tools import ( molecule_name_to_smiles, smiles_to_coordinate_file, ) from chemgra...
b001e2a2d403ab19962a73551d499a37f64a35cf51f34a1ef9c798eb9ce01cd8
Python
8,891
281
#!/usr/bin/env python3 """ ============================================================================= Austin Dibble University of Glasgow 2026 scripts/run_inference.py Command-line interface for NeuroFM inference. Accepts a single NIfTI file, a directory, or a CSV with an 'input' column. Examples -------- Single ...
27f4c4833d5672e2c3edb174278b1dbd8e8e941ce9337844b6e98c9928c70ece
Python
8,892
182
# BIDS discovery of diffusion weighted images for batch processing # # Finds sub-<label>/[ses-<label>/]dwi/*_dwi.nii[.gz] with their .bval/.bvec (and .json sidecar), parses the BIDS # entities, and groups the runs into datasets: every run on its own, or pairs of runs with opposite phase encoding # (e.g. dir-AP ...
71c17c343a96aee5b0c8cf248599608de735c33d53d0cc426c6e85d4ed27d44b
Python
8,894
282
import pytest from langchain_core.messages import AIMessage from langgraph.checkpoint.memory import MemorySaver from chemgraph.cli.commands import ALL_WORKFLOW_TYPES from chemgraph.registry import ( AgentRegistry, AgentSpec, DuplicateRegistryEntryError, RegistryUnavailableError, UnknownRegistryEntr...
79bfd3b807c2c03640064c446406243cc846bd7617b2252b7fa663926c5f7c94
Python
8,894
299
# -*- coding: utf-8 -*- """EPI <-> ANA registration The purpose of the following script is to compute the deformation field for the registration between antomy and EPI in native space. The mask should be in ana space. Optionally, a second mask can be applied which must be in orig space. The script consists of the foll...
b39677b1ee2b0030775b2f9c311f916b502826fa62f09be19c3eb4a517892984
Python
8,894
253
"""Downsample the image features with PCA. Parameters ---------- subject : int Number of the used NSD subject. data_ood_selection : str If 'fmri', the ID/OD splits are defined based on fMRI responses. If 'dnn', the ID/OD splits are defined based on DNN features. model : str Name of deep neural network model used t...
159491306ce205f803681b1f6a30c6ba4edd2a4cd6ecfff6ed5916a056b977d5
Python
8,898
221
#!/usr/bin/env python """ These wrap a CameraFrameDisplay and possibly a ParamsDisplay in a single object that Display interacts with. Hazen 4/17. """ from PyQt5 import QtCore, QtWidgets import storm_control.hal4000.display.cameraFrameViewer as cameraFrameViewer import storm_control.hal4000.display.paramsViewer as p...
1ed5ba25386362f54ed40f41fb373c6d4704423ab04e2b8f194282d544d2c7cc
Python
8,898
222
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved from typing import Dict, List import numpy as np import PIL import torch from . import box_ops from .data_misc import FindStage, interpolate from torchvision.transforms import v2 class Sam3Processor: """ """ def __init__(self, model,...
7115ce9d390facf20547544b658cb5fea47611e18698d9e47fb95f9665631bbc
Python
8,900
214
# -*- coding: utf-8 -*- """TODO""" import numpy as np from scipy.special import expit from scipy.stats import logistic import core.core_global as core from core.core_definitions import simulation_timestep from core.connection import Connection from core.euler_trace_2d import EulerTrace2D class RewiringConnection(Co...
a1521e168d825378764dc9c1deb154ccf1e80f31982b87c599bde6b0830191e0
Python
8,900
192
import src.data_generator as adg import src.utils import glob import cmat import pandas as pd import pickle import argparse import os import src.config def loso_cv(config, dataset_path=None): ##### Load config ##### # Load dataset path if dataset_path is None: dataset_path = config.TRAIN_DATA ...
041cc4dd84f2aba414abbfc0e1cc59db998b6199e02b9916886880257b4fc867
Python
8,901
253
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jul 13 21:23:50 2023 @author: jstout """ import pandas as pd import MEGnet from os import path as op import os import glob from scipy.io import loadmat import numpy as np import copy import pickle from MEGnet.megnet_utilities import fGetStartTimesOver...
6cbca8969bca249a6e41ebcbb6cf8b34a1e00368c57f03dda1c2b544c8e96967
Python
8,903
288
#!/usr/bin/env python """ Test autofocus lock. Hazen 09/19 """ import numpy import random import storm_analysis.simulator.draw_gaussians_c as dg import storm_control.sc_hardware.utility.af_lock_c as afLC # 2D Python version. def test_afLCPy(): afc = afLC.AFLockPy(offset = 0.0) cx = 16.0 cy = 32.0 ...
b4254c1514f516a96e924add70dfaa4b68d85af558a1ccb7fbf65e0a95b02049
Python
8,905
246
# Code adapted from the G-Retriever paper: https://arxiv.org/abs/2402.07630 from typing import Any, Dict, List, Tuple, no_type_check import numpy as np import torch from torch import Tensor from tqdm import tqdm from torch_geometric.data import Data, InMemoryDataset from torch_geometric.nn.nlp import SentenceTransfor...
c25304f145f4cde25f72e02d21a7bc6bed47360abf8508b43f5391d376185529
Python
8,905
216
import os import logging from collections import OrderedDict import numpy as np import torch from PIL import Image from brainscore_vision.model_helpers.activations.core import ActivationsExtractorHelper from brainscore_vision.model_helpers.utils import fullname SUBMODULE_SEPARATOR = '.' class PytorchWrapper: d...
b4a60542cb2beb2578af865652236a1b72d02237d5a15de3e83a6fa4b592f342
Python
8,907
260
import concurrent.futures import numpy as np import pandas as pd import heig.input.dataset as ds from heig.image import ImageManager from heig.utils import inv def projection_ldr(ldr, covar): """ Computing S'(I - M)S/n = S'S - S'X(X'X)^{-1}X'S/n, where I is the identity matrix, M = X(X'X)^{-1}X' is th...
db844144c89ee58fb7b69d096bc25ee9dd55d0c485c3aaee2a8100558a63977c
Python
8,907
213
# -*- coding: utf-8 -*- """TODO""" import numpy as np from scipy.special import expit from scipy.stats import logistic import core.core_global as core from core.core_definitions import simulation_timestep from core.connection import Connection from core.euler_trace_2d import EulerTrace2D class RewiringConnection(Co...
849f6771c898ea3063177b0e745ca6e1a158e6aebb61b73d092b26b723b7c50c
Python
8,909
268
import hashlib import random import torch import numpy as np from collections import OrderedDict, namedtuple import git import inspect import datajoint as dj import os import datetime import warnings def gitlog(cls): """ Decorator that equips a DataJoint class with an additional dj.Part table that stores the...
1cfe79140f61af429babacdeced74f714fb2bb9b12a135b575dbf363a388d131
Python
8,911
177
#!/bin/python3 # Plot functions for neuronal and synaptic variables as well as spike raster plots # Copyright 2021-2024 Jannik Luboeinski # License: Apache-2.0 (http://www.apache.org/licenses/LICENSE-2.0) # Contact: mail[at]jlubo.net import numpy as np import matplotlib.pyplot as plt import json import os from pathl...
f1a3a0a8c92900bdddb25d836999b6b51dd00424a81b9b440e44209961153ad3
Python
8,914
237
"""Window construction and forecast-target assignment. One sample = an observation window of `obs_min` minutes ending at time t, paired with the KSS self-report covering time t + `horizon_min`. Features are split into `step_s`-second sub-windows so recurrent/convolutional models see a sequence rather than a single poo...
bc2dcacdcf6c43f1c4a1fe3ea20c2e4e8726d65192bda1c7266f9fc896257e05
Python
8,917
217
from __future__ import annotations from collections.abc import Callable from typing import cast from PySide6 import QtCore from PySide6 import QtGui from PySide6 import QtWidgets from .. import _ai_models from .. import _automation from .._utils._qt import new_icon from ._info_button import InfoButton from ._integer...
013692871ada886a6ab8eec29f6ba08f034c6441de8a9fba4fac06e8b89f7ae7
Python
8,920
185
#! /usr/bin/env python3 # -*- coding: utf-8 -*- """ Detect when data strides are different from [1, 2, 3] and correct them. The script takes as input a nifti file and outputs a nifti file with the corrected strides if needed. Input file can be 3D or 4D. Only the first 3 dimensions are considered for the stride correct...
3958199064dd89aa46557b47a5d94802eb4baad0552454bca71b571530ad7880
Python
8,921
222
# -*- coding: utf-8 -*- import os from parser.utils import Embedding from parser.utils.alg import eisner from parser.utils.common import bos, pad, unk from parser.utils.corpus import CoNLL, Corpus from parser.utils.field import BertField, CharField, Field from parser.utils.fn import ispunct from parser.utils.metric im...
b5da596a225451a4d0ad37a53d4733bbe8d8de9332edef6281b1bb30b190d517
Python
8,923
230
import logging import unittest import numpy as np import pandas as pd import scipy.stats as stats from batchglm.api.models.numpy.glm_nb import Simulator import diffxpy.api as de class TestConstrained(unittest.TestCase): def test_forfatal_from_string(self): """ Test if _from_string interface is ...
39b34ceacc5a38f09bf461fd256270d534fa6f7329861946be2cff1e0d0b26e0
Python
8,924
225
import os from rdkit import Chem from rdkit.Chem import Draw, AllChem from rdkit.Geometry import Point3D from rdkit import RDLogger import imageio import networkx as nx import numpy as np import rdkit.Chem import wandb import matplotlib # matplotlib.use("macOSX") import matplotlib.pyplot as plt class MolecularVis...
91a4898f5d7af33bc756f94971dc259fbeba7f7c62125c944449156fc92941de
Python
8,925
162
import mlflow import os import math def get_mlflow_experiment(experiment_name): """ Check if experiment with name experiment_name exist. Otherwise, create an experiment with that name. Get ID. """ try: EXPERIMENT = mlflow.get_experiment_by_name(experiment_name) EXPERIMENT_ID = EXPERIMENT.experi...
79ff1190676dbd67c8f5c3b85b8887dae017b4b72b6da1b9c67be20ffa7b3fdb
Python
8,927
245
import numpy as np import pandas as pd import json import os import networkx as nx import pickle as pkl from sklearn.manifold import TSNE import matplotlib.pyplot as plt from sklearn.cluster import KMeans import matplotlib.colors as col from matplotlib import cm from sklearn import metrics from sklearn.preprocessing im...
f905ec655f59491397d1fabf98107fe2fb1412c8e20c4604c723aeef28e259c3
Python
8,934
245
# %% import argparse import gmsh from mpi4py import MPI from dolfinx.io import gmshio import numpy as np from dolfinx import fem, default_scalar_type import ufl from pathlib import Path from dolfinx.fem.petsc import assemble_vector, assemble_matrix, \ create_vector, apply_lifting, set_bc from petsc4py import PETSc...
97eb005626fc4c0e177fbf2846f24fe7da532f9c31f1fac521def4387d3c367c
Python
8,935
252
import os.path as op import numpy as np from dipy.io.stateful_tractogram import Origin, Space, StatefulTractogram from dipy.io.streamline import load_tractogram, save_tractogram from nibabel.affines import voxel_sizes from nibabel.orientations import aff2axcodes try: from trx.io import load as load_trx has_t...
9dce189fc20c7419711f0467a71678c815ec423c25e35b031f91e7af93688918
Python
8,935
254
from typing import Literal, Final import numpy as np import pingouin as pg import polars as pl import scipy import seaborn as sns from matplotlib import pyplot as plt from rich.pretty import pprint from argclz import as_argument from neuralib.plot import plot_figure from neuralib.util.verbose import fprint, publish_a...
a3516cb316bbb3fa97162eb634df7d0a7f162def3508d66b4c6698e0378e1853
Python
8,936
292
import os.path as op import dipy.data as dpd import dipy.data.fetcher as fetcher import nibabel as nib import numpy as np import numpy.testing as npt import pytest from dipy.io.stateful_tractogram import Space, StatefulTractogram from dipy.stats.analysis import afq_profile import AFQ.api.bundle_dict as abd import AFQ...
fc02245bae0451f123751733ab1b835f147af8cb1f3475c38ab59cf09c4ccd58
Python
8,937
191
import os from labdatatools.analysis import * import argparse def recursive_map(f, it): return (recursive_map(f, x) if isinstance(x, tuple) else f(x) for x in it) class AnalysisSpksibl(BaseAnalysisPlugin): def __init__(self,subject, session = None, datatypes = [''], ...
0489095ff2fad7e9395dbb3c79f511d1a199c8f88f76526543e86e6baec00fd2
Python
8,939
174
""" If you use this code, please cite the first SynthSeg paper: https://github.com/BBillot/lab2im/blob/master/bibtex.bib Copyright 2020 Benjamin Billot 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 ...
902d88ab1f1107ac54b4f02b3736754b0c77a49ef83985f195f22ed6b47b4977
Python
8,939
294
import base64 import json import os from collections.abc import Sequence from functools import partial from pathlib import Path from shutil import copytree import numpy as np from PIL import Image from torchvision import transforms from docs.doc_modules.experiments import AutoDocExperimentInfo, run_capture_and_save f...
e6a02ee27ed428009deb0931fcf9875a54c671c9d079749baf395a7a17739f06
Python
8,939
249
import json import argparse from chemgraph.tools.ase_tools import run_ase from chemgraph.tools.cheminformatics_tools import molecule_name_to_smiles, smiles_to_atomsdata from chemgraph.models.ase_input import ASEInputSchema import datetime import subprocess def get_smiles_from_molecule_name(name: str) -> dict: """...
72faf955b06dd20eec4cb6355188c44548d14b0aab9f9913cb56c032e1355a48
Python
8,941
253
""" (C) Copyright 2019 IBM Corp. 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 law or agreed to in writing, software ...
f467231c656c8d8ff955c7690aa1d90899e2b282ff1623be12bc6b4183609afa
Python
8,943
239
import os import shutil import zipfile import nibabel as nib import numpy as np from tensorflow.keras.utils import get_file from tqdm import tqdm DOWNLOAD_FULL_DATA = False DATA_PATH = "dataset" main_path = os.getcwd() project_dir = os.path.join(main_path, r"demos/paired_mrus_brain") os.chdir(project_dir) ######## ...
c90280a3a369f0cd9a5efef4d5afee859b4ef565a355607d0a4cc9ef139a1a9f
Python
8,945
231
import dtiplayground.dmri.preprocessing as prep import dtiplayground.dmri.common as common import yaml,os from pathlib import Path import dtiplayground.dmri.common.dwi as dwi import dtiplayground.dmri.common.tools as tools import sys ### Functions of Filter ### ### Function with two parameters : exclude gradients...