sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
88e8f2ec6b530893a684eb50c87fcd79fe2230f8ad734ccd6c191294b836b57a | Python | 3,934 | 96 | from pathlib import Path
from brainles_preprocessing.constants import Atlas
from brainles_preprocessing.modality import CenterModality, Modality
from brainles_preprocessing.normalization.percentile_normalizer import (
PercentileNormalizer,
)
from brainles_preprocessing.preprocessor import NativeSpacePreprocessor
f... |
e0a77d609046b0cfc6077b3e33716de7650b5d3ac0b9f114c84d24235d243ce8 | Python | 3,934 | 107 | import pathlib
import sys
import getopt
import nibabel as nib
import numpy as np
def print_help():
def print_option(opt, descr):
print(f" {opt:16s}{descr}")
print("merge_delineations - merges multiple binary delineations into one using a specified strategy")
print("Copyright (c) 2024-2025 Pave... |
c7b88a391dc60bb07d34ed0404bffd145caba0640445469433e1a1dba12dfc0f | Python | 3,935 | 142 |
"""
Epoch-Based EEG Feature Extraction
This script implements epoch-level time-domain and frequency-domain feature
extraction used in the study:
"Estimating Cognitive Workload in Robot-Assisted Surgery Using Time and Frequency
Features from EEG Epochs with Random Forest Regression".
Features extracted per 1-second ... |
061690f1f55e8cd32163890fc0cd451ba3e2d50b4fe546b4fbd25fe82adbfad9 | Python | 3,936 | 128 | #!/usr/bin/env python3
"""
Batch Alignment CLI Tool
Main entry point for the command-line batch alignment application.
"""
import argparse
import sys
import logging
from pathlib import Path
from config import load_config, validate_config
from utils import setup_logging, check_dependencies
from alignment import BatchA... |
a436d76b9315993620c30c2ed4008e47f809f04682d2e07b7e2f57c3882d1f60 | Python | 3,936 | 96 | import numpy as np
from typing import Dict, List, Tuple, Union
from brainglobe_atlasapi import BrainGlobeAtlas
from napari.utils.notifications import show_info
from napari_dmc_brainmap.utils.atlas_cache import load_annotation_bool
from napari_dmc_brainmap.utils.atlas_utils import coord_mm_transform
def calculateImage... |
5db510518ba27f613a0bac4ab40052e66c9d1f120d09c2bf5798ff1c5d236766 | Python | 3,937 | 36 | from testsetclass import TestsetClass
class BHPERI(TestsetClass):
def __init__(self):
self.weak = 1.0
self.molecules = ['13ts_6a', '06ts', 'TS3', '1,3-Cyclohexadiene', '09r', '01r', '05r', '13r_1', '13ts_5a', '13ts_2a', 'Cis-triscyclopropacyclohexane', '1,3-Pentadiene', '13r_7', '02ts', '09ts', '1... |
dad49d59c08eae76f08a7ba633006c32d537f49da6ffa99670e0aa3310996a77 | Python | 3,937 | 84 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from pathlib import Path
import numpy as np
import torch
from PIL import Image
from ultralytics.utils import LOGGER
from ultralytics.utils.checks import check_requirements
from .base import BaseBackend
class Co... |
e2fae0471e3e5146e937225052359d1f002a382fcb6428e0348a9f7cb3701b26 | Python | 3,937 | 128 | from tensorflow.examples.tutorials.mnist import input_data
from keras.layers import Input, Dense, Conv2D, MaxPooling2D, Deconv2D, UpSampling2D, Flatten, Reshape
from keras.models import Model
from keras.optimizers import Adam
from keras.regularizers import activity_l1
import numpy as np
import matplotlib.pyplot as plt... |
39f6ff63010c1b465301d989152594bfb1904ada71345233fa4d5e84409875da | Python | 3,938 | 86 | import numpy as np
from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly
from brainscore_core.supported_data_standards.brainio.packaging import package_data_assembly
import pandas as pd
'''
Experiment Information:
https://arxiv.org/pdf/1706.06969.pdf
- 4 subjects
- 1280 images... |
8f01df86145fd78552d5a4ca73131d08c538c81319b903cd18a1e4fe2abb7630 | Python | 3,939 | 148 | #Lucas Sancéré -
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import yaml
from attrdictionary import AttrDict as attributedict
from scipy.cluster.hierarchy import fcluster, linkage
from scipy.spatial.distance import squareform
# create the heatmap
#########... |
f078b6762a625eb8602bb100eea8f704942dd2aa063bdebe324838659e78cbe5 | Python | 3,940 | 137 | #!/usr/bin/python
# -*- coding: latin-1 -*-
# =============================================================================================
# Librairies importation
import numpy as np
import nrrd
import sys
import os
# =============================================================================================
... |
cb33ae455f7026f782671f126b54c911a025a52c65f686ea3eadcc124c194a45 | Python | 3,941 | 126 | import os
import struct
from typing import cast
import nibabel as nib
import numpy as np
import pytest
import tensorflow as tf
from nibabel.spatialimages import SpatialImage
from pyment.loaders.mgh import load_mgh
@tf.function
def _load_mgh_graph(path: tf.Tensor) -> tf.Tensor:
return load_mgh(path)
fixtures_p... |
da57f3694ade9204a402e8f3e920657ba20ed87334f566d9b7bd0b6c8fda08dd | Python | 3,941 | 101 | import numpy as np
import torch
from torch import nn
class CbrTiny(nn.Module):
"""
Network from here: https://arxiv.org/pdf/1902.07208.pdf
lr: 0.001
bs: 32
optimizer: Adam on Retina; SGD+Momentum with 0.9 on ChestXRay
Main difference to basic_cnn:
- only 1 dense layer (instead of 2)
- ... |
61608cdd9fa91641f40635a338f83cd54ab2658ce4ae9b317544f6738420b35b | Python | 3,942 | 114 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
import cv2
import numpy as np
import pycocotools.mask as mask_utils
from PIL import Image
from .helpers.visualizer import Visualizer
from .helpers.zoom_in import render_zoom_in
def visualize(
input_json: dict,
zoom_in_index: int | None... |
e5e08c040343891d1eae317db080c73d2759da3829c4f9c167f782666c6f8665 | Python | 3,943 | 93 | import pytest
from pytest import approx
from brainscore_vision import load_benchmark, load_model
# --- Registry tests: verify all 16 surface benchmark identifiers load correctly ---
@pytest.mark.private_access
class TestAllen2022fmriSurfaceBenchmarkRegistry:
@pytest.mark.parametrize("region", ["V1", "V2", "V4",... |
1307282839409aeba38387926c3f188f9d3f4b816c511963225e9c1fe5cdb775 | Python | 3,945 | 112 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import warnings
import torch.distributed as dist
from mmcv.runner import DistEvalHook as _DistEvalHook
from mmcv.runner import EvalHook as _EvalHook
from torch.nn.modules.batchnorm import _BatchNorm
class EvalHook(_EvalHook):
"""Single GPU Eva... |
79810069f0fbbf9d5ca4365f1bf86ade3f16595faadac9a5300ff9fba857955d | Python | 3,945 | 110 | import nilearn
from nilearn.glm.first_level import first_level_from_bids, make_first_level_design_matrix
from nilearn.image import get_data, high_variance_confounds, load_img
from nilearn.glm.regression import SimpleRegressionResults
nilearn.EXPAND_PATH_WILDCARDS = True
import os.path
import numpy as np
import pandas... |
3dddea3069b9a3ae1e308314aebd79d8377922e938c3f21f5d3e7241ddd5ca75 | Python | 3,946 | 105 | import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
from pathlib import Path
CM = 2.54
### Classes
class Plot(mpl.figure.Figure):
def __init__(self, *args, **kwargs) -> mpl.figure.Figure:
super().__init__(*args, **kwargs)
def set_style(self, offleft=5, offbottom=5, spinewi... |
6cddc2ac1f1ddc501eb101bbb67aa600444e54f20a77376f334a399606932641 | Python | 3,946 | 121 | import json
import pathlib
from typing import Dict
from mergedeep import merge
from napari.utils.notifications import show_info
def load_params(input_path: pathlib.Path) -> Dict:
"""
Load the `params.json` file from the specified input path.
Parameters:
input_path (pathlib.Path): Path to the dire... |
7baeac894c0b6be5c891cc130d6259a36a65120fc87c2f79eaec23347afc46fb | Python | 3,948 | 131 | """SFCN with six parallel outputs for multi-task neuroimaging
prediction."""
import logging
from tensorflow import Tensor
from tensorflow.keras.layers import (
Activation,
BatchNormalization,
Concatenate,
Conv3D,
Dense,
)
from .sfcn import SFCN
logger = logging.getLogger(__name__)
class MultiT... |
ffddbef66e45f88e087ce03849a3fe02c50d9d70149cc4da31f40cc5880b8aaa | Python | 3,948 | 115 | """Look up molecules by SMILES in the TDC to identify their ADMET properties."""
from pathlib import Path
import pandas as pd
from rdkit import Chem
from tdc_constants import ADMET_ALL_SMILES_COLUMN
def preprocess_data(data: pd.DataFrame, smiles_column: str) -> pd.DataFrame:
"""Preprocess data by removing miss... |
19bdc4436901c7962e925b7455af284e72b8fa27e844e8dc93a2697101fe4cbd | Python | 3,949 | 102 | import json
from chemgraph.agent.llm_agent import ChemGraph
from chemgraph.utils.get_workflow_from_llm import get_workflow_from_state
import argparse
import datetime
def get_query(
smiles: str,
query_name: str = "smiles_to_coord", # options: atomsdata, opt, vib
method: str = "mace_mp",
) -> str:
"""G... |
a11956efb5c020cd0a94350d595b24f696a9479c7ceb02e998a745626c92d90f | Python | 3,949 | 137 | import argparse
import os
import os.path
import yaml
def parse_args():
parser = argparse.ArgumentParser(
description=('Pack a CWL workflow into a single file. Use the'
' formatting that seven bridges genomics (sbg) accepts'))
parser.add_argument('--in-cwl',
... |
b33cc96f632f6ab45b458ed037262b344ab7e8e3820ea8d3cd0a3c2967a6817d | Python | 3,949 | 95 | import os
import numpy as np
from marques_stim_common import gen_grating_stim, gen_blank_stim, gen_texture_stim, \
load_stim_info
from brainscore_core.supported_data_standards.brainio.packaging import package_stimulus_set
BLANK_STIM_NAME = 'Marques2020_blank'
RF_STIM_NAME = 'Marques2020_receptive_field'
ORIENTATIO... |
2dae08e27b94f19593d44529cc125795466866e3f4441e7fbdb38042e9b5a301 | Python | 3,950 | 102 | import json
from chemgraph.agent.llm_agent import ChemGraph
from chemgraph.utils.get_workflow_from_llm import get_workflow_from_state
import argparse
from datetime import datetime
def get_query(
name: str,
query_name: str = "atomsdata", # options: atomsdata, opt, vib
method: str = "mace_mp",
) -> str:
... |
814e103ee7e79bb687c446c621823521f793b9e6124ea42f8555db50b57b0352 | Python | 3,950 | 108 | """ Various useful functions. """
import numpy as np
import numpy.typing as npt
def logIo(x: npt.NDArray[np.float64]) -> npt.NDArray[np.float64]:
"""
Calculate the natural log of the 0th order modified Bessel function of 1st kind.
Arguments:
x: numerical vector
Output:
y: natural lo... |
fa57c88991ae7ae1c1d770d7f3719d2f3357aaabf4d4e4b8aa5dc038b344993f | Python | 3,950 | 91 | import os
import numpy as np
import tempfile
from ivim.io.philips import (generate_dti_vectors_input, write_dti_vectors_input, read_dti_vectors_input,
gnorm_from_txt, gnorm_to_txt, cval_from_files)
from ivim.io.base import write_bval, read_cval
from ivim.seq.fwf import c_from_b
# Paths to ... |
3c2066bef86675e6e50fa60f2749ae2646dce449f61bdcb4adaebc66bcd60848 | Python | 3,951 | 93 | from src.wrappers.OsipiBase import OsipiBase
from super_ivim_dc.source.Classsic_ivim_fit import IVIM_fit_sls_lm
import numpy as np
import warnings
class TCML_TechnionIIT_lsq_sls_lm(OsipiBase):
"""
TCML_TechnionIIT_lsqlm fitting algorithm by Angeleene Ang, Moti Freiman and Noam Korngut, TechnionIIT
"""
... |
16dc8aff5b136de9afe18e33a6d7146a344f9c1cc7a4f41ce8533b83fddb68bf | Python | 3,952 | 106 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script to apply a transform to a surface (FreeSurfer or VTK supported),
using output from ANTs registration tools (i.e. vtk_transfo.txt, output1InverseWarp.nii.gz).
Example usage from T1 to b0 using ANTs transforms:
> ConvertTransformFile 3 output0GenericAffine.mat vt... |
4586c0cce69f23576c4038a74dc14d0c0dc6c0b8dc04d4b4d3468253d9b61fb5 | Python | 3,952 | 89 | import torch
import torch.nn as nn
from .modules import CausalCNN, Softplus, SqueezeChannels
class CausalCNNEncoder(torch.nn.Module):
"""
Encoder of a time series using a causal CNN: the computed representation is
the output of a fully connected layer applied to the output of an adaptive
max pooling l... |
5494beedd396fcf574311cfef4706235f036e1534e305e324f1edb11b8c042f5 | Python | 3,952 | 102 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
from torch.nn import functional as F
from torchvision.transforms.functional import resize,... |
63e498b52cf739d51c641251e6e1016ea6d6bed28fce77019dc0a0ebd113f4de | Python | 3,952 | 103 | import os
from pathlib import Path
import numpy as np
import xarray as xr
import pandas as pd
from brainscore_core.supported_data_standards.brainio import get_assembly
from brainscore_core.supported_data_standards.brainio.assemblies import NeuronRecordingAssembly
from brainscore_core.supported_data_standards.brainio.... |
d1feb244024de707737773d50e710541bebf7e4435753e0e91f22074b188a7f3 | Python | 3,952 | 117 | import os
from types import SimpleNamespace
from unittest.mock import Mock
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
import matplotlib
import numpy as np
import pytest
from PySide6.QtWidgets import QApplication
from musclex.ui.DoubleZoomGUI import DoubleZoom as LegacyDoubleZoom
from musclex.ui.DoubleZoom... |
1206b4740c97ee5849f8d894d2a4abe58b975b1d7d2b5f40d440d46c93b2a8f8 | Python | 3,953 | 102 | import json
from chemgraph.agent.llm_agent import ChemGraph
from chemgraph.utils.get_workflow_from_llm import get_workflow_from_state
import argparse
import datetime
def get_query(
smiles: str,
query_name: str = "smiles_to_coord", # options: atomsdata, opt, vib
method: str = "mace_mp",
) -> str:
"""G... |
37b6dd8dac747d913edc53dced13345afc8b334e12e16525fcc976953e419a20 | Python | 3,953 | 103 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Dilate regions (with or without masking) from a labeled volume:
- "label_to_dilate" are regions that will dilate over
"label_to_fill" if close enough to it ("distance").
- "label_to_dilate", by default (None) will be all
non-"label_to_fill" and non-"label_n... |
4b856030badd28ef5c85d65c58a81d693b2f2312190023b3c0737277b7055c68 | Python | 3,953 | 108 | import importlib
import inspect
import pkgutil
from pathlib import Path
from typing import Any
def run_all():
output_file = Path("docs/api/image_models.rst")
header = get_header()
models = retrieve_configurable_models("timm.models")
configurable_models_header = _get_configurable_models_header()
... |
8393ce5c4e4bdef2e499020d585e14af43c3cee0cd299e2676d91ef6ab7d4fa6 | Python | 3,953 | 102 | import json
from chemgraph.agent.llm_agent import ChemGraph
from chemgraph.utils.get_workflow_from_llm import get_workflow_from_state
import argparse
import datetime
def get_query(
smiles: str,
query_name: str = "smiles_to_coord", # options: atomsdata, opt, vib
method: str = "mace_mp",
) -> str:
"""G... |
05bb52f57c74cd7ea9ed80f0f130e856882bc5749a61a545824f3a8f813db645 | Python | 3,954 | 85 | import sys
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from .internals import *
from .components import __get_figax
from .model import lm
from typing import Union, Callable, Dict
# grab module
__pub = sys.modules['pubplot']
def from_coef(parameters, spacing_x: float = 1, spacing_y: float = ... |
539ea33903907ef5869e23b9ead2b84246c07be70945bfd9d25428047eb02404 | Python | 3,954 | 129 | from collections.abc import MutableMapping
from typing import (
TYPE_CHECKING,
Any,
Literal,
NewType,
Protocol,
Union,
)
import torch
if TYPE_CHECKING:
from eir.models.fusion.fusion import al_fused_features, al_fusion_model_configs
from eir.models.fusion.fusion_default import al_featur... |
03d327ab7bc82fcee58081ebdafaf38ac4e334c858043555721cbd6a833d2ac0 | Python | 3,955 | 95 | """EEG spectral features -- used as an OBJECTIVE DROWSINESS REFERENCE.
DD-Database labels are button presses, which measure a participant's
willingness to report drowsiness as much as their physiological state (press
counts vary roughly seventeen-fold across this cohort). EEG gives an
independent physiological criteri... |
edb10da495df9cf7ffe2d75a08af1f67bccab00fe4855ec26263e1cc9954cbab | Python | 3,955 | 129 | import importlib
import sys
import textwrap
from pathlib import Path
# === Configuration ===
SRC = Path('../src/rscvp').resolve()
DST = Path('source/api')
DST.mkdir(parents=True, exist_ok=True)
AUTOSUMMARY_DIR = DST / '_autosummary'
AUTOSUMMARY_DIR.mkdir(exist_ok=True)
CONTENT_FILE = """\
{module}
{underline}
.. cu... |
3acd98c91ec6901723a21e39dccfdbbc6303004122d98e1776c6032b1ec60af3 | Python | 3,956 | 98 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Maximilian Betz
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Li... |
e37a11fee93c7be2ff8c8d10153f82ef68949ef6bc36914f973d817e1dd2899c | Python | 3,956 | 98 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Maximilian Betz
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Li... |
d811bdf9150febcf6001dc77ed710e9d8e8118b29ff47278dc626b018d9f66da | Python | 3,957 | 100 | #!/usr/bin/env python
"""
Point Grey AF Camera functionality.
Hazen 09/19
"""
from PyQt5 import QtCore
import storm_control.hal4000.halLib.halMessage as halMessage
import storm_control.sc_hardware.baseClasses.hardwareModule as hardwareModule
import storm_control.sc_hardware.baseClasses.lockModule as lockModule
impo... |
548c0b44e66cd90a0037cb0f85e66b2cb97330901162a4b0820f8d1bd90dd4b9 | Python | 3,960 | 112 | import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import torch
from model.Ouroboros import Ouroboros
from utils.chem import cal_SAScore, check_smiles_validity
if __name__ == '__main__':
# check GPU
print('CUDA available:', torch.cuda.is_available()) # Should be True
print... |
7157240115475eaaa620e3c2b6a518f6477742f94df96c8a670d179776695c71 | Python | 3,960 | 89 | # -*- coding: utf-8 -*-
import os
import nibabel as nib
import numpy as np
from dipy.io.stateful_tractogram import StatefulTractogram, Space, Origin
from scilpy.tractanalysis.streamlines_metrics import compute_tract_counts_map
from scilpy.tractanalysis.afd_along_streamlines import \
afd_map_along_streamlines
from... |
ead9e529a88ed3f0ac656906e8c8d50888af684e146172e16a0523161252cdab | Python | 3,962 | 123 | # Copyright (c) DP Technology.
# 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.
from typing import Dict, Optional
import torch
import torch.nn.functional as F
from unicore import utils
from ... |
3dd4d7342f59a051d995a5fd76aef051375231af6785104307e5a79ae020b0cc | Python | 3,964 | 125 | '''
C2H2N2O
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for C2H2N2O:
P: potential energy, G: Gradient, D: Nonadiabatic coupling vector
This is listed at the end of description to show the availability.
For example: P/G means both potential ener... |
4f35e0ea94c1a2be7d11ddb562aa0f4a0d938d7301590993e22241913ce36cb0 | Python | 3,965 | 101 | """!
@brief This script prepares labeled calls for DeepSqueak
@details I was struggling with moving labels from my application to deepsqueak so I prepared
a script that exports everything to json, before I create the files using matlab.
The script ends in a main with an example of usage.
"""
i... |
ffd64239436e19ec77b6dc880324f191314e85d25c00b12ee9e3d11769cd834c | Python | 3,965 | 80 | import os
from nipype.interfaces.base import TraitedSpec, File, Directory, BaseInterfaceInputSpec, File, TraitedSpec, BaseInterface, Directory, Str
class QQNetInputSpec(BaseInterfaceInputSpec):
mag_4d_path = File(desc="Path to the 4D magnitude image", exists=True, mandatory=True)
qsm_path = File(desc="Path to ... |
18a2869972858c04545e830aa7cb0fb3385485b4ad159cb4a389b5775ad3b870 | Python | 3,966 | 82 | """Export annotation-grounded crop recipes after users obtain source datasets.
This tool does not download, rename, crop, or alter source images. It reads source
annotations (and image dimensions for YOLO records) and writes a separate table.
"""
from __future__ import annotations
import argparse
import csv
import gz... |
66b6bf1a80189e3e7f0cc340b0096398ff9d5b9fb4affd770bbff03368327572 | Python | 3,967 | 111 | #!/usr/bin/env python3 -u
# 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 torch
from pathlib import Path
from esm import Alphabet, FastaBatchedDataset, ProteinBertModel, pretrained
im... |
f48d4ab0ec99f4155513f756ca11999d0eb4b746e45f561dc42b2f8adb2f4213 | Python | 3,967 | 84 | import numpy as np
from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly
from brainscore_core.supported_data_standards.brainio.packaging import package_data_assembly
import pandas as pd
'''
Experiment Information:
https://arxiv.org/pdf/1706.06969.pdf
- 4 subjects
- 1120 images... |
85b53c95bdd5fd9678c4b6c0d190961293ce742fbf52fe058a3ee1bd5ecf38c4 | Python | 3,968 | 116 | # Kai Sandbrink
# 2022-01-10
# This script saves the hidden layer representations of models for sample trajectories, to be used in e.g. a decoding analysis
# %% LIBRARY IMPORTS
import torch
import os, copy
import numpy as np
from utils import Config, get_timestamp
from utils_project import load_config_files
from te... |
d9d105c5758544bb854a4b6539233e445dbfe73331251db8448c4b76b20e1872 | Python | 3,968 | 121 | '''
CH4Br
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for CH4Br:
P: potential energy, G: Gradient, D: Nonadiabatic coupling vector
This is listed at the end of description to show the availability.
For example: P/G means both potential energy a... |
f0811a82df3fe4264312f3191c9408a93701ac57cca374daee363fdf984e706b | Python | 3,968 | 104 | # (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,... |
1528d20b686f9efdbd81b4fde74921d427be7dc10369d4d4ce7d6bad1f424f5e | Python | 3,969 | 96 | from src.wrappers.OsipiBase import OsipiBase
from super_ivim_dc.source.Classsic_ivim_fit import fit_least_squares_BOBYQA
import numpy as np
class TCML_TechnionIIT_lsqBOBYQA(OsipiBase):
"""
TCML_TechnionIIT_lsqBOBYQA fitting algorithm by Moti Freiman and Noam Korngut, TechnionIIT
"""
# I'm thinking tha... |
cf53cdd0b15fdab063ea8f6d0eb9e1cc3229f9e4791e37cf02321d9fee31e54d | Python | 3,969 | 117 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import os
import sys
import textwrap
from argparse import ArgumentParser
import clickhouse_connect
import clickhouse_connect.driver.client
CLICKHOUSE_HOST_ENV_VAR = "CLICKHOUSE_HOST"
CLICKHOUSE_PORT_ENV_VAR = "CLICKHOUSE_PORT"
CLICKHOUSE_DB_ENV_VAR... |
c3d6e4d23bf6b7bd15df5aea2235bb5cb6249f24824491cabb2ec44700f6a689 | Python | 3,970 | 126 | # Source: https://github.com/neuraloperator/neuraloperator/blob/main/neuralop/losses/finite_diff.py
import torch
"""
finite_diff.py implements utilities for computing derivatives via finite-difference method
"""
#Set fix{x,y,z}_bnd if function is non-periodic in {x,y,z} direction
#x: (*, s)
#y: (*, s)
def central_dif... |
4e59a6132a6f043d8c9d973499429fc2ed3e01d3fa0bc2265d1fe75c0a83824a | Python | 3,971 | 111 | # @ImageJ ij
# @String(value="<HTML>This script applies the Tubeness filter to all TIFF images in a directory.<br>Only 2D or 3D grayscale images are supported. Processing log is shown in Console.", visibility="MESSAGE") msg
# @File(label="Directory containing your images", style="directory") input_dir
# @String(label="... |
915de5b0833b41d3fd3035e604e4ead127f58d311c2beffd2e7c0b626d9a573c | Python | 3,971 | 104 | from typing import Optional, Union
import torch
from torch_geometric.explain.algorithm.captum import (
CaptumHeteroModel,
CaptumModel,
MaskLevelType,
)
from torch_geometric.typing import Metadata
def to_captum_model(
model: torch.nn.Module,
mask_type: Union[str, MaskLevelType] = MaskLevelType.ed... |
aec04221785476e260fb90e9cfbd18f8384ad4694b7cf4a6cbfb220c5435e996 | Python | 3,971 | 125 | from dataclasses import dataclass, field, asdict
from pathlib import Path
from typing import Dict, Tuple, Optional
import json
@dataclass
class StackCorrConfig:
data_channel: int = 1
ref_channel: int = -1
section_depth_um: float = 5
section_width_px: int = 1024
section_height_px: int = 160
com... |
b297d04872436a7d1d031b5d748512ba6e9e9a8adbce28ea661583648fcf078e | Python | 3,971 | 93 | # This file is part of connectome-manipulator.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2024 Blue Brain Project/EPFL
import numpy as np
import os
import pandas as pd
import pytest
from bluepysnap import Circuit
from utils import TEST_DATA_DIR
from connectome_manipulator.connectome_manipulation.manipul... |
eea8025cc49965a3dd4f4e5ba6bf45c8ba234b29ff54ad1d910a86ba5db85ecc | Python | 3,971 | 140 | import numpy as np
import pandas as pd
from ccf_streamlines.coordinates import coordinates_to_voxels
def load_swc_as_dataframe(swc_file):
"""Load a morphology SWC file into a pandas DataFrame.
The dataframe contains the columns:
- ID : node identifier
- type : node type, which could be
... |
1eeb0a4e481367438d79fdecaf8fd426e1d9cfdc89f2193b5bd1a40ed6f4065a | Python | 3,972 | 98 | """Electrode channel-ID -> spatial coordinate lookup, port of
``getCoordsFromLayout.m``.
MEA-NAP doesn't compute coordinates from the recording itself — they come
from a fixed lookup table keyed by ``Params.channelLayout`` (the MEA
hardware type, e.g. ``'Axion64'`` or ``'MCS60'``). Needed for any spatial
network plot.... |
26a649f2bca8a4a24b4d56617487a9a54c4279e559b2b813c9de38f58a60107c | Python | 3,972 | 102 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
from torch.nn import functional as F
from torchvision.transforms.functional import resize,... |
faf9ce6444cde23b840e6a75e8a6d7116d185a7309d2fb43014b334c626e8006 | Python | 3,972 | 129 | import argparse
import h5py
import os
import numpy as np
import sigpy as sp
from sigpy.mri import sms
DIR = os.path.dirname(os.path.realpath(__file__))
# %% options
parser = argparse.ArgumentParser(description='Read in slice files, append them, and save in correct order.')
parser.add_argument('--data_dir', default... |
8543bce8cb1a8596982dd0b55b287eee03f47136b5c58c2a6ec209a8717d4301 | Python | 3,973 | 121 | #!/usr/bin/env python
"""
Fit spots for the focus lock using a correlation based approach.
Hazen 04/18
"""
import numpy
import storm_analysis.sa_library.fitting as fitting
import storm_analysis.sa_library.ia_utilities_c as iaUtilsC
import storm_analysis.sa_library.matched_filter_c as matchedFilterC
import storm_analy... |
00228ebe398237dad4727f97e6cc457622c91472967daf25320894c11e63397c | Python | 3,975 | 112 | """Load OpenAI models using LangChain."""
import os
from getpass import getpass
from langchain_openai import ChatOpenAI
from chemgraph.models.supported_models import (
supported_openai_models,
supported_argo_models,
)
from chemgraph.utils.logging_config import setup_logger
logger = setup_logger(__name__)
de... |
1c6adb5057b0750e036d5262ef274b44010c63db30666a74bac009685cf45858 | Python | 3,975 | 137 | #!/usr/bin/python
#
## @file
#
# MPB 561 fiber laser control.
#
# Hazen 9/10
#
import time
import storm_control.sc_hardware.serial.RS232 as RS232
## MPB561
#
# RS-232 control of a MPB laser, nominally 561, but I think
# this would work with any of their lasers.
#
# This is not actually used, we usu... |
474a0c356c7b7d370dae8b86f5321ce4338b3669383afd06dbf9606b46648d0a | Python | 3,975 | 118 | #!/usr/bin/env python
import os
import sys
sys.path.append('.')
import click as ck
import numpy as np
import pandas as pd
import gzip
import logging
import torch as th
#DGL imports
import dgl
@ck.command()
@ck.option(
'--test-data-name', '-td', default='test', type=ck.Choice(['test', 'nextprot']),
help='Te... |
31e84cb5a04928ca822f9428f92cede6f0f21de285cb17b8898044b60b74d883 | Python | 3,977 | 145 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import importlib
from copy import copy
from pathlib import Path
from typing import Any, Self
import rq
from rq import Retry
from rq.job import Job as RQJob
from rq.job import JobStatus
from cvat.apps.redis_handler import signals
class DetachedJob... |
d43511eb9a6d449219e9ab40d82bd82f471d09dbade702d04693bdbb5b3981e7 | Python | 3,978 | 115 | import numpy as np
import pandas as pd
import sklearn
import sklearn.model_selection
import os
import pickle
def grid_search(args):
"""
Wrapper around sklearn's parameter grid. Mends
dict values that are not wrapped in list
"""
args = args if isinstance(args, (list, tuple)) else [args]
return ... |
7dc45715693b823a434c796a2ffe7e825581ba6406aac8ea75e6af0df9fcf601 | Python | 3,979 | 123 | #!/usr/bin/env python3
"""Merge multiple RSEM *.genes.results files into expression matrices.
RSEM gene-level output typically contains columns like:
gene_id, length, effective_length, expected_count, TPM, FPKM
This script builds:
- gene_counts.tsv (expected_count)
- gene_tpm.tsv
- gene_fpkm.tsv
- gene_leng... |
42c5965a74206a682087b1619fd527c31020803ee050a45a48530145fded6457 | Python | 3,980 | 87 | import numpy as np
from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly
from brainscore_core.supported_data_standards.brainio.packaging import package_data_assembly
import pandas as pd
'''
Experiment Information:
https://arxiv.org/pdf/1706.06969.pdf
- 4 subjects
- 1280 images... |
56bf8e68098f9bc02db5442af9a81bc0f0f33267006ea56fc3133e5368c3f425 | Python | 3,980 | 107 | import pfp_api_client
from pfp_api_client.pfp.calculators.ase_calculator import ASECalculator
from pfp_api_client.pfp.estimator import Estimator, EstimatorCalcMode, EstimatorMethodType
from ase import Atoms, units
from ase.io import Trajectory, write
from ase.build import bulk, surface, molecule, add_adsorbate, fcc111... |
b8a653c38adb6fb638877205f9c095abe2957c6ef585f1e7b4290932c61e3929 | Python | 3,980 | 120 | import json
import logging
from collections.abc import Generator
from contextlib import contextmanager
import websocket
from websocket._exceptions import WebSocketBadStatusException, WebSocketTimeoutException
from eir.setup.streaming_data_setup.protocol import (
FROM_SERVER_MESSAGE_TYPES,
PROTOCOL_VERSION,
)
... |
3c1006e25139fff9ad861875e6c0a3c6ca1bdd2b6651632c163d37bdb4f6002f | Python | 3,981 | 171 | import pytest
import numpy as np
import tensorflow as tf
from nems.layers.conv2d import Conv2d
def test_constructor():
with pytest.raises(TypeError):
# No shape
conv2d = Conv2d()
with pytest.raises(TypeError):
# Shape has too few dimensions
conv2d = Conv2d(shape=(2,))
# Bu... |
b565a4b81262f694c6fc9fc82fb1cc2f882ae046a67296731102b25cd12b9f97 | Python | 3,981 | 112 | from pymongo import MongoClient
from benedict import benedict
from pathlib import Path
import datetime
import re
import shutil
import os
SETTINGS = benedict(Path(__file__).parents[0] / "settings.yaml")
def get_collection(name):
cluster = SETTINGS["CLUSTER"]
print(cluster)
client = MongoClient(cluster)
... |
2b976330de981915c1faae723bf5a00e0a13e99ec73d10741b11226d7ac411ff | Python | 3,983 | 121 | """Tests for the planner_agent function in the Send()-based multi-agent graph."""
import json
import pytest
from chemgraph.graphs.multi_agent import planner_agent
# -- Helpers / mocks ----------------------------------------------------------
_VALID_PLANNER_JSON = json.dumps(
{
"thought_process": "Dele... |
b28d3c8cc0793bdc5f8d61060fbb630ad4de70c1b63fb9ef1e5f44081a6fb4b3 | Python | 3,983 | 106 | """
This script updates the behavior dataframe to include new columns
"""
import json
from ast import literal_eval
import numpy as np
import os
# Get the directory of the current script
script_dir = os.path.dirname(os.path.realpath(__file__))
# Construct the absolute path to the config.json file
config_path = os.pat... |
d86eeaf6794c3b859f76d39bafce52d1720a990627197855dbcc0785522779bb | Python | 3,983 | 156 | """Test the QtPy CLI."""
import subprocess
import sys
import textwrap
import pytest
import qtpy
SUBCOMMANDS = [
[],
["mypy-args"],
]
@pytest.mark.parametrize(
argnames=["subcommand"],
argvalues=[[subcommand] for subcommand in SUBCOMMANDS],
ids=[" ".join(subcommand) for subcommand in SUBCOMMAND... |
264be62c9a563c8dfb4e62d4ba063cdd74b31a798086267311cd3e1077c3c3ca | Python | 3,986 | 132 | from pathlib import Path
import numpy as np
from tifffile import tifffile
from argclz import AbstractParser
from neuralib.imglib.io import tif_to_gif
from neuralib.persistence import persistence
from neuralib.util.verbose import print_save
from rscvp.retinotopic.util import compute_wfield_trial_average, combine_cycle... |
303cedbc2d64b05b204c1c1fd4c2e1a5f4c70a26fc608697d83c7f6e229d4b2a | Python | 3,988 | 80 | #!/usr/bin/env python
"""
calibrate_temperature.py
────────────────────────────────────────────────────────
给定验证集 logits → 优化单一温度 T (温度缩放) 以最小化 NLL。
输出 JSON: { "T": ..., "brier": ..., "auc_macro": ... }
"""
from __future__ import annotations
import argparse, json, numpy as np, torch, torch.nn.functional as F
from pathl... |
ae2ee134b5f3465819a0fd9f5e9752f92c9d8e51e835ac5209e513312811fa7e | Python | 3,988 | 104 | import json
from chemgraph.agent.llm_agent import ChemGraph
from chemgraph.utils.get_workflow_from_llm import get_workflow_from_state
import argparse
from datetime import datetime
def get_query(
name: str,
query_name: str = "atomsdata", # options: atomsdata, opt, vib
method: str = "mace_mp",
) -> str:
... |
ca0cadf5a93aaf15493ef68a44263db972a050741f85a2507e0a5b440817aefd | Python | 3,988 | 95 | from src.wrappers.OsipiBase import OsipiBase
from super_ivim_dc.source.Classsic_ivim_fit import IVIM_fit_sls_trf
import warnings
import numpy as np
class TCML_TechnionIIT_lsq_sls_trf(OsipiBase):
"""
TCML_TechnionIIT_lsqlm fitting algorithm by Angeleene Ang, Moti Freiman and Noam Korngut, TechnionIIT
"""
... |
e05fb3fea7b198ed3998696773023baa6da85a0f6a3478ff9268b961199ba95a | Python | 3,988 | 129 | from __future__ import absolute_import
from torch import nn
from torch.nn import functional as F
from torch.nn import init
import torchvision
import torch
from .pooling import build_pooling_layer
from .resnet_ibn_a import resnet50_ibn_a, resnet101_ibn_a
__all__ = ['ResNetIBN', 'resnet_ibn50a', 'resnet_ibn101a']
c... |
b820a8739bf12c3c3f0f480d3b1769566e3fe5e524db2c02a11e9ff2fb4bceed | Python | 3,989 | 120 | # -*- coding: utf-8 -*-
"""
Temporal signal-to-noise ratio of functional time series
This scripts calculates temporal signal-to-noise ratio of a set of time series.
TSNR os single time series and the overall mean are written.
"""
# python standard library inputs
import os
import datetime
# external inputs
import nu... |
a950571b16dd8d026288edc051e7d77bbe24358f6eef791f7ca920e78cb7a353 | Python | 3,991 | 111 | import random
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from fitter import Fitter
from scipy.stats import exponnorm
np.random.seed(0)
# load external pairs https://github.com/chcomet/nbfnet-gr/blob/master/data/silver/external_pairs.csv
pairs = pd.read_csv("../silver/external_pairs.cs... |
7950567772d052efcc1728ee2a739bd035e2742f997270750ece0020519dfb23 | Python | 3,992 | 121 | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 6 19:33:49 2022
@author: Artur Klepaczko
"""
import nibabel as nii
import cv2
import json
import numpy as np
from pathlib import Path
from tqdm import tqdm
from typing import Final
NII_ROOT: Final[Path] = Path(R'.')
ROI_ROOT: Final[Path] = Path(R'D:\TexturesKidneys')
... |
00607034cb48999234c46d9130e42a14ec1e2cc781639794cebee2ae86963e27 | Python | 3,996 | 110 | import inspect
from unittest.mock import patch
from eir.train import Experiment
from eir.train_utils import train_handlers
from eir.train_utils.ignite_port.events import Events
from tests.setup_tests.fixtures_create_experiment import ModelTestConfig
al_prep_modelling_test_configs = tuple[Experiment, ModelTestConfig]
... |
477237bd5ed29e568d3634ac8aca1e9d746a9eef2c818174c44e61264c6cff87 | Python | 3,996 | 76 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'holoeye.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_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectNam... |
233e8b642162fa13a5d52a9df73df8fe228224f34c9f1bb96d14240a9a2353de | Python | 3,997 | 106 | import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle, ConnectionPatch
import figure_properties as fp
import numpy as np
seed = 11
c2_poi_fn = str(seed) + '_longer_100_poi_2Hz_7_Control.npz'
l2_poi_fn = str(seed) + '_longer_100_poi_2Hz_20_Letm1.npz'
#p2_poi_fn = str(seed) + '_PDP_slower_100_poi_2Hz_... |
cc008a5c28a66e085a87b359da55ac04438fc6bc0b696964fec983dfb3af8fe1 | Python | 3,998 | 132 | #!/usr/bin/python3
#
import os
import sys
import argparse
from sklearn.neighbors import NearestNeighbors
from uac import utils
# Create the parser
my_parser = argparse.ArgumentParser(description="Calculation of new atrial coordinates for RA")
# Add the arguments
my_parser.add_argument("target_path", metavar="path", ... |
3b35d4fe4e7e7a0f643fd4353f9f534af586a1ee83d2144ff3c57f43bce2e213 | Python | 3,999 | 122 | import logging
import numpy as np
import pytest
from tensorflow.keras.layers import Conv3D
from pyment.models.sfcn import MultiTaskSFCN, RegressionSFCN
INPUT_SHAPE = (32, 32, 32)
@pytest.fixture(scope='module')
def backbone():
return MultiTaskSFCN(input_shape=INPUT_SHAPE)
@pytest.fixture(scope='module')
def ... |
88b53d18914ace0cfca5e21ca4dc8e67984b7f3280ac53fef3af1d5457837d1c | Python | 3,999 | 128 | # 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
# distributed under th... |
faeb625274eb71928c43526aa9cdd3d9042eea908d054aaaae6bcbb5c2e95c25 | Python | 3,999 | 123 | import math
from collections import OrderedDict
from torch import nn
class Flatten(nn.Module):
"""
Helper module for flattening input tensor to 1-D for the use in Linear modules
"""
def forward(self, x):
return x.view(x.size(0), -1)
class Identity(nn.Module):
"""
Helper module tha... |
6bf078806ede14abf0c48f18e169fb18e7a6e2d6541a332922cae31cc268c502 | Python | 4,000 | 109 | import copy
import os
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim.lr_scheduler import StepLR
from torch.utils.data import DataLoader
from torchvision import datasets, models, transforms
from torchvision.datasets import ImageFolder
# Function to train the model
def tra... |
82bf6c1bd4a3cb9e00594e87ddd4abe898be079c2024d583b3098b2e3f086d72 | Python | 4,001 | 58 | from brainscore_core.supported_data_standards.brainio.assemblies import NeuronRecordingAssembly
from brainscore_vision import data_registry, stimulus_set_registry, load_stimulus_set
from brainscore_vision.metrics.internal_consistency.ceiling import InternalConsistency
from brainscore_vision.metric_helpers.transformati... |
0e6fad50129bd3e7b0054c98cabe1b07af4de5c9874198c4a457159332d607c9 | Python | 4,002 | 111 | from typing import Optional
import torch
from torch import Tensor
from torch.nn import Parameter
from torch_geometric import EdgeIndex
from torch_geometric.nn.conv.cugraph import CuGraphModule
from torch_geometric.nn.conv.cugraph.base import LEGACY_MODE
from torch_geometric.nn.inits import glorot, zeros
try:
if ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.