sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
c1361dd636c280176c4fac32511f967df38e490be2bbc7fd7d64e1e59058caab | Python | 6,934 | 180 |
# Source code: https://github.com/zbmed-semtec/medline-preprocessing/blob/main/code/Evaluation/calculate_gain.py
# This file includes the modifications to the source code according to this project
import os, sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.... |
f75535f6f4d02258aa2e83d2a88a316e02e8e946f7ea18945577da40dfeb5b16 | Python | 6,934 | 182 | # RangerQH - @lessw2020 github
# Combines Quasi Hyperbolic momentum with Hinton Lookahead.
# https://arxiv.org/abs/1810.06801v4 (QH paper)
# #Lookahead paper --> MZhang,G Hinton https://arxiv.org/abs/1907.08610
# Some portions = Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is ... |
6eb361b4825e189b47f74946fcfa86c885f08fe73dd25c121b9c9e8e0a7927fb | Python | 6,936 | 207 | """
@file model.py
@author Simon Yu
@date 02/06/2023
@brief Model classes and functions.
"""
import abc
import header
import logger
import torch
import torch_explain
import torchvision
import type
import utility
class Model(torch.nn.Module):
def __init__(self):
super().__init__()
return
... |
ae427dc2cf068094e8e1ba15aad9ac24e9d3b5424bfea7715ecc8ee908a01aa4 | Python | 6,936 | 184 | """The frozen trunk holds its linear weights in the autocast dtype.
Autocast caches a weight cast only for a leaf with `requires_grad=True`, so
every frozen `nn.Linear` in the base model re-copied its fp32 weight on each
forward. `freeze_base_model` stores the cast result instead, which has to
leave `LayerNorm` and `E... |
98cf412181f779140a17b49cc3104cbd227235a563fe482037b02542d9505be3 | Python | 6,938 | 160 | """tests for vak.config.train module"""
import pytest
import vak.config.train
class TestTrainConfig:
@pytest.mark.parametrize(
'config_dict',
[
{
'standardize_frames': True,
'batch_size': 11,
'num_epochs': 2,
... |
87b5b9089306d1bf9791aa09f0bfe57367d0f174fd9fc51556ea8d844b66b829 | Python | 6,940 | 190 | """Figure 2 panel C primitive — Hausser-only architectural ablation ladder.
Reads results/benchmark/figure2_final_ladder.csv (tidy fold-level
balanced-accuracy table), filters to the Hausser cerebellar cortex cell-type
dataset, and emits a clean single-panel ladder chart for the composite.
Outputs:
figures/figure... |
133405ebbe3bcaf5a4ea6f679b9f411f0f8d1cd326833cc8519081f028825267 | Python | 6,941 | 132 | #!/usr/bin/env python3
"""
EIF2S1 R3 REVISION - CROSS-COHORT META (Reviewer 4).
Exact stratified permutation meta-test of the EIF2S1-PELO disease-associated dissociation-gap
change across the two RNA-seq cohorts where the gap is directly comparable: PD (GSE68719 BA9)
and ALS (GSE124439 frontal cortex). Direction was es... |
48c8234ebd9b63733f8a720cab25b2577f3d2a61b7e2b37076db9954e0b7b3ae | Python | 6,943 | 145 | import logging
from typing import Any
import pandas as pd
from anndata import AnnData
from .. import utils
from .._constants import Keys
from .clients import api_request
from .describe import domains_description
log = logging.getLogger(__name__)
def label_domains(
adata: AnnData,
obs_key: str | None = None... |
847deb6a2e7dc35b7b4142147aa4315aee298c1eda4ba10c52cc024c6a0b2f3c | Python | 6,944 | 200 | import shutil
import os, sys
from subprocess import check_call, check_output
import glob
import argparse
import shutil
import pathlib
import itertools
def call_output(cmd):
print(f"Executing: {cmd}")
ret = check_output(cmd, shell=True)
print(ret)
return ret
def call(cmd):
print(cmd)
check_call... |
df9a8dc1be84ac8867ce478ea38f94ca536dd9cbeed501ad53ba35ec60ee83d0 | Python | 6,946 | 228 | from collections import namedtuple
from itertools import chain, combinations
from typing import Any
import numpy as np
from pgmpy.utils import compat_fns
from pgmpy.utils._warnings import _warn_external
State = namedtuple("State", ["var", "state"])
def cartesian(arrays: list[Any], out: np.ndarray | None = None) ->... |
8e3313bb42cee6e4808e068559e163711ad37fd9344c2b8271cf3fa798d82156 | Python | 6,947 | 137 | #!/usr/bin/env python3
"""O viés do seletor vem do desalinhamento entre CV interna e externa? Perovskitas.
MOTIVO. A §3.1 do manuscrito C fechou com dois canais medidos: variância (a amplitude
sob permutação acompanha a inclinação de RMSE(alpha) no trecho visitado, em doze
casos) e VIÉS (o alpha modal do seletor perde... |
718eac8745675fbbee82c552560230de946e87e82253247f091c2fcbb89c7813 | Python | 6,952 | 191 | import numpy as np
import pandas as pd
import altair as alt
from altair import VConcatChart
def get_total_pos(df: pd.DataFrame) -> pd.Series:
return df.sum(axis=0)
def get_total_neg(df: pd.DataFrame) -> pd.Series:
return df.sum(axis=0)
def get_cnorm_pos(df: pd.DataFrame) -> pd.DataFrame:
total = get_... |
ff51589331a1546327bc780443ccf9d6232b544565878f1adf58cba9b576a3dc | Python | 6,953 | 174 | import logging
import os
import shutil
import pandas as pd
from jinja2 import Environment, FileSystemLoader
import gsMap
from gsMap.cauchy_combination_test import run_Cauchy_combination
from gsMap.config import CauchyCombinationConfig, ReportConfig
from gsMap.diagnosis import run_Diagnosis
logger = logging.getLogger... |
94e9be1f0cc448314a4a11976a27750aaf4a93d23f3adf0e27188b927b531565 | Python | 6,954 | 191 | #!/usr/bin/env python3
"""Scoring for the Gene Completion benchmark: % amino-acid (AA) recovery.
Two panels, two alignment strategies (because eukaryotic genes have introns):
* Prokaryote/archaea panel -- the generated coding sequence is translated and
globally aligned to the reference protein; AA recovery is the p... |
62b43348ba9c7ec63e492e966863687d02df06661ccacf684a3a7c8466ee82c8 | Python | 6,955 | 167 | """
Slave process logic to perform parameter sensitivity analysis on
8 sobol samples at a time. The index to the samples is passed as an
argument when the slave process is called. When the index is negative, the
nominal parameter set is used.
The focus of this logic is to determine the influence of the paramet... |
35db718d7ce704b19b578d646a341b74fddcf0f7047ffa96959eb711d92832c0 | Python | 6,957 | 188 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from __future__ import annotations
import logging
from copy import deepcopy
from dataclasses import dataclass, replace
from typing import Any, Mapping, Protocol, Sequence, TypeVar, runtime_checkable
import torch
from torch_scatter import scatte... |
7f4fe7cea7d0831bd504edc726cd9c6474d16d6a603c91681e399e9c07c1b19b | Python | 6,957 | 159 | #!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
"""Create a protocol from a bvec and bval file.
MDT uses a protocol file (with extension .prtcl) to store all the acquisition related values.
This is a column based file which can hold, next to the b-values and gradient directions,
the big Delta, small delta, gradient ampl... |
e885816a5e4f0dfe9accc67aaed299ca46b783e90feee22a19da027a8c4d4f97 | Python | 6,957 | 186 | """enzymeNER's coordinate convention, and its three rows that miss it.
The offsets are half-open — the opposite of S800's — so the two corpora cannot
share a reader, and reading this one the other way shifts every span by a
character with nothing raising. What makes the convention checkable is the
same property S800 h... |
3dbb50664f58b3186c4b50556ea81b9c4b1934f1bbab1e09b67d2f94b26c18ac | Python | 6,960 | 191 | import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import StratifiedKFold
import torch
def make_confmat(cm, label_names, best_neighbors_waveform):
# Handle division by zero when some classes have ... |
7f1b27ebd48347fa55b1b06f3032ffadbf014f98efb1906d23f22077ce07a1c2 | Python | 6,960 | 196 | """
Fusion module for combining GNN embeddings with retrieved knowledge.
"""
import numpy as np
from typing import Optional, Literal
from sklearn.decomposition import TruncatedSVD
from sklearn.preprocessing import StandardScaler
class FusionModule:
"""
Module for fusing GNN embeddings with retrieved document... |
e3d2a9198611e2bf1d4225f5a018e435df2f5a4719e4bb6589c869663fd1029f | Python | 6,963 | 220 | """Cut the next brenda_references release: changelog section, commit,
annotated tag, push.
git-cliff picks the version and renders `CHANGELOG.md`; this sequences
the git side around it. The tag is the version — `pdm`'s scm version
source reads it at build time and `pyproject.toml` carries no number —
so creating the t... |
2df978e59723bcfb0f3f70a6ab340f0fcc8c951b0774e864a9cebc17948f0272 | Python | 6,964 | 144 | ##主要功能,计算一个serial内,记录后第4s开始,所有trial10帧的dR/R平均图
##20211102修改了预览数据的数量,由10帧变为40帧
##20211108添加了直方图均衡化处理
##20211109修改为局部直方图均衡化
##20211227把直方图均衡化改为高斯滤波、圆盘滤波和均值截断,数据只用1个trial的
##20231019把最终要显示的照片归一化带[-1*e-2,2-e*3]范围内
##20231031 每次的预览数据为8个(视觉刺激)或4个(电流刺激)trial的结果平均
##20240109 将baseline的数量从30修改为18,1s中包含的图像数量从40改为25
imp... |
2276985f6cfa44341e97809f02a75f501b7da9a80566485ff643f328abc624f3 | Python | 6,965 | 118 | import json
import os
from pathlib import Path
import sys
import tempfile
import unittest
from unittest.mock import patch
import nibabel as nib
import numpy as np
import pydicom
ROOT = Path(__file__).resolve().parents[2]
sys.path[:0] = [str(ROOT / "SegRef3D"), str(ROOT / "ColabNotebooks")]
from medical_source import ... |
4944c1387b82e1ac83d11595610cac5e8b9e553d80c5bdd19ce800ebe901a4c6 | Python | 6,965 | 151 | # _*_ coding: UTF-8 _*_
# Version information START --------------------------------------------------
VERSION_INFO = \
"""
Author: ZHANG YUBO
Simulate four-taxon data set with outgroup introgression and different split time
"""
# Version information END ----------------------------------------------... |
5ba542cc6c34b8e00a5857c59da4edb1fd5769303e9e822d59e4fe9bf1b574a7 | Python | 6,970 | 142 | # coding=utf-8
# Copyright 2019-present, the HuggingFace Inc. team, The Google AI Language Team and Facebook, 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.or... |
dbd39d074162277242daea3b09c2f5588e55658029369232fdfb7682be9f1ac3 | Python | 6,971 | 143 | # coding=utf-8
# Copyright 2019-present, the HuggingFace Inc. team, The Google AI Language Team and Facebook, 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.or... |
6dad0977362207a9e736f64db6c61f87080bcfc6634832a081147e1fe2883cd7 | Python | 6,974 | 214 | # 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 List, Tuple
import torch
import torch.nn.functional as F
from fairseq.data import Dictionary
from torch imp... |
a459d6dc038acd73775ab69d77b1600e47bfee67c22ead73a16efc77cd3a9525 | Python | 6,982 | 188 | import csv
import numpy as np
import pandas as pd
import random
import collections
from collections import defaultdict
from sklearn.utils import shuffle
import argparse
import sys
def get_all_pos(filename, epi):
all_pos = []
f = open(filename, 'r')
for line in f:
line_vec = line.r... |
21f8e755a28529262cdcd376b2d69979bf59f7a43ef3dc5202d5b4ea7522f1dc | Python | 6,986 | 308 | import os
import torch
import numpy as np
from torch_geometric.loader import DataLoader
from scipy.stats import pearsonr
from sklearn.metrics import mean_squared_error, mean_absolute_error
from model import GeometryAwareGNN
from model_ablation import GNN_NoRBF, GNN_WithBN
ABLATION_MODES = [
"NoRBF",
"WithBN",... |
f96066032a9dcf381559d7d9e2cdbc333614f334074908dc2a7b2c9fe73ba6e7 | Python | 6,986 | 155 | import csv
import os
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
CSV_FILE = os.path.join(SCRIPT_DIR, "raw_readme.csv")
OUT_FILE = os.path.join(SCRIPT_DIR, "raw_readme.csv")
# Code info per script (from readmeCodeetc/)
CODE_INFO = {
"diff132_d50_nDIA.Rmd": (
"nDIA-based quantification of whole-... |
613da64674ec1b5cc46e5b8bb67e7221be1ad5657df808c9421df63a91e5d097 | Python | 6,988 | 223 | import importlib.util
import inspect
import sys
from pathlib import Path
import numpy as np
SCRIPT = Path.cwd() / "ui_multislice_extraction_lbm.py"
def load_module():
spec = importlib.util.spec_from_file_location("ui_multislice_extraction_lbm", SCRIPT)
module = importlib.util.module_from_spec(spec)
sys... |
6991bae25ee84a24e106fbd45af1c084735fd96fac0b3fa405c6cc05ef99a8d9 | Python | 6,989 | 187 | import os
import anndata
import numpy as np
import pandas as pd
from scvi import settings
from scvi.data._download import _download
def _load_pbmcs_10x_cite_seq(
save_path: str = "data/",
protein_join: str = "inner",
):
"""Filtered PBMCs from 10x Genomics profiled with RNA and protein.
Datasets wer... |
7f06438c54e49942fe4bcbc9ad3f6fbaf070af8a122f914471690260067bee6f | Python | 6,992 | 234 | """
Multi-GPU Training for Garfield using torchrun (Recommended Method)
This script uses torchrun/torch.distributed.launch for better reliability
and compatibility with distributed training.
Usage:
# For 4 GPUs:
torchrun --nproc_per_node=4 train_multi_gpu_torchrun.py
# Or with older PyTorch:
python -... |
893319db08cab0feb217356083a5dec2e85bb329a3eef3b15220626197d4ebbc | Python | 6,995 | 241 | import argparse
import hydra
import os
from omegaconf import OmegaConf
from pathlib import Path
def get_default_parser(desc):
parser = argparse.ArgumentParser(description=desc)
parser.add_argument(
"--data",
type=str,
required=True,
help=(
"BIDS-formatted director... |
3d16041c8b9abc161e413a82780730e41b26a2a4498ba644f412f92c16978b92 | Python | 7,005 | 221 | """
Dataset Quality Metrics Calculator
This script calculates image quality metrics (brightness, sharpness, entropy)
for diabetic retinopathy datasets to support BAG index computation.
Metrics calculated:
- Brightness: Mean pixel intensity in grayscale
- Sharpness: Variance of Laplacian (edge detection)
- Entropy: I... |
8b99654fd90f162a10c9312a0aaaaa23b073e9d990146bd030d94dff70aefd03 | Python | 7,008 | 195 | """
Vision-Language Model Supervised Fine-Tuning System
Implements visual instruction tuning for VisionLanguageModel.
Supports two training stages:
- s1_pretrain: train connector only, keep llm frozen, vision encoder frozen.
- s2_finetune: train connector + full llm, vision encoder frozen.
"""
from __future__ import ... |
663dfcc4461efbd882f5b4b925938e6a7eb83637ee206a23f3c277ee539483ba | Python | 7,009 | 188 | from __future__ import annotations
from collections.abc import Callable
from PySide6.QtGui import QColor
from PySide6.QtWidgets import (
QAbstractItemView,
QHeaderView,
QTableWidget,
QTableWidgetItem,
)
class TkStyleTable(QTableWidget):
def __init__(self, columns: list[str], parent=None) -> None... |
222f6fbe1c3b08f9dacecce9aaddb90afc3faafbf70f00a3d20ea3d2235e2dc4 | Python | 7,013 | 204 | import soundfile as sf
import torch
import torch.nn as nn
import torch.nn.functional as F
class CpcFeatureReader:
"""
Wrapper class to run inference on CPC model.
Helps extract features for a given audio file.
"""
def __init__(
self,
checkpoint_path,
layer,
use_enc... |
b6f3ea0d85f4b48fecf1a50bfab48b25e8c0c301d36756de744a6b8f894df8da | Python | 7,013 | 166 | """
Slave process logic to perform parameter sensitivity analysis on
8 sobol samples at a time. The index to the samples is passed as an
argument when the slave process is called. When the index is negative, the
nominal parameter set is used.
The focus of this logic is to determine the influence of the paramet... |
53c466b8f2e23a325fb968d08def321befd4140d2321f823b0b3f6bc4ea94dfa | Python | 7,015 | 238 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selecthtml_static_path = []ion of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ---------------------------------------... |
a2a93831f5b80a8b4687507904c706b92fbf34457464e2f2f1900af1a7f09e16 | Python | 7,016 | 216 | from os.path import join
import pandas as pd
import seaborn as sns
from matplotlib.ticker import FormatStrFormatter
from mpl_toolkits.axes_grid1 import make_axes_locatable
from scipy import stats
from config_path import PROSTATE_LOG_PATH
def get_dense_sameweights(col='f1'):
filename = join(PROSTATE_LOG_PATH, 'n... |
0ff1e3daba193c2d2c9962af89dce03aff7509de76d71816c5823766ef8acce9 | Python | 7,020 | 249 | #!/usr/bin/env python3
# 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.
"""
Helper script to pre-compute embeddings for a flashlight (previously called wav2letter++) dataset
"""
import argpa... |
5f1124089e81ad575cfa707bbf241dc8fabd2ea9d9982cd4b5d828cf217cf9c9 | Python | 7,025 | 169 | #!/usr/bin/env python3
"""Run and numerically compare legacy-compatible calculations.
The current implementation and the 1.6.5 source are run independently against
copied examples with explicit legacy defaults. CSV values are compared with
configurable tolerances; calculation failures are never hidden as parity.
Docum... |
66491a6d22d003e28bfadef4d84b4329d9fd28a49b1405ed1dc187b071812af5 | Python | 7,025 | 177 | from md.Simulator import Simulator
from openmm.app import *
from openmm import *
from openmm.unit import *
from openff.toolkit import Molecule
import os
import numpy as np
import argparse
def current_cv(simulator, pullingForce):
cv1_value, cv2_value = pullingForce.getCollectiveVariableValues(simulator.simulation.c... |
0bcb336affb3355d05ec773f1d2409fdfb8392cebce77015d80e3647ab2f398b | Python | 7,026 | 165 | """Function called by command-line interface for prep command"""
from __future__ import annotations
import pathlib
import shutil
import warnings
import tomlkit
from .. import config
from .. import prep as prep_module
from ..config.load import _load_toml_from_path
from ..config.validators import are_tab... |
d46329f58694224136874779789da9e815a1f6084a66d0249812d85cc5c01784 | Python | 7,026 | 305 | import os
import torch
import numpy as np
import pandas as pd
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import seaborn as sns
from torch_geometric.loader import DataLoader
from sklearn.metrics import mean_absolute_error, mean_squared_error
from scipy.stats import pearsonr
from model imp... |
e6899c7bca7055d80396f1f7cca93e8477ea7e5b7ba519438dd0ec3c50f31f96 | Python | 7,026 | 159 | """
Code to load data and to create batches of 2D slices from 3D images.
Info:
Dimensions order for DeepLearningBatchGenerator: (batch_size, channels, x, y, [z])
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from batchgenerators.t... |
7369b7b7d06f1bb17a15f9cd2c9d97ac199dc2acff6bb27eb0844c2a9d3fa926 | Python | 7,027 | 204 | # 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 functools
import random
import unittest
from multiprocessing import Manager
import torch
import torch.nn as nn
from om... |
e2a52ccfe824859d01c22e873393d5f794526824f2081d871255ed8cafe64191 | Python | 7,027 | 128 | """Generate repository SVG/label parity fixtures using the actual Local methods.
No GPU/model or full application startup is needed. AST extraction executes the
unchanged production methods with their Qt/OpenCV dependencies. Run from repo root:
python SegRef3D/tests/generate_svg_parity_fixture.py [output-directory]
""... |
670a0f725b6abb44472d15a6f7fec461b558e54d06efa9560e18bb03a9172555 | Python | 7,029 | 203 | from __future__ import annotations
import logging
import re
import urllib.parse
from collections import defaultdict
from functools import cached_property
from typing import TYPE_CHECKING
from typing import ClassVar
from packaging.utils import canonicalize_name
from poetry.core.constraints.version import Version
from... |
a904261f7c8245dadebccb818b998174a0ddea232b060e313ff8ced88bbeef0f | Python | 7,030 | 243 | #!/usr/bin/env python
# Author_and_contribution:
# Niklas Mueller-Boetticher; created template
# Peiying Cai; implemented method
import argparse
from ast import If
parser = argparse.ArgumentParser(
description="""GraphST (https://www.nature.com/articles/s41467-023-36796-3)
"""
)
parser.add_argument(
"-c", ... |
269db24610e49206c18707a935b2183f97a4451e5c6bb29dac668314ffd7a8db | Python | 7,031 | 200 | # /usr/bin/env python
'''
Written by Kong Xiaolu and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
'''
import os
import numpy as np
import time
import torch
import CBIG_pMFM_basic_functions as fc
import warnings
def CBIG_mfm_optimization_desikan_main(gpu_index=0, random_seed=1):... |
8c3115499323a0806adbb49bd5dfe7a8281945b868ef146bc6d2a293f03090dd | Python | 7,031 | 189 | """GUI tests for MooveMainWindow.
Each test class shares a single MooveMainWindow instance (gui_window fixture)
to avoid macOS GPU context exhaustion that causes segfaults after ~8 windows.
Tests within a class reset state as needed.
"""
import os
import re
import pytest
from PyQt6.QtCore import Qt
from PyQt6.QtWidge... |
8ec3c996ead334f1558002b4c7b5523c9ab01540a0218e7251f9b39f5dabdf76 | Python | 7,033 | 178 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
import torch.nn.functional as F
from fairseq import utils
from fairseq.logging import metrics
from fairseq.criterion... |
0498b001aba1abcd9520ded4a85502b73d3016700979a597572bdef841a1157c | Python | 7,035 | 190 | from torch import nn
try: # for torchvision<0.4
from torchvision.models.utils import load_state_dict_from_url
except: # for torchvision>=0.4
from torch.hub import load_state_dict_from_url
import torch.nn.functional as F
__all__ = ['MobileNetV2', 'mobilenet_v2']
model_urls = {
'mobilenet_v2': 'https://dow... |
b8a1400e07f49fbc583c1ece1f0259fa10724bc3e033f9ce75919478bc72c490 | Python | 7,036 | 211 | import pandas as pd
import pytest
from pgmpy.base import DAG
from pgmpy.causal_discovery import ExpertKnowledge
from pgmpy.datasets import list_datasets, load_dataset
ALL_DATASETS = [
"abalone_continuous",
"abalone_mixed",
"adult",
"airfoil",
"angrist_krueger_qob",
"algerian_forest",
"appl... |
e1e24227abc1d453db60d524d11c4724a6d702e093e9578a7b954884a4125e61 | Python | 7,036 | 197 | from torch.utils.data import Dataset
import pandas as pd
import numpy as np
import torch
import json
import random
import pickle
with open("./bert_model/vocab.json", 'r', encoding='UTF-8') as f:
vocab = json.load(f)
alphabets = {
"A": 1,
"R": 2,
"N": 3,
"D": 4,
"C": 5,
"Q"... |
74c5090ca5131da44bf0c6065ee9cc1712d30029a47ec564c07b1a8355c1bb22 | Python | 7,037 | 219 | # 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
import os
import numpy as np
from fairseq import utils
from fairseq.data import (
ConcatSentencesDataset,
Dictionary,
... |
173f70eacced648d111c53b422628c24c8ff9ac58b478c8d701c8da9467637f9 | Python | 7,041 | 172 | from functools import partial
import haiku as hk
import jax
import jax.numpy as jnp
import numpy as np
import pytest
from jax.experimental import enable_x64
from oneqmc import Molecule
from oneqmc.types import ModelDimensions
from oneqmc.wf.orbformer import OrbformerSE
@pytest.fixture
def methane_eq_geom():
ret... |
36126522a60f2e70583a5c97d747233e83d9adbebdadaef849f18ed67192631a | Python | 7,044 | 169 | #!/usr/bin/env python3
"""DOS das 1.784 perovskitas, calculada NO CENAPAD. Traz-se só o resultado.
MOTIVO (proposta do David, 28/07). Baixar os 1.784 `.EIG` custa 1,9 GB para
depois moer localmente 23 min num núcleo. Calcular no cluster inverte as duas
coisas: a máquina é paralela, e o que desce são poucos MB.
DECISÃ... |
c957fd28d2f88161db41c1adf9d742989d5b26bc2e19f7388592d75c46035a9b | Python | 7,045 | 158 | import streamlit as st
import glob
import os
import json
import sys
import numpy as np
import joblib
import datetime
from pathlib import Path
from argparse import Namespace
from PIL import Image
from collections import defaultdict
from msi_visual import nmf_segmentation, kmeans_segmentation
from msi_visual... |
67bfe53eebc7ca44b672d4423af496851816166e3bb7fc5af396a89182263441 | Python | 7,056 | 177 | import json
import logging
import os
import re
from typing import List, Optional, Sequence
import numpy as np
import qcelemental as qcel
import yaml
from tqdm import tqdm
from .molecule import ANGSTROM, Molecule
from .types import Embeddings
# Note, spin= 2*s (same as pyscf), and molecular multiplicity... |
a33aae74e423354d46d3e1d310abb1ff69d9197f6195a38a4d263bd5b3327a5d | Python | 7,058 | 179 | # Source code: https://github.com/zbmed-semtec/medline-preprocessing/blob/main/code/Evaluation/calculate_gain.py
# This file includes the modifications to the source code according to this project
import os, sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.a... |
713796f5293c136f3c3a52a9d66ebca6319113bc90d7c1e38b312cb670a092a6 | Python | 7,059 | 179 | # Source code: https://github.com/zbmed-semtec/medline-preprocessing/blob/main/code/Evaluation/calculate_gain.py
# This file includes the modifications to the source code according to this project
import os, sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.a... |
1e862e3d69f2d3d83b32c4fd070b5d29fd91d0fd57f0ef4db7e011346cf71a38 | Python | 7,060 | 239 | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ ... |
2f9b3688704804193ac8ee7c4f67f6d7949721793bf028d7377279d0fe97b7f0 | Python | 7,060 | 180 | # Source code: https://github.com/zbmed-semtec/medline-preprocessing/blob/main/code/Evaluation/calculate_gain.py
# This file includes the modifications to the source code according to this project
import os, sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.a... |
e8e14ee6fcefee729a8d86a7430bf1a836c4beef5ad7738add296249a301ab9d | Python | 7,060 | 180 | # Source code: https://github.com/zbmed-semtec/medline-preprocessing/blob/main/code/Evaluation/calculate_gain.py
# This file includes the modifications to the source code according to this project
import os, sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.a... |
9d8cc0cd3070b98bcff013516ccea8abf088fea08b2346d5c55fdaf6ac31d44d | Python | 7,062 | 182 | """Figure 5 panel D — joint UMAP of Lisberger and Hull embeddings per method.
For each method loads the train (Lisberger, macaque) and predict (Hull, mouse)
embeddings from the liss→hull cross-dataset run, concatenates them, runs UMAP,
and plots coloured by cell type with circle=macaque / triangle=mouse markers.
Outp... |
676bf75d343d95444e8ca9afd2a82eafa880765255b8d598ab3741b414ce6168 | Python | 7,063 | 181 | from md.Simulator import Simulator
from openmm.app import *
from openmm import *
from openmm.unit import *
from openff.toolkit import Molecule
import os
import numpy as np
import argparse
def current_cv(simulator, pullingForce):
cv1_value, cv2_value = pullingForce.getCollectiveVariableValues(simulator.simulation.c... |
7b1f4f69c312723f0809d1d5ec68724077d6d0be65706b56c8ca1128ca4518fa | Python | 7,064 | 181 | from __future__ import annotations
import logging
import os
from typing import TYPE_CHECKING
from scvi.autotune._experiment import AutotuneExperiment
if TYPE_CHECKING:
from typing import Any, Literal
from lightning.pytorch import LightningDataModule
from scvi._types import AnnOrMuData
from scvi.mod... |
aa3af4aad31b67c26a77d5a9c39d3329eb68dd05b5a7dc814fd5975fba5f03f1 | Python | 7,067 | 174 | from msi_visual.pca_3d import PCA3D
from msi_visual.saliency_opt import SaliencyOptimization
from msi_visual.spearman_opt import SpearmanOptimization
from msi_visual.nmf_3d import NMF3D
from msi_visual.pca_3d import PCA3D
from msi_visual.nonparametric_umap import MSINonParametricUMAP
from msi_visual.percentile_... |
6ceb1370ea8b5ff2bf4d96ecb2e06aa5635c0b0fb9a82f0aeb1f2664f759b6db | Python | 7,068 | 174 | #!/usr/bin/env python
"""Capture PNG screenshots of RNAlysis GUI parameter dialogs, straight from the public API.
The GUI is generated from the API by reflection (see CLAUDE.md: the API is the source of
truth, the GUI reflects it). That means the parameter dialog for any public
``Filter``/``FeatureSet``/``fastq``/``en... |
c67f75eb130e6bc9ee31feaa3805ffe93c0fdf6dcb46901db1df359fdf8a1ca6 | Python | 7,070 | 172 | """
sim_spont.py
============
Pure spontaneous Brunel (2000) network simulation — no input signal.
The recurrent network implementation is based on the NEST example:
"Random balanced network (alpha synapses) connected with NEST"
https://nest-simulator.readthedocs.io/en/stable/auto_examples/brunel_alpha_nest.ht... |
6f7b3241f3274b52ea0ac215b7a4f5601b98143c2828f1c35697fd96dfc69c6f | Python | 7,071 | 197 | import torch
from fairseq.data.text_compressor import TextCompressionLevel, TextCompressor
from fairseq import checkpoint_utils, distributed_utils, options, utils
from fairseq import checkpoint_utils, data, options, tasks
from fairseq.data import FileAudioDataset, AddTargetDataset, Dictionary
from fairseq.tasks.audio_c... |
1d8434d7464459522634fc8e9710c8ece608475c419836af616b7f3e80419fb8 | Python | 7,076 | 215 | import pytest
import torch
import vak.common.validators
@pytest.mark.parametrize(
'tensor, expected_exception',
[
(torch.tensor([0, 1, 2, 3]), None),
(torch.tensor([0.1, 1,1, 2.1, 3.1]), None),
# raise type error if not a tensor
([0, 1, 2, 3], TypeError),
((1, 2, 3), T... |
513be39baf418a2253222a60d68efcdd81c2d9a678e66c1153970041dd8ad549 | Python | 7,078 | 193 | # -*- coding: utf-8 -*-
'''
Created on Fri Jan 24 15:36:49 2025
@author: hanna
PREPROCESSING STARTS WITH THIS FILE: ALL SUBSEQUENT PREPROCESSING RELIES ON THE RESULTS SAVED FROM THIS STEP
Main script for extracting behavioral data and related decoder information for each BCI session
Required custom function: p... |
c6082ecd7616648144360ca04d9f0f86818ae529935d071b0a40f3ff035c3b78 | Python | 7,080 | 160 | import tempfile
import unittest
from pathlib import Path
from unittest.mock import ANY, patch
from GMXMMPBSA.calculation import Calculation, EnergyCalculation, parse_qmmm_diagnostics
from GMXMMPBSA.exceptions import CalcError
class QMMMConvergenceTest(unittest.TestCase):
def _calculation(self, input_file, output... |
c8fbaa6df946150c85c8ef79ef2863a95b97af6923d4116efdd9a7b0e92e1c89 | Python | 7,081 | 179 | # 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 fairseq.modules.transformer_layer import TransformerEncoderLayer
from typing import Optional
import torch
import torch.nn as nn
from fair... |
d09ee01bf1da2dfaa9173862ea72560f63abc8f92a3001c6cfedb0852aaeadde | Python | 7,084 | 182 | # Source code: https://github.com/zbmed-semtec/medline-preprocessing/blob/main/code/Evaluation/calculate_gain.py
# This file includes the modifications to the source code according to this project
import os, sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.a... |
6c966d86ff4e102a5867d348260f77edcfbc080e21e07b91eb30adf0a7f7f6f0 | Python | 7,087 | 209 | """Grounding a tagged span in the store's mentions: the overlap join, the type
filter, and a narrowing that never picks.
The type filter is the invariant worth pinning twice over: the candidates of a
stored mention are of any type, so a span that took an overlapping mention's
IDs unfiltered would ground a bacterium in... |
b0e3812326da3de09821b56799bc2e06392c1c20dc08d704b05db0801c592839 | Python | 7,088 | 199 | """Extended tests for static_input_builders — covers default and stored-value branches."""
from __future__ import annotations
import pandas as pd
import pytest
from src.features.telemetry_alignment.io.static_input_builders import (
build_opto_cluster_entries,
build_photometry_cluster_entries,
)
from src.proce... |
3db79d58803b4cc53185aa278dcd1c56c8c2271a551628a43b1425c7e5e4f388 | Python | 7,089 | 201 | """Supplemental Figure 3 — ISI+ACG classification benchmark.
Loads cached 5-fold predictions under results/benchmark/celltype_cache/
and computes per-fold balanced accuracy and macro F1 for:
HIPPIE-ISI+ACG, PhysMAP (WNN), PCA-ISI, PCA-ACG.
Datasets: dandi_000473_cell_type (n=9213) and dandi_000955_cell_type (n=13... |
26ec4cb6b9a6c846fa18e4f42148096be0724f60ef33d19a0a11b6b83c335bfa | Python | 7,095 | 141 | #!/usr/bin/env python3
"""O viés do seletor vem do desalinhamento entre CV interna e externa? Perovskitas.
MOTIVO. A §3.1 do manuscrito C fechou com dois canais medidos: variância (a amplitude
sob permutação acompanha a inclinação de RMSE(alpha) no trecho visitado, em doze
casos) e VIÉS (o alpha modal do seletor perde... |
1f54d0ce79e5667410031f79a81f035bd20713e101575d48127c48a872d47ab3 | Python | 7,097 | 147 | import utils.gpu as gpu
from modelR.lodet_hbb import LODet,CAT_LODet
from tensorboardX import SummaryWriter
from evalR.evaluator_fs_oldloss import Evaluator
import argparse
import os
import config.cfg_lodet as cfg
from utils.visualize import *
import time
import logging
from utils.utils_coco import *
from utils.log i... |
8d7ba6fcd2d4b4202fc5289236d0fe560d9a837f31104736c6e1b68efd7cc796 | Python | 7,097 | 181 | #!/usr/bin/env python
import polars as pl
import polars.selectors as cs
import argparse
def read_gtf(file, attributes=["transcript_id"], keep_attributes=True):
if keep_attributes:
return pl.read_csv(file, separator="\t", comment_prefix="#", schema_overrides = {"seqname": pl.String}, has_header = False, new... |
b55175b245d41555d5dae7872fb4d852b35d1678d37a3ae07c405d34dc24e8e8 | Python | 7,099 | 226 | # 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
from fairseq import checkpoint_utils, tasks
import sentencepiece as spm
import torch
try:
from simuleval import READ_ACTION, W... |
fa2ceaa032d4af29885d8f9c82d30a5ba416ac981f310262538740b26bce413b | Python | 7,100 | 174 | import numpy as np
from scipy import signal
from utils import *
import copy
from theano import config
def data_resamp(traces, spikes, fps, spikefps, resample):
"""
Resamples a dataset of traces and spikes to target frequency using the scipy.signal routine
:param traces: List of traces belonging to differe... |
98b8fcdeb3cab4b91fbc85d511f336c898a51c8cde85676369691ab07b3acef3 | Python | 7,104 | 162 | import functools
import os
import random
import numpy as np
import argparse
import torch
from transformers import BertConfig
from models.modeling_bert import BertForMaskedLM
import diffusion_condition
from torch.optim import AdamW
from tqdm import tqdm
from sample import Categorical
from torch.nn.utils.rnn import pad_s... |
ccb1252c3d03cbece4d09fa252b9d35166d459f672249194e31ac117cbb10a69 | Python | 7,104 | 226 | #!/usr/bin/env python
# ENCODE DCC bwa wrapper
# Author: Jin Lee (leepc12@gmail.com), Daniel Kim
import sys
import os
import re
import argparse
from encode_lib_common import (
get_num_lines, log, ls_l, mkdir_p, rm_f, run_shell_cmd, strip_ext_fastq,
strip_ext_tar, untar)
from encode_lib_genomic import (
ge... |
4488214b1e9f6c3db9619bc591cd625aedb4461726ed8ac273b97a5665a55db0 | Python | 7,111 | 225 | # 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... |
758d4fcbbe9d4a8830d1734e168078db02db5059a55e24e26bf034152b798510 | Python | 7,111 | 190 | import argparse
import lightning as L
import numpy as np
import pandas as pd
import scanpy as sc
import wandb
import yaml
from anndata import AnnData
from lightning.pytorch.callbacks import ModelCheckpoint
from lightning.pytorch.loggers import WandbLogger
import novae
from novae import log
from novae._constants impor... |
d1fb6bf418f80acb4f14f0e99d91e9b4a58444b1b321b0a0513d19b6fbb1dfe9 | Python | 7,111 | 193 | # 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, List, Optional, Tuple
import torch
import torch.nn as nn
from torch import Tensor
import logging
from fairseq impo... |
b6c08cc15e70fcbf52e534f26b75344427a7c353f11fc1af836d3cd98a3e2f4d | Python | 7,112 | 189 | from typing import Dict, List, Optional
import cv2
import numpy as np
import torch
from matplotlib import pyplot as plt
from matplotlib.lines import Line2D
from scipy.ndimage import zoom
from torchvision.transforms import Compose, Normalize, ToTensor
def preprocess_image(
img: np.ndarray, mean=[
0.5, 0.5... |
2d54e225665bcfbca291c15ebe79366a1de3ce6575955175eca7c571cb6daf2f | Python | 7,113 | 157 | """Given user GO ids and parent terms, group user GO ids under one parent term.
Given a group of GO ids with one or more higher-level grouping terms, group
each user GO id under the most descriptive parent GO term.
Each GO id may have more than one parent. One of the parent(s) is chosen
to best represent... |
3205e05db9d553005ad6d416297eee72d751ef291cd932c001feb09303436947 | Python | 7,116 | 145 | '''
By K. Butenko
Functions for PathwayTune (see description in the headers)
'''
import numpy as np
import json
import os
import h5py
from scipy.stats import qmc
import csv
#import pandas
import sys
hemi_idx_SUFFIX = ['rh','lh']
def determine_el_type(el_model):
''' Checks electrode configuration based on... |
b7bdbe74ed40601a39d7f66b83a08f54693dad012925f417423194f28c6d6ab3 | Python | 7,116 | 204 | import os
import ot
import torch
import random
import numpy as np
import scanpy as sc
import scipy.sparse as sp
from torch.backends import cudnn
#from scipy.sparse import issparse
from scipy.sparse.csc import csc_matrix
from scipy.sparse.csr import csr_matrix
from sklearn.neighbors import NearestNeighbors
... |
c77e21bf6e4e92c63ee003f2e278571878c92b4d1dfcdc1538a68e602565879c | Python | 7,116 | 224 | import torch
import pytest
from neurovfm.models.vit import VisionTransformer
from neurovfm.pipelines.encoder import EncoderPipeline
from neurovfm.systems.utils import NormalizationModule
@pytest.mark.skipif(
not torch.cuda.is_available(),
reason="VisionTransformer currently requires GPU + FlashAttention kern... |
b0586c56ae647a9ea9f7912e596074eea8e4dee598b60a325e617a87551a5e9d | Python | 7,118 | 211 | """
This module contains a sensornode measurement class to recieve and save sensor data.
"""
import csv
import time
from Sensors import constants
import os
import threading
from queue import Queue
import random
from pathlib import Path
from Sensors.SensorNode import sensornode as SensorNode
meas_samples = Queue(1... |
fa2985fec2a4c14ad682ab32f8738b7f2bfd8766993585b0c8e06f1e9a2bf320 | Python | 7,122 | 223 | from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from packaging.utils import canonicalize_name
from poetry.core.constraints.version import Version
from poetry.core.packages.utils.link import Link
from poetry.repositories.link_sources.html import HTMLPage
from poetry.repositories.lin... |
6d7b16e2af313470d81c9dda08122576d61897b3c30b28fec0264e6d27b17a5a | Python | 7,123 | 205 | # 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
import numpy as np
import torch.utils.data
from fairseq.data import data_utils
logger = logging.getLogger(__name__)
class Ep... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.