sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
13764349ae32890c92e3231ff927e6418f4a5ce827c2f767ded6a3cec1e37d28 | Python | 4,002 | 102 | import numpy as np
import OptimalBattery.util as ut
import os
import pandas as pd
import OptimalBattery.evaluate as ev
import Functional_Fusion.atlas_map as am
from Functional_Fusion.dataset import DataSetMDTB
import OptimalBattery.construct as ct
import OptimalBattery.plot as plot
from OptimalBattery.global_config imp... |
327034b65dee8c59c76104583030da1193839391ef66e5e65bf91bf00242f8de | Python | 4,002 | 88 | import argparse
from ruamel import yaml
from ruamel.yaml.scalarstring import PreservedScalarString as pss
import sys
import pdb
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input-cwl', action='store', dest='cwl', help='Input cwl file',required=True)
parser.add_argument('-r', '--readme', action='sto... |
6c54fec2e04a72e610cd096a79e70a6bfaae110f17f1d61741bf9acc2244acf1 | Python | 4,002 | 96 | from src.wrappers.OsipiBase import OsipiBase
from super_ivim_dc.source.Classsic_ivim_fit import fit_least_squares_trf
import numpy as np
class TCML_TechnionIIT_lsqtrf(OsipiBase):
"""
TCML_TechnionIIT_lsqlm fitting algorithm by Angeleene Ang, Moti Freiman and Noam Korngut, TechnionIIT
"""
# I'm thinkin... |
ebfec86d333b5a26bc8c6855285d124ff85320d10c20f780bcdd96339134d5ab | Python | 4,002 | 109 | from fractions import Fraction
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
def ax_remove_box(axes=None):
"""Remove right and top lines from plot border on Matplotlib axes."""
if axes is None:
axes = plt.gca()
axes.spines['right'].set_visible(False)
axes.spines['top'].s... |
1a3ac7d1cf370a598abbd134b04482cda8acd65cfb73b1c037ec3b5c79a53c8e | Python | 4,003 | 105 | import numpy as np
import numpy.polynomial.polynomial as poly
import warnings
from utilities.data_simulation.GenerateData import GenerateData
class LinearFit:
"""
Performs linear fits of exponential data
"""
def __init__(self, linear_cutoff=500):
"""
Parameters
----------
... |
0250b480119dd15961a91c7154c4971a54baa0ac037818ea9a29f5c4c1471745 | Python | 4,004 | 62 | import argparse
import os
from .train import train
from datetime import datetime
def main():
parser = argparse.ArgumentParser(prog="rapidparc-train", description="Argument parser for streamline classification")
job_id = os.environ.get("WANDB_RUN_ID", None)
if job_id is None:
job_id = os.environ.ge... |
1c9394beb578a924f4c3335d695891cb944f38292342903948c390cbcb6f347c | Python | 4,004 | 117 | #############################################################################
# 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... |
f9d3b8b45be08b185985a0dec5102bc78d1056b4347662407d8686fdf0a3a32e | Python | 4,004 | 104 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Given a bundle and Bingham coefficients, compute the average Bingham
metric at each voxel intersected by the bundle. Intersected voxels are
found by computing the intersection between the voxel grid and each streamline
in the input tractogram.
This script behaves like... |
0d3352c3f414e1714cbcfa82a7fb7aba9b0366cb510c85b5c76d3304ca7068ad | Python | 4,005 | 111 |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import Functional_Fusion.dataset as ds
import Functional_Fusion.atlas_map as am
from scipy.stats import ttest_ind
from OptimalBattery.global_config import data_dir
def get_covariance_matrices(space = 'fs32k',tasks=None,base_dir = None):
""" G... |
6465bf08afc0036dea6ae3bf24d0181e56ac0063ac8a5f218428791a45085b48 | Python | 4,005 | 121 | # Kai Sandbrink
# 2023-02-01
# This script samples trajectories across test tau values for the specified models
# %% LIBRARY IMPORTS
import torch
import pandas as pd
import numpy as np
from utils import Config, get_timestamp
from utils_project import load_config_files
from test_case import test, test_helplessness, pe... |
0c475b4ee046f1d72dcf613097c7949c5660621ecca7674eadc9ceebf3a8eda1 | Python | 4,006 | 105 | import torch
from torch import nn
class Conv1d_bn(nn.Module):
def __init__(self, in_filters, out_filters, filter_size, stride=1, padding=0):
super(Conv1d_bn, self).__init__()
self.conv = nn.Conv1d(in_filters, out_filters, filter_size,
stride=stride, padding=padding, bias=F... |
10351575f93106a39df0b0b6ef8da226b7cb7562361c35fa27ff77e1988ce037 | Python | 4,006 | 84 | import numpy as np
from result_caching import store
from brainscore_core.supported_data_standards.brainio.assemblies import DataAssembly
from brainscore_vision import load_dataset, load_metric
from brainscore_vision.benchmark_helpers.properties_common import PropertiesBenchmark, _assert_grating_activations
from brains... |
d59f97c351f231ae481d027362d39bf2fd2b2f1be8abdb27a90cff89eda369ff | Python | 4,006 | 116 | import pandas as pd
import numpy as np
def tree_to_csv(tree_path, metadata_npz_path, output_csv):
"""
Processes the Infomap tree file and metadata to create a CSV with coordinates and community paths.
Parameters:
tree_path (str): Path to the Infomap tree.tree file.
metadata_npz_path (str): Pat... |
c0a198ef49aa3856a1d25ec77af5dc9870cfb9d03773bdb90fb7b824d8844618 | Python | 4,007 | 142 | from dataclasses import dataclass
import torch
from diffusers.schedulers.scheduling_ddpm import DDPMScheduler
from torch.nn import functional as F
@dataclass
class DiffusionConfig:
time_steps: int
betas: torch.Tensor
sqrt_alphas_cumprod: torch.Tensor
sqrt_one_minus_alphas_cumprod: torch.Tensor
sq... |
e6880874ea2d85f46446dd3daec46f76234182eab87b4f49bf9c098946e4dd07 | Python | 4,007 | 109 | from tensorflow.keras import Sequential, Model
from tensorflow.keras.layers import Input, Layer, Conv3D, Conv3DTranspose, ReLU, Activation, Add, LeakyReLU, Concatenate, Lambda
from tensorflow.math import reduce_mean, abs as tf_abs
from tensorflow import pad as tf_pad
class InstanceNormalization(Layer):
def __... |
84ca74fd112d2d59822c0af783bea3acca90e7a4193256212c89396056a8b0e6 | Python | 4,009 | 147 | # Kai Sandbrink
# 2022-09-25
# This script makes plots based on the saved alphavector policies outputted by QuickPOMDPS
# %% LIBRARY IMPORTS
import numpy as np
import matplotlib.pyplot as plt
import os
import sympy as sym
from sympy.abc import x
import matplotlib
from datetime import datetime
from utils import forma... |
9096789f17ed76bc3d657744e54385d0dc037a683919938b4274ef7c127708d9 | Python | 4,009 | 117 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import contextlib
import io
from pathlib import Path
from unittest import TestCase
from unittest.mock import patch
import fakeredis
from django.apps import apps
from django.core.management import call_command
from django.core.management.base import ... |
361bacfb0ea3dddcfab9672c9a88b793d4cd9e623ed545959034961b77455bf4 | Python | 4,010 | 104 | 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... |
5ca66dc5ba79f1313bb2ed3451ef01baaca3f594f995fd337a752d9a0567516f | Python | 4,010 | 99 | import torch
from torch import nn, Tensor
from typing import Optional
__all__ = ["soft_micro_f1", "BinarySoftF1Loss", "SoftF1Loss"]
def soft_micro_f1(preds: Tensor, targets: Tensor, eps=1e-6) -> Tensor:
"""Compute the macro soft F1-score as a cost.
Average (1 - soft-F1) across all labels.
Use probability... |
ab1d3f8fe10db2a9b166dee805ecd16ab40f2fd98a7ea98a3ea9026c516a6518 | Python | 4,011 | 131 | #!/usr/bin/env python3
"""
Usage: ./sex-estimator.py alignment.bam --threads 10 --prefix 11611_fa-GRCh38-HiFi-aln
Check the sex of sample.
Author: Mei Wu, https://github.com/projectoriented
"""
import os
import sys
import logging
import argparse
import pandas as pd
import pysam
from datetime import datetime
from io ... |
6afb1ba98de46563c5dc977a73d72be25c3c7ba5dcb020923f6e89da83be0c73 | Python | 4,012 | 105 | from __future__ import print_function
import os
import re
import gzip
import itertools
import argparse
import subprocess
__author__ = 'Original - Martin Aryee; Modified by Nagendra Palani (UMGC)'
# WARNING: This script works ONLY for libraries generated
# using the protocol at https://dx.doi.org/10.17504/protocols.i... |
6d389f128c10ccf31a10b9b5232dbe21d91b8a87fcd5979e95416e85c1bd2958 | Python | 4,012 | 102 | import torch
from torch import nn
from torch.nn.parameter import Parameter
class LARC(object):
"""
:class:`LARC` is a pytorch implementation of both the scaling and clipping variants of LARC,
in which the ratio between gradient and parameter magnitudes is used to calculate an adaptive
local learning r... |
97a242c58c664424b99af0bfb54e54d7294a105c6832c97896d3e218ab1815c3 | Python | 4,012 | 117 | #!/usr/bin/env python3
# NOTE: deprecating spherical roots changes the behavior of this model.
# There is no soma, because only the root sample has tag 1, which will be
# ignored as it is always the proximal end of any cable segment.
# The fix is to:
# - Write an swc interpreter that inserts a cylinder with the
# ... |
1067c1028ad15a911b437e761d9e07bb2ba78a515d17607114a2ac6d35b8831e | Python | 4,016 | 132 | from unittest.mock import patch
import numpy as np
import pytest
from brainways.pipeline.brainways_params import CellDetectorParams
from brainways.pipeline.cell_detector import CellDetector, filter_by_cell_size
@pytest.fixture
def test_data():
labels = np.array(
[
[0, 0, 1, 1],
[... |
53f78f4f5eeb41039d07d77ac8416ac9448cf2cb2baab83430bed2ab04484d25 | Python | 4,017 | 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:
... |
b62b9d51a2ecdd47ada2f8a184def9845993fb15e440f396c43860d82ec89361 | Python | 4,017 | 61 | from testsetclass import TestsetClass
class MCONF(TestsetClass):
def __init__(self):
self.weak = 1.0
self.molecules = ['50', '32', '35', '51', '34', '33', '20', '18', '27', '9', '11', '7', '29', '16', '42', '45', '6', '28', '17', '1', '10', '19', '26', '8', '21', '44', '43', '38', '36', '31', '30'... |
086944a0821972e376fb95d9ff15de9e914f8a154910dc075ea8a961622565de | Python | 4,018 | 139 | # 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.
import contextlib
import logging
import numpy as np
import torch
logger = logging.getLogger(__name__)
def ... |
49a701c11ba73610ba79f0a513e38025dabab21192fac339e8c847389a1d04e4 | Python | 4,019 | 99 | #!/usr/bin/env python
from __future__ import print_function
# from .bullseye_pipeline import bullseye_pipeline
from bullseye_pipeline import create_bullseye_pipeline
from nipype import config, logging
import os, sys,glob
import argparse
from itertools import chain
def bullseye_workflow(scans_dir, work_dir, outputd... |
f93552ecf7fb566e99586ca544b9d13f145d92a9090ff6813639480018855eae | Python | 4,019 | 127 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import argparse
import json
import textwrap
from collections.abc import Sequence
from typing import Any
from cvat_sdk import Client
from .agent import FUNCTION_PROVIDER_NATIVE, get_function_driver_class, run_agent
from .command_base import CommandG... |
88a75cb5187a3b0b8c62d45d40560f9d987dee2eb4c1dffa999e41bd28eb2d09 | Python | 4,020 | 103 | """Parity test: Python stim activity analysis vs MATLAB StimActivity_NodeLevel.csv.
Isolates the stim *analysis* arithmetic from spike detection by feeding MATLAB's
own spikeTimes (from ExperimentMatFiles), exactly as the step-2/3/4 ports do.
Pipeline: detect stim (on raw) -> patterns -> clean spikes -> activity metri... |
8efbfdb92dcc6119dac25f1ac91acb69469b5159cd0f0227d8a3c89be1dff480 | Python | 4,020 | 120 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import pytest
from cvat_sdk import models
from cvat_sdk.attributes import (
attribute_vals_from_dict,
attribute_value_validator,
number_attribute_values,
)
def test_number_attribute_values_can_convert_good_values():
assert number_at... |
32dda74ea4475d8147fa777846c81bf00d3a0c7678b53fd4425c8dcf32f030b7 | Python | 4,021 | 103 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Compute clusters using QuickBundlesX and save them separately.
We cannot know the number of clusters in advance.
----------------------------------------------------------------------------------
References Quickbundles[1] QuickbundlesX [2] :
[1] Garyfallidis, E. et ... |
1f8bca86efd4bb5635649fe9884c2889ab2d97a9a4deb3af3e55513ab2b399d0 | Python | 4,023 | 111 | from typing import List
import os
import torch
from torch import optim
import numpy as np
from lib_3d_OT.single_modialty import *
from lib_3d_OT.utils import *
def pairwise_dpca_and_train(adatalist: List, join: str = 'inner', n_comps: int = 50, epochs: int = 1150,neighbors=8, device=None) -> tuple:
corrected_adatas... |
c4818c81a97c0225497216ff790418e48261cf1646909ce18dba90dac3c48678 | Python | 4,023 | 121 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Daniel Abele, 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 except in compliance w... |
ce91af430010d136a796a8718a1260915eeb55ee5f7c976c53603c2cf4f9f4c1 | Python | 4,023 | 109 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Compute include and exclude maps, and the seeding interface mask from partial
volume estimation (PVE) maps. Maps should have values in [0,1], gm+wm+csf=1 in
all voxels of the brain, gm+wm+csf=0 elsewhere.
References: Girard, G., Whittingstall K., Deriche, R., and Desc... |
cec80883860039e42b70cd72f4df990fc33c444771fba8cebd7dc39c2eae5b4d | Python | 4,023 | 133 | '''
H2O2
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for H2O2:
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 and... |
7b48f87f1a58fb90658caa68add6186ae707d32e8b954a5bfcb886c1d6c18466 | Python | 4,024 | 131 | import ast
import json
import operator
from collections import defaultdict
from collections.abc import Generator, Iterable, MutableMapping
from dataclasses import fields, is_dataclass
from functools import reduce
from pathlib import Path
from typing import (
Any,
)
import yaml
from eir.utils.logging import get_lo... |
9508ec57b12af7517409fc7cebff86fcc06f60c2f967852d9e699bc7e8d5ccf9 | Python | 4,024 | 136 | #!/usr/bin/python
#
## @file
#
# Olympus IX2-UCB filter wheel control
#
# Hazen 09/13
#
import time
import storm_control.sc_hardware.serial.RS232 as RS232
## IX2UCB
#
# This class encapsulates control of a Olympus filter wheel that
# is run by a IX2UCB controller. Communication is done via RS-232
#
... |
a05fd0c2e3aed80534e7304881f837766e0cd8efb88f959e8a0860f5ae35ae1c | Python | 4,025 | 50 | '''
Quick script to run knock-out analyses over data from exemplar task.
All options available in `subject_rerp_mt2.py` are, of course, also
available here.
NOTE: Running these analyses requires you to specify which model to
evaluate. Consequently, this should be done _after_ evaluating results
from rERP analysis.
''... |
effee832035af08af4960dfb2cabebdf1249d6ca80f7b180a75dc000c018c1f2 | Python | 4,026 | 108 | """
September 2020 by Oliver Gurney-Champion & Misha Kaandorp
oliver.gurney.champion@gmail.com / o.j.gurney-champion@amsterdamumc.nl
https://www.github.com/ochampion
Code is uploaded as part of our publication in MRM (Kaandorp et al. Improved unsupervised physics-informed deep learning for intravoxel-incoherent motion... |
d790bd677eec6ff126c686731624f8634361d7d21742ddeea0aa37cad72f6071 | Python | 4,027 | 121 | '''SENet in PyTorch.
SENet is the winner of ImageNet-2017. The paper is not released yet.
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicBlock(nn.Module):
def __init__(self, in_planes, planes, stride=1):
super(BasicBlock, self).__init__()
self.conv1 = nn.Conv2d(... |
eedd2090e2cd91fc0dc4fef584eb125b95e2404bbd66de564ba90f552792750b | Python | 4,027 | 122 | #!/usr/bin/env python
from skimage import morphology as sim
from scipy.ndimage.morphology import binary_fill_holes
from nipype.interfaces.freesurfer.preprocess import MRIConvert
from nipype.interfaces.fsl.maths import ApplyMask
import nibabel as nb
import numpy as np
import sys
import os
#
# anat_brain-extract_using... |
6d607e9800567e73148cb573a58f5b1738f2b4e38d23c2715be8cf503c19bfec | Python | 4,028 | 115 | """
utils.calibration
──────────────────
概率校准工具集合:
1) Beta Calibration (Kull & Silva, 2017)
2) Platt Scaling (一维逻辑回归)
3) Temperature Scaling(单温度标量)
目前主脚本只用到 beta_calibration,其余可按需调用。
"""
from __future__ import annotations
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.linear_m... |
9c4d057db08096e1ba030cadce656ebb4fece5038b394b1c8324958a3192dde4 | Python | 4,028 | 106 | 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:
... |
430203aafa082c7ee54452ce755f87eca06c42765ae247524d3b81e316d89da3 | Python | 4,029 | 103 | import os
from glob import glob
import h5py
import numpy as np
import pandas as pd
import re
import xarray as xr
from pathlib import Path
from tqdm import tqdm
from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet
from brainscore_core.supported_data_standards.brainio.assemblies import Neuro... |
30c1fca5cf38a6eaf4d9063e6cc603d1890597ab85353ae0a59c97ee2d187360 | Python | 4,030 | 129 | """Utilities for conforming NIfTI images to the shape and voxel size
expected by the SFCN model."""
import logging
import nibabel as nib
import numpy as np
from nibabel.processing import resample_from_to
from numpy.typing import DTypeLike
from .crop import crop_nifti_image_if_necessary
from .pad import pad_nifti_ima... |
37cb7c2a71d9043d1e76ba5f99db1116dea866b7ae5b877ac72e859386eac5a7 | Python | 4,030 | 124 | '''
ClNH3
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for ClNH3:
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... |
384ccae5efeb578a880a3b348877358dbc3953ce811a58e2b7741345b34c80ad | Python | 4,031 | 122 | import logging
import nelpy as nel
from nelpy import utils
def test_eventarray_support_clipping_logs_info(caplog):
ea = nel.EventArray(
abscissa_vals=[[0.1, 0.3, 1.1]],
support=nel.EpochArray([0, 2]),
fs=1,
)
with caplog.at_level(logging.INFO, logger="nelpy"):
_ = ea[nel.... |
8b3faf3e36546a9f646662059ae248898ab75d784c3f8149a78dcc4e086ed8c8 | Python | 4,031 | 105 | import torch
from torch.utils.data import Dataset
from typing import List, Tuple
def collate_fn(batch: List[Tuple]) -> Tuple:
"""
Collates a batch of protein data, padding sequences and creating masks.
This version is adjusted to match the output of BatchDatasetCompRaw.
"""
def _create_masks(mask... |
f603ba4a9e8c8e8ed83968f8b1e9288791998abcd3792f47a0325f8f5ba7fc54 | Python | 4,031 | 145 | # Copyright 2014-2015 Numenta Inc.
#
# Copyright may exist in Contributors' modifications
# and/or contributions to the work.
#
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
import abc
import os
import pandas
import sys
fr... |
05dad9bc5e73e009929ec1885639be0dcf5144d46afe31508a3cd0793769b276 | Python | 4,032 | 119 | from pathlib import Path
from typing import Literal, Final
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
from rich.pretty import pprint
from argclz import as_argument
from neuralib.util.verbose import publish_annotation
from rscvp.statistic.core import StatPipeline
from rscvp.util.cli ... |
a864aa3560542bbfb32d11324783252a19d25b8bb93b244b649ceb59a9a376dd | Python | 4,032 | 102 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Use multiple versions of a same bundle and detect the most probable voxels by
using a threshold on the occurrence, voxel-wise. With threshold 0.5, this is
a majority vote. This is useful to generate an average representation from
bundles of a given population.
If stre... |
33806ed17bacf08916f066338f13f149d3d735b7020b1f5cbba72773106f2f1f | Python | 4,033 | 106 | import os
import os.path as osp
from typing import Callable, List, Optional
import torch
from torch_geometric.data import (
HeteroData,
InMemoryDataset,
download_url,
extract_zip,
)
class MovieLens(InMemoryDataset):
r"""A heterogeneous rating dataset, assembled by GroupLens Research from
the... |
ec9baf39bcdd4d390cdb34fd5e64565727565fdac0b4969e7bb92076457fe620 | Python | 4,034 | 104 | # -*- coding: utf-8 -*-
"""
ANA <-> ORIG registration
The purpose of the following script is to compute the deformation field for the
registration between antomy in conformed freesurfer space and native anatomical
space. The transformation can be computed from the headers of source and target
images. The script needs ... |
103714cc2dfe0eb20716dd9d890c7f383df4b395b7253bd9ed80ea5c4f4363b0 | Python | 4,035 | 117 | import os
import numpy as np
from nibabel.loadsave import load
import pyvista as pv
from util.config_vars import config
from util.io import make_dir_if_not_exists
# NOTE if you get an EOF Error (hints to corrupted file) please delete the file and download it again - might fix it
# TODO test this with all data and c... |
33fe9555578a40ae45bbf4579ddaeeb99594237628ad6a471ba99b09beab5672 | Python | 4,037 | 183 | # -*- coding: utf-8 -*-
# @Author : LG
from abc import ABC, abstractmethod
class PluginBase(ABC):
"""Base class for all plugins."""
def __init__(self):
self.enabled = False
@abstractmethod
def init_plugin(self, mainwindow):
"""
Be used to plugin initialization.
... |
90e70491539ea08c9267b12cc2b715fb1680ecc2793fb93574c936356d4d0a26 | Python | 4,037 | 110 | """
Epoching: Network Response
==========================
In this tutorial we will cover how to epoch the inferred state/mode time courses. We will use the functionality in MNE to do this. This requires us to have the continuous training data in `.fif` format.
"""
#%%
# Download source data
# ^^^^^^^^^^^^^^^^^^^^
# I... |
a589d3cb119de9e3909f277d8e69b47c62712f06576baecfc799819b50dbf3f6 | Python | 4,037 | 96 | import matplotlib.pyplot as plt
import numpy as np
import nems
from nems import Model
from nems.layers import WeightChannels, FiniteImpulseResponse, DoubleExponential
from nems import visualization
# Basic options to quickly fit our models
options = {'options': {'maxiter': 100, 'ftol': 1e-4}}
#######################... |
3a08b2c558ab4da8414f7b3706aa6359230707d0af05f20ac7100d4b3dbd5828 | Python | 4,038 | 115 | # -*- coding: utf-8 -*-
# @Author : LG
import sys
from importlib.metadata import entry_points
from PyQt5 import QtCore
class PluginManager:
"""Plugin engine: discovery, lifecycle and event dispatch.
UI-free — this class only keeps the loaded plugin instances and fires
the lifecycle events to the enabl... |
628d01bdd4fd4c750f0a0f2778992c21b30f7622b399bc974006dfa24c1c550d | Python | 4,038 | 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... |
fc4f3697dc20087dab9428ac246fa7fab9848d871c9b01f2620f9b0179d98640 | Python | 4,038 | 83 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
import torch
from ultralytics.data.augment import LetterBox
from ultralytics.engine.predictor import BasePredictor
from ultralytics.engine.results import Results
from ultralytics.utils import ops
class RTDETRPredictor(BasePredictor):
"""RT-DETR... |
0cd0fcf56c1a53b80db3ac723412bfabb00076c1bbbb100538bca9d278a42af8 | Python | 4,040 | 94 | """Evaluate predictions from multitask Chemprop models on all TDC ADMET datasets."""
from collections import defaultdict
from pathlib import Path
import numpy as np
import pandas as pd
from sklearn.metrics import average_precision_score, roc_auc_score, mean_absolute_error, r2_score
from tdc_constants import ADMET_AL... |
af419c49a74f7d4d08abbc594ac2ee751d909b0bd357570ea201d74adb8734d9 | Python | 4,040 | 82 | # @SNTService snt
# @UIService ui
"""
file: Fully_Automated_Tracing_Demo_(Interactive).py
author: Tiago Ferreira
version: 20260731
info: Exemplifies how to programmatically interact with a running
instance of SNT to perform automated (unsupervised) tracing
"""
from sc.fiji.snt.tracing.... |
5f995e10a89dd0517598bf2da3d07abb3029a8ceffab2a80d5c3d6960b4838b2 | Python | 4,041 | 110 | from pathlib import Path
import h5py
import numpy as np
import pandas as pd
import lightgbm as lgb
class HDFSequence(lgb.Sequence):
def __init__(self, hdf_dataset, batch_size):
"""
Construct a sequence object from HDF5 with required interface.
Parameters
----------
hdf_d... |
8e2d1327fe136fdf43aed8801af5f63ccecc0a2f003f5ee724df40510a129057 | Python | 4,041 | 128 | import json
import logging
from chemgraph.utils.logging_config import setup_logger
logger = setup_logger(__name__)
def get_workflow_from_log(file_path: str) -> dict:
"""Convert a run_logs file to a workflow dictionary for evaluations.
This function reads a JSON log file containing tool calls and their resul... |
d513de49e2e169ddfe08a81b547f7fd62bf16cc2904a629ea13a075d6b084ab7 | Python | 4,041 | 107 | """
Created on 2025.04.23
Updated on 2026.02.16
Author: Lina Jeantin
Code used to get useful information for plots and statistics, including:
- Patient IDs (extracted from recording names)
- Channel coordinates in the MNI space
Requirements:
ChannelInformation.csv : a csv file containing information about ch... |
f29e29bd724ece77aba3d70ae5c79e97abc6049727d6f5085b88bd7f278ae8ea | Python | 4,041 | 94 | # export.py
import argparse
import os
import torch
from networks.Unet import UNet3D
from networks.transunet import TransUNet3D
def _load_weights_safe(model: torch.nn.Module, ckpt_path: str) -> None:
state = torch.load(ckpt_path, map_location="cpu")
if isinstance(state, dict) and "model_state_dict" in state:
... |
8d26f4c408025b16fe120d8134a65d974d20a65be7d6238107e63e607a7afb09 | Python | 4,042 | 142 | # MIT License
# Copyright (c) 2023 Renaud Bastien
# 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,... |
4ac7fd9b3cffd950a70bd031bdc1a73b2315f9cf3f8e08936180a66db4a0d246 | Python | 4,043 | 129 | from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING, Union
from lightning.fabric import Fabric
from eir.experiment_io.experiment_io import (
LoadedTrainExperiment,
load_serialized_train_experiment,
)
from eir.models import model_setup
from eir.models.meta.meta import Me... |
56c10a890cb30dadc3ba7d0c4c9292bab33f0a9954365e2e557ba40dc836118b | Python | 4,043 | 78 | import numpy as np
auddur = 0.2
valvedur = 0.5
stimplotfns = {
'sound1': lambda timestamps,ax: [ax.axvspan(timestamp, timestamp + 0.2, **{'color': 'k', 'alpha': 1, 'lw': 0}) \
for timestamp in timestamps], \
'sound2': lambda timestamps, ax: [ax.axvspan(timestamp, ti... |
5fc02769a79b6a859851bd53bf6392f5f4f8e8b9fc411da3e7e948a36e533b1e | Python | 4,044 | 86 | import numpy as np
from collections import OrderedDict
from .base import TemporalContextInferencerBase
from brainscore_vision.model_helpers.activations.temporal.inputs.video import Video
from brainscore_vision.model_helpers.activations.temporal.utils import stack_with_nan_padding
class CausalInferencer(TemporalConte... |
6351ec01f61abfb69a529bb7de105f86a52d519e5d25c004c96b0e483b9791af | Python | 4,045 | 111 | # -*- coding: utf-8 -*-
# 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.f... |
7e303b30335e36db52613b68834bdcb3a942999b7faabe1c4efce1700f67a4ac | Python | 4,045 | 89 |
import numpy as np
import matplotlib
matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
import pathlib
from helper_functions.load_cell_distributions import compute_distribution
from helper_functions.cell_type_lib import CellType
if __name__ == '__main__':
matplotlib.rcParams.update({'font.size': 16})
sa... |
238f659843e0d6ae150977a9bb9fdad0f6df0a757b736c1f499be4c8be147afe | Python | 4,046 | 141 | #!/usr/bin/python
# -*- coding: latin-1 -*-
# =============================================================================================
# Librairies importation
import numpy as np
import nrrd
import sys
import os
# =============================================================================================
... |
8f50d38688dfb6744ffb2434e7fa07763c9674228952c3af246a95ca7e7c8648 | Python | 4,046 | 99 | import logging
from zigzag.classes.opt.temporal.loma.memory_allocator import MemoryAllocator
from zigzag.classes.stages.Stage import Stage
logger = logging.getLogger(__name__)
class TemporalOrderingConversionStage(Stage):
def __init__(
self, list_of_callables, *, accelerator, layer, spatial_mapping, **... |
2f2d227b076f897f2734437e5d3472c05947b4a4567292baf97fd8145aac51b1 | Python | 4,047 | 86 | """
(C) Copyright 2021 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
... |
913da4e7926d28717e0fc7681542ce009c10e8ca3635551f1278aee7a961fcc2 | Python | 4,047 | 74 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ara_explorer.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_ara_explorer(object):
def setupUi(self, ara_explorer):
... |
297968d0751848cb6066e88f6d9976904164867a1128d6987f0b07590321a5ec | Python | 4,050 | 104 | # /usr/bin/env python
import os
import utils as utils
from spaghetti import spaghetti_global as spaghetti
from spaghetti.mc_lif_group import McLifGroup
from spaghetti.poisson_pattern_group import PoissonPatternGroup
from spaghetti.rewiring_connection import RewiringConnection
from spaghetti.spike_monitor import Spike... |
2b42f0da4ac9011d9f0a94b64746a435cfd367e5b4c9e6391fa171aec89419c0 | Python | 4,051 | 112 | import random
from natsort import natsorted
import matplotlib.colors as mcolors
import matplotlib.cm as cm
import pandas as pd
from typing import List, Any, Tuple
from pathlib import Path
from bg_atlasapi import BrainGlobeAtlas
from napari.utils.notifications import show_info
def get_descendants(tgt_list: List[str], a... |
2f3cd9181dbfcf744a72eff5e9d3449e7af36c9328716b75245d28f4966b0baf | Python | 4,051 | 101 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Martin J. Kuehn
#
# 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 wit... |
daa709dd352fbc5da3334750d710c38ada3cca4bb06c5af2bd6f6e19cc3b9ed9 | Python | 4,051 | 101 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Martin J. Kuehn
#
# 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 wit... |
16f02253528de451a86c435e5b5e8e86013eb62c9f255b837ca0865bf18cd033 | Python | 4,053 | 121 | # %% ### import modules
from pathlib import Path
import seaborn as sns
import pandas as pd
import numpy as np
import bap1b.figures as figures
# %% ### set paths
data_dir = Path(__file__).resolve().parents[1] / "data"
results_dir = Path(__file__).resolve().parents[1] / "results"
# %% ### load data
df_results = pd.rea... |
1b490426927c1d5f0a46382943a2623a4dfc8792bdbc501379082ca39d85270a | Python | 4,053 | 102 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This script will smooth the streamlines, usually to remove the 'wiggles' in
probabilistic tracking.
Two choices of methods are available:
- Gaussian will use the surrounding coordinates for smoothing. Streamlines are
resampled to 1mm step-size and the smoothing is per... |
472d20106cb47a673c5ff05b81a98979e16e26d3a26aa1b4dfa5cbaaeb93732c | Python | 4,053 | 150 | # Copyright 2017 Calico LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
6814d4137987fa64665cf807ab7070849c9accb0abf730a20f8e7805bb1cfc7a | Python | 4,053 | 113 | import numpy as np
from scipy import ndimage as ndi
def normalized_integer_data(data):
# This function return a new array and does not alter the input outside the function
assert isinstance(
data, np.ndarray), 'The input data should be a numpy array'
data_type = data.dtype
if np.issubdtype(data... |
3d7268543c4ca53bdc6e1e14063b1c3576e1ec3a567f9862682700dac1e6d2b4 | Python | 4,054 | 149 | #!/usr/bin/env python3
import sys
import os
import subprocess
from optparse import OptionParser
###############################################################################
USAGE = """
make-colortrack-fordisplay.py --cn <depth file> --name <name for track/sample>
takes file of copy number in windows and makes... |
fdfc21d0767a8dad765590f079519df6983014545a209c740baf41e6c84ffb27 | Python | 4,054 | 110 | import os
import yaml
import torch
import random
import models
import argparse
import numpy as np
import torch.nn as nn
from utils.utils import *
from scipy.io import loadmat
import matplotlib.pyplot as plt
from torch.utils.data import Dataset, DataLoader
from torch.utils.tensorboard import SummaryWriter
... |
9dae61bad20d38dbc65eaa7d0fd4ac1512d4bf11115408672146b7cab0bd73a4 | Python | 4,055 | 152 | """
Provides functions for creating simple properties.
If, inside a class definition, you write:
attribute(foo=1, bar=2)
simple properties named 'foo' and 'bar' are created for this class.
Also, private instance variables '__foo' and '__bar' will be added
to instances of this class.
USEAGE:
# assumes attribute... |
a38bfd695318503fdcbe778d1aa643c3518f0e59152b5ab8cbbd4d203abd5e7c | Python | 4,057 | 120 | from __future__ import annotations
from collections.abc import Callable
from typing import TYPE_CHECKING, Any
from magicgui.types import FileDialogMode
from ._concrete import Dialog
from .bases import create_widget
if TYPE_CHECKING:
from collections.abc import Hashable, Iterable, Mapping
def show_file_dialog(... |
d9d51305a65790c05643b82e4f41b13b6e9e67076893e30ef4b09a2d415a2b44 | Python | 4,057 | 110 | import os
import h5py
import numpy as np
import pandas as pd
def get_targets(filename):
"""
Load the names of all the chromatin profiles predicted by Sei
"""
targets = []
with open(filename, 'r') as file_handle:
for line in file_handle:
targets.append(line.strip())
return ... |
19b63f0e976612b183fb3715e5e77c4eaec234f3c2abb31130a7b5fb5b6adb6c | Python | 4,058 | 122 | """Validated inputs for single-component H2O, CO2, and N2 gRASPA-SYCL runs."""
from pathlib import Path
from typing import Literal
from pydantic import BaseModel, Field, field_validator, model_validator
class SimulationCondition(BaseModel):
temperature: float = Field(
default=298.15,
gt=0,
... |
c759079c8c49431ca6b4ec1ad60b3e689bcf891990a2e91c933f70fdd56a02cf | Python | 4,060 | 120 | """Trains a VGG16 model on the CIFAR-10 dataset."""
import argparse
import torch
from torchvision import transforms
from torchvision.datasets import CIFAR10
from torchvision.models import vgg16
def train_vgg(
dataset_path: str,
model_path: str,
learning_rate: float,
batch_size: int,
number_of_ep... |
5e0227c0c275172753317b2cab34b719cec1d82fc00073b01bda853cd27dc44e | Python | 4,061 | 96 | import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
import seaborn as sns
from retinad.preprocessing import compute_missingness_by_category, extract_diagnosis
from scipy.stats import pearsonr, false_discovery_control
def feature_missingness_by_diagnosis(df: pd.DataFrame,
... |
4084ded120a38fc07d795ac26aab1a42fcadee12877438c61d20f1b6e9680fe3 | Python | 4,062 | 98 | import pandas as pd
import os
import subprocess
import time
from sys import argv
import argparse
import gzip
import sys
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--filedir', required=True, help="Path to input directory where the file GenomicRiskLoci.txt is located.")
... |
86f88e38af38a97e19eef41fc2429fe44f0e462235dac06d36ff60cd8c44558b | Python | 4,062 | 106 | 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:
... |
6df1e3c164e8f9b2137078e936e220be2cc6c8957d3fa3eccf8215abd0ffe885 | Python | 4,063 | 128 | """
This module contains functions to fit behavior models and plot the results.
"""
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from behavior.trial_info_utils import remove_params, plot_coefficients
import statsmodels.formula.api as smf
from pymer4.models impor... |
37745a3d21f3f790b16c2a95b1fee6d3869ddace2041cb8c97d2692415194557 | Python | 4,065 | 96 | import sys
sys.path.append("/LiNet")
sys.path.append("/YuSmith")
import torch
import argparse
import random
import os
import os.path as osp
import lib_alban.utils_train as utils_train
from torch.utils.tensorboard import SummaryWriter
parser = argparse.ArgumentParser()
# The locationi of testing set
parser.add_argume... |
be9ea1385c5c7e3de9ca2f8b5f25a0ed8f5c72c3afe382a943315569ce391971 | Python | 4,065 | 97 | import json
import pickle
from dataclasses import asdict
from pathlib import Path
from typing import Optional
import dacite
from packaging import version
import brainways
from brainways.project.info_classes import SliceInfo, SubjectFileFormat, SubjectInfo
from brainways.utils.io_utils.readers.qupath_reader import Qup... |
15b7ee039e1302cee6534410c0403ccdd1a648800bffaee335106fc5eecfac5e | Python | 4,066 | 123 |
"""
Read line data from a text file. This reader is very similar to sparse pointer reader.
The data format is:
lineseries_id,z_position,x_position,y_position\n
lineseries_id,z_position,x_position,y_position\n
...
No header.
The loader creates a list of lists, where all points within each list are linked.
All poi... |
10a30ec9b648c0d787af1f9731188268d60325016dc787500861f9ce49987ae9 | Python | 4,068 | 112 | from Bio import ExPASy
from Bio import SeqIO
import numpy as np
import csv
AA_LETTERS = sorted("ACEDGFIHKMLNQPSRTWVY")
# list all proteins in ecoli by uniprot_ID - aprse from .txt file
def download_aa_dist_per_gene(UPID_list_fname, cutoff):
UPID_list = []
for row in open(UPID_list_fname, 'r'):
if row:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.