sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
b19abd3498b2bb820e24584f3866836629b8b0ec2b710540e11d4fea4bf273c5 | Python | 4,427 | 92 | from __future__ import annotations
import json
import re
from pathlib import Path
import pandas as pd
from st_risk.models.base import BaseSpatialModelOutput
from st_risk.paths import current_results_dir, ensure_results_layout, resolve_results_file, results_file
CANONICAL_ABUNDANCE_FILENAME = "base_model_abundance_m... |
d0b0e05c0d5bd23c82f47af8508cc0dcb2e68bfec63c6d025d1da0e0c31fc5ed | Python | 4,430 | 86 | #!/usr/bin/env python3
"""O OCE preve a DENSIDADE DE ESTADOS? Pergunta inedita no projeto.
O registro tem uma pendencia declarada em varios lugares: **nenhuma densidade de
estados foi jamais ajustada com OCE em conjunto algum**. Agora ha o dado -- as
1.784 curvas de DOS das perovskitas SIESTA, calculadas dos .EIG e va... |
962a1d7e5018537c60f8d0ab0aa9b7ac854350352958eccc928a3bcc8604f790 | Python | 4,432 | 109 | import logging
from typing import Literal, Optional, Tuple, Union
import anndata
import numpy as np
from aestetik.utils.utils_clustering import clustering
from aestetik.utils.utils_grid import create_st_grid
logger = logging.getLogger(__name__)
def prepare_input_for_model(
adata: anndata.AnnData,
nCl... |
a43fd7249cc314cdc2a2e6d8602affa971bc013260b72992f89bd760dd49272c | Python | 4,435 | 147 | # scSGL - a python package for fene regulatory network inference using graph signal processing based
# signed graph learning
# Copyright (C) 2021 Abdullah Karaaslanli <evdilak@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... |
cbccb6890a97710bba2f236d0f089d57963df52fdab603d19796b34582999625 | Python | 4,435 | 143 | """Gold relation argument order versus candidate pair order.
A candidate pair carries its two candidate-set ids ascending, since that is the
order the pairing builds them in; gold arrives sorted lexicographically by
entity-ID string. The two disagree whenever the lexicographic order reverses the
order the two sets wer... |
424ac2777012dcb41b943135501e02ed1ad16f87135c23aab8dd4cbdf5f173cc | Python | 4,436 | 103 | import numpy as np
import pandas as pd
from pathlib import Path
# Define paths
base_dir = Path('/egor2/egor/MovieProject2')
task_name = 'tonotopy'
output_per_subject_csv = base_dir / "bids_data/derivatives/group_analysis/tonotopy" / f"{task_name}_per_subject_motion.csv"
output_mean_csv = base_dir / "bids_data/derivati... |
d88e5636ed35742d326f650cff42dec5979d7cba055145debe0de72a212c79b2 | Python | 4,436 | 124 | from __future__ import annotations
import logging
from typing import TYPE_CHECKING
from packaging.utils import canonicalize_name
from poetry.core.constraints.version import Version
from poetry.repositories.abstract_repository import AbstractRepository
from poetry.repositories.exceptions import PackageNotFoundError
... |
469e37eb2b9d4d6f8aa06f81df0f64137d8e397f4093f5cca7a18d651df52f26 | Python | 4,437 | 141 | # 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 argparse
import logging
import os
import numpy as np
import joblib
from examples.textless_nlp.gslm.speech2unit.clustering.utils impor... |
522567569506053b6e66aa36779bd017db821cb8c763de22488e35e983717ea1 | Python | 4,438 | 184 | class var_list:
#FROM BUTTONCLASS *********************************************************
#Main while loop condition
keepalive = True
#Stepper instances
APmove = None
MLmove = None
DVmove = None
# OFFSETS FOR THE DRILL, Syringe, Needle (minus values is back, left or up)
# in mm using the drill as ... |
7a5f0d73210d1d76c3e508aaa9f647c54292d000ba794a16c7968d93c7941082 | Python | 4,438 | 116 | import logging
import os
import time
import urllib
import numpy as np
from scvi.utils import track
logger = logging.getLogger(__name__)
# transient failures worth a fresh attempt: dropped/reset connections partway through a
# download, as opposed to e.g. a 404 which will never succeed on retry
_TRANSIENT_DOWNLOAD_E... |
9970a274ccbb93f5793277d2fbd2afd24c52be7b8e908c40332826584aab1eb9 | Python | 4,438 | 134 | from __future__ import annotations
from collections import defaultdict
from typing import TYPE_CHECKING
from cleo.helpers import option
from packaging.utils import NormalizedName
from packaging.utils import canonicalize_name
from poetry.console.commands.command import Command
from poetry.console.exceptions import Gr... |
f9f25982cd0760f4e589b3562fd3ee27834a2cbd910623787f8253019223ce04 | Python | 4,439 | 125 | import os
from typing import Optional, Any
from collections import defaultdict
from simulation_encoder.logger import Logger
from simulation_encoder.loaders.loader import Loader
class GastruloidLoader(Loader):
"""
Loader class for loading labeled images from a directory.
Parameters
----------
ima... |
e562298bc12ec1b81013052ad58c308577c3837ebace220d811543061817c295 | Python | 4,440 | 136 | import os
import glob
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
base_directory = '/mnt/md0/data'
mice = ['392810', '405755', '448504', '407972', '444384']
def load(directory, file):
return np.load(os.path.join(directory, file))
def read_template_ratings_file(filename):
qualiti... |
4b08e2c0f4fe588010593517667176c3cc8b7b666092f898ab4565118dfc1dca | Python | 4,442 | 138 | # 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.
"""isort:skip_file"""
import argparse
import importlib
import os
from fairseq.dataclass import FairseqDataclass
from fairseq.dataclass.utils ... |
3bce2b57f6beb94f85343e36a9e7a4cbb3826e19430dcb36cc27e4201f13252e | Python | 4,445 | 80 | # Examples:
# python sumstats_ldsc_helper.py annot PGC_SCZ_2014.csv PGC_SCZ_2014_ldscores/{}.annot.gz --annot 1000G_Phase3_baseline_ldscores/baseline.{}.annot.gz
import pandas as pd
import numpy as np
import os.path
import sys
import argparse
from intervaltree import IntervalTree
def parse_args(args):
parser = ... |
88728fb79b203dc12ac8085d812b2a172cc53e0d78943130220a0c195ddf2a50 | Python | 4,446 | 117 | # -*- coding: utf-8 -*-
"""
Created on Wed May 3 19:44:36 2023
@author: LiangYinLu
"""
## VTA decoding
# In[] Import packages
import numpy as np
import time
import os
import HappyML.preprocessor as pp
from HappyML.preprocessor import PCASelector
from HappyML.preprocessor import KBestSelector
from Happ... |
06c7f494c1fac4b9326609149c978cfebb048046404f7eaf82af50cd1e772dd6 | Python | 4,448 | 149 | # 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
import torch.nn.functional as F
from torch.nn.modules.conv import _ConvNd
from torch.nn.modules.utils import _pair
from ..ops im... |
ef2771911c01815c4cc0d1c03067d8386b3746e7abb0616bb25c596997f9256c | Python | 4,449 | 144 | from utils import *
import tensorflow as tf
flags = tf.app.flags
FLAGS = flags.FLAGS
# global unique layer ID dictionary for layer name assignment
_LAYER_UIDS = {}
def get_layer_uid(layer_name=''):
"""Helper function, assigns unique layer IDs."""
if layer_name not in _LAYER_UIDS:
_LAYER_UIDS[layer_n... |
23ee410ac17e024d389b91f9e5309dcd325d4eb6ab830f89bfff1c610185b0fe | Python | 4,451 | 121 | # 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 inspect
from typing import Any, Dict, List
from fairseq import utils
from fairseq.logging import metrics
from fairseq.dataclass import... |
1261093510af0dfaa03961a07ac0f682ceef5f1b953ac9e87f25d00ae84d14a3 | Python | 4,454 | 140 | """
LSTM-based neural forecaster and inference wrapper for fMRI ROI windows.
``AdvancedLSTM`` is the trainable model used by ``utils.training.run_loso_cv``.
It consumes normalized sliding windows shaped ``(N, M, ROI)`` and predicts the
next ``H`` ROI frames shaped ``(N, H, ROI)``. ``FmriPredictorAPI`` is a
sklearn-com... |
6237de8bcb4630f2eafdc07a1240a72415123be3538bded6f34bfdb1ec6b9f10 | Python | 4,456 | 148 | """functions for plotting annotations for vocalizations"""
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.collections import LineCollection
def plot_segments(onsets, offsets, y=0.5, ax=None, line_kwargs=None):
"""plot segments on an axis.
Creates a collection of horizontal lines
with... |
0fa95956c77b9840246bc5fb7fcd5a93fac5496ccd24b122f73eccccaef942ea | Python | 4,457 | 128 | import numpy as np
import pandas as pd
import pytest
from pgmpy.utils import (
build_state_names,
collect_state_names,
encode_columns,
get_state_counts,
get_state_counts_array,
)
@pytest.fixture
def dataset():
return pd.DataFrame(data={"A": [0, 0, 1], "B": [0, 1, 0], "C": [1, 1, 0], "D": ["X"... |
8d35e6679e02eb7cddbe353d0ed3587dd4c3d500577f7949bdd6d5fbc8d5af22 | Python | 4,458 | 84 | #!/usr/bin/env python3
"""R1 ponto 3: refaz a Fig. 1(a) com MAE e R^2 ao lado do RMSE.
Copia fiel de `fig_manuscrito.py` no que produz os pontos -- mesmo GroupKFold, mesma
grade de alpha, mesma normalizacao -- para que a figura nao mude de valor, so de
anotacao. As tres medidas sao a MEDIA SOBRE AS DOBRAS, que e a con... |
9ac70fbffcafdd263e16581af95dbeb31879d1bbb974265366614f4cd0afa89a | Python | 4,460 | 116 | import pandas as pd
import logging
import gzip
import shutil
import requests
from pathlib import Path
from typing import List
from src.data.manager import DatasetManager
log = logging.getLogger(__name__)
class BioLiPManager(DatasetManager):
def __init__(self, filepath: str="data/BioLiP/BioLiP.txt"):
""... |
c1197a9773b890336780ea1bf9385bc99791853d86a2ff51eb71c7bfaf49e9f8 | Python | 4,461 | 142 | from math import lgamma
import numba
import numpy as np
from scipy.special import gammaln, psi
@numba.jit("float32(float64[:], float64[:])", nopython=True, cache=True)
def kullback_leibler(pk: np.ndarray, qk: np.ndarray) -> float:
N = pk.shape[0]
pk = pk / np.sum(pk)
qk = qk / np.sum(qk)
vec = np.zeros(N)
for i... |
4ad9db2e62c45c715609a9bb5d0a1305a611034b7e6b73c7afe940b5726506a5 | Python | 4,462 | 109 | import numpy as np
from anndata import AnnData
def _rot(t, u=1):
if u not in [-1, 1]:
raise ValueError("u must be -1 or 1")
return np.array([[np.cos(t), np.sin(t) * u], [-np.sin(t), np.cos(t) * u]])
def rotate_decipher_components(
adata: AnnData,
v_obsm_key: str,
z_obsm_key: str,
v1_... |
a404b38700f7179d915df31562eaa178de82800a966b35e5fbcb5de5b0567c06 | Python | 4,464 | 118 | from cellpose import models, core, io, plot
import nd2
import matplotlib.pyplot as plt
import tifffile
import numpy as np
from pathlib import Path
from tqdm import tqdm
import pandas as pd
from cellpose import core, models
import torch
from skimage.measure import regionprops_table, label as sk_label
# This script proc... |
be34525b3188d2655ed2be2eb1379ac0ddc2efae07ddbee7a6a0bdeaa88d520f | Python | 4,468 | 118 | # 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 logging
from typing import Dict, Optional
from fairseq.incremental_decoding_utils import with_incremental_state
from fairseq.models im... |
4c9294249445ab054e0670d2f28856a7158b47b53873db088382ccd70fef9191 | Python | 4,469 | 83 | import argparse
from typing import Union
from batchgenerators.utilities.file_and_folder_operations import join, isdir, isfile, load_json, subfiles, save_json
from nnunetv2.imageio.reader_writer_registry import determine_reader_writer_from_dataset_json
from nnunetv2.paths import nnUNet_preprocessed, nnUNet_raw
from nn... |
7789b6bc98e7764ba2d6a67dfb7cb564fe84f877bae0ee8b956a2b98b57c91a0 | Python | 4,471 | 142 | import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
warnings.filterwarnings("ignore", category=FutureWarning)
import torch
from scipy.stats import norm
import pandas as pd
from scipy.special import softmax, expit
import numpy as np
def accuracy(output, target, topk=(1,)):
"""Computes the... |
725850c9866ae6692e62a0652f8a14ca56fb52fd641d673d19d7c0f58a5fe300 | Python | 4,472 | 119 | # -*- coding: utf-8 -*-
"""
Created on Wed May 3 19:44:36 2023
@author: LiangYinLu
"""
## DCN decoding
# In[] Import packages
import numpy as np
import time
import os
import HappyML.preprocessor as pp
from HappyML.preprocessor import PCASelector
from HappyML.preprocessor import KBestSelector
from Happ... |
b21bb84969b80c764a3b7b2af5dcd414e37d0deee7d47630296b01880768a816 | Python | 4,473 | 112 | from cellpose import models, core, io, plot
import nd2
import matplotlib.pyplot as plt
import tifffile
import numpy as np
from pathlib import Path
from tqdm import tqdm
import pandas as pd
from skimage.measure import regionprops_table, label as sk_label
# This script processes a folder of .nd2 files by applying Cellpo... |
c99c9758a2e3c7f8985f7da4f7c22527c7aee853c96ea0c91e9c79e2e5a8e9fd | Python | 4,473 | 127 | import os
import torch
from chroma import Chroma, Protein, conditioners
from .pdb_processing import fix_pdb
def _get_chroma_weights():
"""Resolve Chroma weight paths from .env or local chroma_weights/ directory."""
from dotenv import load_dotenv
load_dotenv()
backbone = os.getenv('CHROMA_WEIGHTS_BACK... |
520d7192788dea773dcd2b8c71a4ca172f0bbba8d3e9e98c62ab4c68a1c3be9a | Python | 4,477 | 132 |
import gzip as gzip_module
import logging
import numpy as np
import os
import pandas as pd
import pathlib
import shlex
import shutil
import subprocess
import sys
from mentor import _metrics as metrics
LOGGER = logging.getLogger(__name__)
def rwr_singletons(
data = None,
geneset = None,
outdir = None,
... |
9bc81895f3e45f8c93453e30dffca575cc97a1bf21798ca99ad8140793e8f0fd | Python | 4,477 | 129 | # tests/conftest.py
# -*- coding: utf-8 -*-
import pytest
import os
import shutil
import json
from pathlib import Path
import yaml
@pytest.fixture(
scope="function"
) # Use "function" scope for clean state per test
def mock_bids_root(tmp_path_factory):
"""Creates a mock BIDS dataset in a temporary directory ... |
1e13992b072f98e719c7ceac93b6ac900ac2be60a3e1609bb5bf51834c1bc117 | Python | 4,478 | 133 | import haiku as hk
import jax.numpy as jnp
from haiku.initializers import VarianceScaling
from jax import tree_util
from jax.nn import softplus
def ssp(x):
r"""
Compute the shifted softplus activation function.
Computes the elementwise function
:math:`\text{softplus}(x)=\log(1+\text{e}^x)+\log\frac{1... |
e4bace5b55d5bf913a0873db7f810b11ab65906bf5ff635b57e6e8794183797b | Python | 4,478 | 149 | """
This module contains a gravity sensor class to recieve and save sensor data.
"""
import csv
import time
from Sensors import constants
import os
import threading
from queue import Queue
import serial
from datetime import datetime
from pathlib import Path
class GravitySensor:
"""
Class to handle measur... |
cbe97814f1e5ad68cf43bd38af7444e827923ec60878a927035cf223ada8e6ca | Python | 4,479 | 90 | import os
import warnings
import argparse
warnings.filterwarnings("ignore")
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import logging
import pandas as pd
from tqdm import tqdm
from sentence_transformers import SentenceTransformer
from generate_embeds.datamodule import CustomDataset
from generate_embeds.run import gener... |
b4dd1046a9617f258cff1ffdbc8282a2ddb404952a725d9039c3d5d5ab1b287f | Python | 4,483 | 148 | import gc
import random
from keras import backend as K
import tensorflow as tf
from image_utils.data_loader import *
from image_utils.ensemble import combine_masks_union, combine_masks_soft_voting
from image_utils.image_utils import *
from image_utils.metrics import iou_tf, dice_tf
from model.dilated_unet import dila... |
f9e739fd37580fe34df4de001296b2488b7cdfba0023782fa6c7659826d46110 | Python | 4,485 | 140 | #!/usr/bin/env python
# Author_and_contribution: Niklas Mueller-Boetticher; created template
# Author_and_contribution: Kirti Biharie; added dataset
import argparse
parser = argparse.ArgumentParser(description="Load data for Stereo-seq liver")
parser.add_argument(
"-o", "--out_dir", help="Output directory to wr... |
bbc85fcef447081e4418208c4e775f672cd9e53e65582bf6b06d053c1257f005 | Python | 4,490 | 116 | from ... import options as opts
from ... import types
from ...charts.chart import RectChart
from ...globals import ChartType
class Boxplot(RectChart):
"""
<<< Boxplot >>>
A box-plot is a statistical chart used to show a set of data dispersion data.
It displays the maximum, minimum, median,... |
171e9c3cdbf502541f3e7204eb88231974c0c8b6d4dce505b1640659468b2d22 | Python | 4,492 | 144 | from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
import tomlkit
from poetry.config.config_source import PropertyNotFoundError
from poetry.config.file_config_source import FileConfigSource
from poetry.toml import TOMLFile
if TYPE_CHECKING:
from pathlib import Path
def test_fil... |
4050c8a93a6d094937b1da197dfe5d2378ab4eef301a77b9ed826b0635556d90 | Python | 4,492 | 131 | import math
import numbers
from typing import Optional
import numpy as np
from fairseq.data.audio.feature_transforms import (
AudioFeatureTransform,
register_audio_feature_transform,
)
@register_audio_feature_transform("specaugment")
class SpecAugmentTransform(AudioFeatureTransform):
"""SpecAugment (http... |
daf0c2452e64aeba9ef56d62197725edbbd230ce93895c6d4f7849a2b003bafd | Python | 4,493 | 126 | # 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 List
import torch
import torch.nn as nn
class Conv1dSubsampler(nn.Module):
"""Convolutional subsampler: a stack of ... |
33d661bf895b93026e461b1a775ea376ec38fc5712a15945f8c9b6f83bbf7201 | Python | 4,495 | 142 | """Split the pandoc-generated guide_raw.rst into per-chapter Sphinx RST files."""
import re
from pathlib import Path
RAW = Path(__file__).parent / "guide_raw.rst"
OUT = Path(__file__).parent / "source"
lines = RAW.read_text(encoding="utf-8").splitlines(keepends=True)
# --- Locate substitution definition block at th... |
a5b8b61ac525b65216d9e36631d1ce8574d3c8d2dc0b44b9370dd69bebbb5528 | Python | 4,495 | 99 | # -*- coding: utf-8 -*-
"""
Parcellate volumetric PET images using the Brainnetome atlas (bn246).
Author: Yuan Zhang
Date: 2025-07-25
This script:
1. Loads a set of PET NIfTI images (neurotransmitter receptor maps).
2. Uses neuromaps' Parcellater to map (parcellate) these volumetric images
into 246 regions of... |
e9020b7daa434bd3ae97aa07a73ade176e3a86f089e6eb0af297e6b709950985 | Python | 4,495 | 124 | """
Utility helpers for maintaining an exponential moving average (EMA) of model parameters.
EMA smoothing can stabilise validation metrics and give a small boost in final
performance, especially when training lightweight students with knowledge
distillation. The implementation is intentionally lightweight and keeps a... |
e9648730b3c11003981897df450b47d8cef775563544d0bd723d787c52b9b00a | Python | 4,495 | 118 | #!/usr/bin/env python
import argparse
import os
import sys
from pathlib import Path
import anndata
import json
import gdown
import pandas as pd
import scipy
import shutil
import tempfile
def convert_data(out_dir):
# TODO: Add downloader as soon as data is published on zenodo.
# THIS IS A PRELIMINARY LIN... |
fc1bdd21b93924af6d949af3e7f6373c73abc01a15051b30aaa9c798747c4364 | Python | 4,495 | 128 | import os
from typing import Tuple
# disable numpy multithreading
os.environ["OMP_NUM_THREADS"] = "1"
os.environ["MKL_NUM_THREADS"] = "1"
os.environ["NUMEXPR_NUM_THREADS"] = "1"
os.environ["OPENBLAS_NUM_THREADS"] = "1"
os.environ["VECLIB_MAXIMUM_THREADS"] = "1"
import numpy as np
from sklearn import cluster
from volu... |
0edec9b8744d13aee23da1e0c7809d519291dc9e03f77d51b4bb33a7f031c9bc | Python | 4,496 | 124 | from fitter import Fitter
import scipy.stats as stats
import numpy as np
import pandas as pd
from .figure_Tools import Subtypes, Subtype_colours
class DistributionFitter:
def __init__(self, df, DV_col, isExternal, xmin, xmax, n_bins, progress=False):
"""
Core class to fit distributions to subsets... |
0441e1308af94488108c50ca5999b1a4afa8a5490464d5de43a5b8c1e167d3b9 | Python | 4,499 | 124 | from fitter import Fitter
import scipy.stats as stats
import numpy as np
import pandas as pd
from .figure_Tools import Subtypes, Subtype_colours
class DistributionFitter:
def __init__(self, df, DV_col, isExternal, xmin, xmax, n_bins, progress=False):
"""
Core class to fit distributions to subsets... |
56c822b45cd7e3d0819c1ad8e406a9c203324369c0b4bbc25303d5dab198d450 | Python | 4,502 | 111 | from typing import Tuple, Union, List
from batchgenerators.utilities.file_and_folder_operations import save_json, join
def generate_dataset_json(output_folder: str,
channel_names: dict,
labels: dict,
num_training_cases: int,
... |
e8e1ba90680df93e64c95f0e7381adc59ff9adc1269a33ad3eb5b248cad595c5 | Python | 4,502 | 99 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------------------------------------------------
# Author: Lalith Kumar Shiyam Sundar
# Institution: Medical University of Vienna
# Research Group: Quantitative Imaging and Medical Physics (QIMP) Team... |
f03812a67ce704379acb8ee47e30238012acef46ecb0351f8e895b35a2112de0 | Python | 4,502 | 124 | from fitter import Fitter
import scipy.stats as stats
import numpy as np
import pandas as pd
from .figure_Tools import Subtypes, Subtype_colours
class DistributionFitter:
def __init__(self, df, DV_col, isExternal, xmin, xmax, n_bins, progress=False):
"""
Core class to fit distributions to subsets... |
97a7ce36342a12d2bf54e5bcd5d9dd8543cc3b3a00127858c5eaaef277ebbe7f | Python | 4,505 | 104 | import numpy as np
import pandas as pd
from pathlib import Path
# Define paths
base_dir = Path('/egor2/egor/MovieProject2')
task_name = 'retinotopy'
output_per_subject_csv = base_dir / "bids_data/derivatives/group_analysis/retinotopy" / f"{task_name}_per_subject_motion.csv"
output_mean_csv = base_dir / "bids_data/deri... |
8ace597322bbd6007b2248e5e7390f8eb52e23d74f5491d0460a7079f17a037e | Python | 4,508 | 134 | import datetime
import random
import unittest
from unittest.mock import patch
from pyecharts import options as opts
from pyecharts.charts import Calendar
class TestCalendarChart(unittest.TestCase):
@patch("pyecharts.render.engine.write_utf8_html_file")
def test_calendar_base(self, fake_writer):
begi... |
1155a3725949396dc1b441c7acfa1e393b839e45364559889ba3eef2df6bf528 | Python | 4,511 | 149 | import numpy as np
import pandas as pd
import npyx
from npyx.c4 import fast_acg3d
from concurrent.futures import ThreadPoolExecutor, as_completed
from celltype_ibl.utils.preprocess import align_singleCH_spikes
from celltype_ibl.params.config import ULTRA_DATA_PATH
from pathlib import Path
import pickle
from tqdm impor... |
cd685564a1a2cf286e8d49f1607bac62c99a9e529c3477ac80b988a5f895c158 | Python | 4,512 | 86 | import tkinter as tk
from tkinter import ttk
class StaticInputsFrame(ttk.Frame):
def __init__(self, parent, width=None, save_inputs_callback=None, **kwargs):
"""
Initialize the StaticInputsFrame.
Parameters:
- parent (tk.Tk|tk.Frame): The parent widget.
- width (int... |
33b20e60c42dedabf7b357666cf78870ea8d668cdefc48e853e7a7959d7d1ae3 | Python | 4,515 | 124 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import argparse
import pandas as pd
import sys
WORKDIR_ROOT = os.environ.get('WORKDIR_ROOT', None)
if WORKDIR_ROOT is None or n... |
ada38aa52090a4fa775205b1e905805e4dd62d0a12a5ed7991eafb010998fe08 | Python | 4,517 | 127 | # -*- coding: utf-8 -*-
import os
import gc
import argparse
import json
import random
import math
import random
from functools import reduce
import numpy as np
import pandas as pd
from scipy import sparse
from sklearn.model_selection import train_test_split, ShuffleSplit, StratifiedShuffleSplit, StratifiedKFold
from sk... |
8dee7a5c17db655493e42180cb769c533336ca00a45429a77ce87c51f0c3f3f6 | Python | 4,518 | 119 | """Transferability test: train OCE on small (≤5 heavy atoms) molecules,
predict on larger (6+ heavy atom) isomers. This tests the additivity
property of the cluster expansion — whether J_F learned locally still
ranks bigger structures correctly."""
from __future__ import annotations
from collections import defaultdic... |
75acf61854066bce21a1cc421e7e80a6fe77296dbe4bc2bf92d40486d4cd9032 | Python | 4,523 | 112 | # %%
"""Mechanism check across training conditions (Reviewer 1, point 6).
To support the interpretation that MI minimization reduces inter-subgroup
dependence (and thus cross-talk), this script aggregates, per condition, a set
of mechanism indicators over the accepted models:
* inter_subgroup_corr: mean absolute corr... |
07f27105cf6251a1cf2cfcad22445008b9ee1039d63b6c5ab2f10eb6fd535c8e | Python | 4,524 | 147 | """Parametric UMAP loss function."""
from __future__ import annotations
import warnings
import torch
# isort: off
# Ignore warnings from Numba deprecation:
# https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit
# Numba is required by UMAP.
f... |
95fbb579670e0a1dfa7b213bb6926cc56fb1810e5545ac4551bc0f1f55365423 | Python | 4,524 | 143 | # %%
# pylint: disable=C0103
"""
This script will get the ictal clips from the iEEG data and save them in BIDS format in the common data folder.
Run on February 27, 2023 by Akash Pattnaik on pioneer server.
Rerun on March 21, 2023 by Akash Pattnaik on pioneer server to include 30 seconds preictal
"""
# ... |
f0a22856f88f316ac379ba845ece26fede82eca1da2e8eef60aed73520e82bc6 | Python | 4,525 | 145 | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 23 08:12:43 2023
@author: Sen
"""
#%%
import os
import argparse
import shutil
import logging
from openbabel import openbabel
parser = argparse.ArgumentParser()
parser.add_argument('-d', type=str, default=None, help='Input the dirpath')
args = parser.parse_args()
dirpath... |
b543038d1c6374b17b5f6491ab60d023739e897e52ecfd18f15c21e9f229ab00 | Python | 4,527 | 137 | import logging
import jax.numpy as jnp
import kfac_jax
from jax import vmap
__all__ = ["make_graph_patterns"]
log = logging.getLogger(__name__)
class DenseBlock(kfac_jax.DenseTwoKroneckerFactored):
r"""
Modification of the kfac_jax dense block.
Expand the input to include batch dimension, if necessary... |
1b83d9f7eea00958f7ad34fa093ca85e314e43a8208a0f12a99664d81f52eae7 | Python | 4,528 | 141 | """
VTK read/write filters for Gifti (.surf.gii).
"""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
from vtk import vtkPolyData
from vtk.util.vtkAlgorithm import VTKPythonAlgorithmBase
from ..decorators import wrap_input
from ...mesh.mesh_creation import build_polydata
try:
imp... |
ab31fedf84ea3c0efbe98408895bfadd27d84653aec49887db1df29cbc6c8661 | Python | 4,528 | 135 | # Copyright 2015 Google Inc. 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 law or a... |
8ceb1e3083c4b6e174c290565955b46f85accfd979b99a8f6b4e36800bce24c7 | Python | 4,529 | 126 | # -*- coding: utf-8 -*-
""" Sample Application of Cellular Automata Tractography on a Human Connectome Project Subject.
Copyright (C) 2019 Andac Hamamci
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free So... |
23c0090d9adbec50fdbd067dc745ca08d26f4986530c0b1724457aa2b30581b6 | Python | 4,532 | 106 | from anarci import anarci
import numpy as np
def renumber_pdb(pdb_path, output_path, mhc_class=1):
import MDAnalysis as mda
'''
This function takes a pdb from tcrmodel output and renumber the residues according to the AHO numering scheme
'''
#load pdb
pdb_u = mda.Univ... |
a6844213ed355a707cf64f5542e0c127fc452768abb2a3d5f1bae63ab0a51995 | Python | 4,532 | 151 | from tqdm import tqdm
from pathlib import Path
from typing import Optional, Union
from anndata import AnnData
import os
from model.cancergpt import CancerGPT
from model.data_collator import DataCollator
from model.dataset import Dataset
from .utils import load_pretrained
from model.vocab import GeneVocab
import scanpy... |
e9f5e974f11746bade53daeadbd28cd4f587136031ab3636b7c1bfafc1ef6aa0 | Python | 4,532 | 117 | from typing import Callable, List, Optional
import numpy as np
import torch
from pytorch_grad_cam import GradCAM
from pytorch_grad_cam.utils.model_targets import FinerWeightedTarget
DEFAULT_COMPARISON_CATEGORIES = (1, 2, 3)
class FinerCAM:
def __init__(
self,
model: torch.nn.Module,
ta... |
566259b93ab388672658705ff851ab3bac6ee971753bb1cd02600dadaafb3c6e | Python | 4,534 | 147 | """
Run pyLossless on a BIDS dataset.
=================================
In this notebook, we will run the pyLossless pipeline on a publicly available dataset.
"""
# %%
# Installation (in the terminal or through Jupyter)
# -------
#!pip install -q pylossless
#!pip install -q openneuro-py
# %%
# Imports
# -------
fr... |
4b9d5c0f4e1b556084109311d156bee6d781968dc5b1dfdc8702364508f1dd43 | Python | 4,536 | 100 | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
d05925b7e1263a4cf7d5280bf2654a704f5344956e097d6f9b085335c6b3f355 | Python | 4,536 | 125 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from functools import partial
from typing import Dict, Literal, Optional, Protocol, Tuple, TypeVar
import torch
from mattergen.diffusion.corruption.multi_corruption import MultiCorruption, apply
from mattergen.diffusion.data.batched_data import... |
867c9d60960dc507be37d6d6877712493cd0e15e7e09385bae3a4d9d32f1dbf3 | Python | 4,538 | 115 | """Helper functions for `vak.prep.dimensionality_reduction` module
that handle array files.
"""
from __future__ import annotations
import logging
import pathlib
import shutil
import pandas as pd
logger = logging.getLogger(__name__)
def move_files_into_split_subdirs(
dataset_df: pd.DataFrame, dataset_path: pat... |
1e9efe00e21cd58208e7b8cfc8daf3a9ac861758502128f15bf873573ebc1d30 | Python | 4,540 | 134 | #!/usr/bin/env python
# ENCODE DCC MACS2 call peak wrapper
# Author: Jin Lee (leepc12@gmail.com)
import sys
import os
import argparse
from encode_common import *
from encode_common_genomic import peak_to_bigbed, peak_to_hammock
from encode_blacklist_filter import blacklist_filter
from encode_frip import frip
def par... |
77d7bed099af544049b4fdd6d7ec6d64746028dc156dfb7b76a5396e1edfbf52 | Python | 4,540 | 118 | import numpy as np
import pytest
from moove.utils.training_utils import (
augment_spectrogram,
add_noise_to_spectrogram,
frequency_mask,
time_mask,
dynamic_range_compression,
DEFAULT_AUGMENTATION_PARAMS,
)
@pytest.fixture
def sample_spectrogram():
np.random.seed(0)
return np.random.ran... |
cfac867d8a0f79929cda1cbcd707b2981b202a877429c27d43ae023eefc192c3 | Python | 4,540 | 106 | import tensorflow as tf
from keras.models import load_model
import keras_infmodules as kq
import tensorflow_model_optimization as tfmot
from keras import backend as K
import keras
from keras import activations
def relu_advanced(x):
# weight clipping for ReLU
return K.relu(x, max_value=1)
mtype = 'lenet'
lr = ... |
e5095dabf12ac5d8f2ff6f7f9dd53ef15f44a6a1ab188fb7c8aff1f86d36899c | Python | 4,545 | 137 | from functools import partial
from typing import Callable, Protocol
import jax
import jax.numpy as jnp
from . import geom
from .molecule import MolecularConfiguration
from .types import ElectronConfiguration, Energy, RandomKey, Stats
__all__ = ()
class Laplacian(Protocol):
def __call__(self, rng: RandomKey | N... |
a98e0059f772332ec49b1dcfb4b4aea7a0ec9f393f81321afa9c5a09149634d2 | Python | 4,548 | 139 | #!/usr/bin/env python
import urllib.request
from urllib.parse import urlparse
import os
import anndata
import argparse
import shutil
import pandas as pd
import scipy
import json
import tempfile
# 6 available but only 2 contain region label and coordinates
sample_name = ['E14-16h_a','L3_b','L1_a','L2_a','E16-18h_a']
... |
56568d7a5a60d1998e0b47505d2216bb8713c7748ad4d3180c0310d035125c52 | Python | 4,550 | 120 | from collections.abc import Hashable
from math import lgamma, log
import numpy as np
from scipy.special import gammaln
from pgmpy.structure_score.bdeu import BDeu
from pgmpy.utils import get_state_counts_array
class BDs(BDeu):
r"""
BDs structure score for discrete Bayesian networks.
BDs is a sparse-dat... |
927d68ca6a3506e79344bffdbcb0538a2903333e27fde2429cc69531f8588e50 | Python | 4,550 | 197 | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 23 18:31:14 2025
@author: hanna
"""
import pandas as pd
import numpy as np
from scipy import stats
from scipy.optimize import curve_fit
def stats_star(p, trending=True):
if trending == True:
if p < 0.001:
star = '***'
elif (... |
c80455c881a1529431a1c85cdd668cd52c5bd23d37db82d3eb7321a45730f9c1 | Python | 4,550 | 132 | #!/usr/bin/env python3
"""Verify that each ExperimentConfigs preset matches its documented ablation schema."""
import pytest
from hippie.multimodal_model import ExperimentConfigs
# Expected feature values for each named configuration (the ablation ladder).
EXPECTED_CONFIGS = {
"baseline": {
"use_source_... |
0b128869b991a3ad99260b2390e36ea431eac20dc9d6b8449f9c2b0dfa1a7258 | Python | 4,551 | 145 | # 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 io
import os
import string
import tempfile
import unittest
import torch
from fairseq import tokenizer
from fairseq.data import Diction... |
16ce71debc39debdb71201f81fa2c05067367a8f98825b3698d12f597b747e0a | Python | 4,551 | 109 | #!/usr/bin/env python
"""
Example: Getting all descendants with relationships (part_of, regulates, etc.)
This example demonstrates how to get all descendants of a GO term including
those connected through optional relationships like 'part_of' and 'regulates'.
The functionality already exists in GOAtools - you just ne... |
1b8ef81e1fa802e95272146d5875ac62d53beade6b739a558ef4dec7eda61b1a | Python | 4,552 | 122 | # @license
# Copyright 2016 Google Inc.
# 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... |
1dab0d296f297a109351b3ce88c3aa759fd04cf9af5730a92e1fbc8fcf5a2cbf | Python | 4,552 | 119 |
try:
from importlib.metadata import version
except ModuleNotFoundError:
from pkg_resources import get_distribution
version = lambda name: get_distribution(name).version
from train import fit_model
from pre import prediect
import os
# name = "TOSICA"
# __version__ = version(name)
def ... |
5f5504b40b95a87f059346d1da0131980e1abd5e576338fb673f400b6d8151c5 | Python | 4,556 | 131 | # Copyright 2021 DeepMind Technologies Limited
#
# 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 agr... |
bfe0ad87d23822e7e3fbaa0ec4e16f7b73104f33e2c943bf06e7499a80e97b6f | Python | 4,556 | 125 | """
Node-level encoder: computes independent latent variables for each cell in the point cloud
Inputs: Original point cloud X [Batch Size, N, F] (F = expression + coordinates)
Output: Node-level latent variables Z_nodes [Batch Size, N, d_node]
"""
import torch
import torch.nn as nn
from linear_attention_transformer imp... |
de013911a487343b8e11cd16723f3b98bdd04870ce9f34e4da3dda0a90450ac6 | Python | 4,556 | 140 | from __future__ import annotations
from contextlib import suppress
from functools import cached_property
from typing import TYPE_CHECKING
from requests.exceptions import ChunkedEncodingError
from requests.exceptions import ConnectionError
from requests.utils import atomic_open
from poetry.utils.authenticator import ... |
66f4e2bba8544f38f1b7d842017e436095b115acc7adc7de5354d94d18a27449 | Python | 4,559 | 129 | import unittest
from unittest import mock
from GMXMMPBSA.utils import PB_INP1_DEFAULTS, PB_INP1_NONPOLAR, sync_pb_nonpolar_for_inp
try:
from GMXMMPBSA.createinput import SanderPBSAInput
except ModuleNotFoundError as exc:
if exc.name and exc.name.startswith('parmed'):
SanderPBSAInput = None
else:
... |
0e5298597015463721011715e4f3ddfd22a52dfcb02e93449ab20297954747b4 | Python | 4,560 | 120 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from batchgenerators.transforms.abstract_transforms import AbstractTransform
def augment_linear_downsampling_scipy(data, zoom_range=(0.5, 1)):
"""
Downsamples each sample (linearly... |
c10bb6f92756ed16eac47f366080d18376283c747cc702770b1d6f03b544ef3c | Python | 4,560 | 96 | import os
import types
import unittest
import warnings
import parasail
import pytest
import medaka.align
from medaka import smolecule
root_dir = os.path.abspath(os.path.dirname(__file__))
test_fasta = os.path.join(root_dir, 'data/smolecule.fasta')
test_mfasta = os.path.join(root_dir, 'data/smolecule_multi.fasta')
c... |
9e7778809f741287add777bb6b790e3d76d4df12dafebd727493c264252e0656 | Python | 4,563 | 119 | import unittest
from unittest.mock import patch
from pyecharts import options as opts
from pyecharts.charts import Parallel
class TestParallelChart(unittest.TestCase):
@patch("pyecharts.render.engine.write_utf8_html_file")
def test_parallel_base(self, fake_writer):
data = [
[1, 91, 45, 12... |
e140a314f649e9839b1460b73c6295c6d60e1fc8ded5bd56fab8cdec3ed556a1 | Python | 4,564 | 149 | """Implements multiple handles that hook into the Python logging module.
These handlers can for example echo the log entry to the terminal, write it to a file or dispatch it to another class.
They are typically configured in the MDT configuration file.
"""
import codecs
from logging import StreamHandler
import os
imp... |
16f82639ca05af3ceadeb6941cbe431e6447e3c3204b1aea9c1758639272b366 | Python | 4,568 | 115 | import os
import json
import pandas as pd
import torch
from simulation_encoder.runner import Runner
from simulation_encoder.loaders.loader import Loader
from simulation_encoder.models.base_nn import BaseNN
from simulation_encoder.dataclass.loss_data import LossData
from simulation_encoder.dataclass.supervised_results ... |
1ccd9a85e87bd1b069dd289df68a9121a91d7b3428b6252eabdfc3a8c9d3c461 | Python | 4,574 | 111 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
from tractseg.libs.pytorch_utils import conv2d
from tractseg.libs.pytorch_utils import deconv2d
class UNet_Pytorch(torch.nn.Module):
def __init__(self, n_input_channel... |
bd749e33e4dd0570bb981ebcd6ad5c6e03c8f232e53cd3d7d4ea61df00e79f95 | Python | 4,575 | 120 | # 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 . import FairseqDataset
class TransformEosDataset(FairseqDataset):
"""A :class:`~fairseq.data.FairseqDataset` wrapper... |
2e72d4e5e41eb58aee141f4e007b33b1ed5c4c1ad2c7cda1e9d175ca1a56efc3 | Python | 4,576 | 138 | # Copyright 2021 DeepMind Technologies Limited
#
# 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 agr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.