sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
53b63fbe0a939d03e0eb0f09b0aaf4be0539848dc4340b0cac8fe6ba55d25f3c | Python | 18,453 | 398 | # Copyright 2022 The HuggingFace Inc. team.
#
# 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 ... |
c5588fe708614e1205dd9929415777ccb6fa4710d45e1a35c6bd1e7c9cd8e013 | Python | 18,470 | 520 | #!/usr/bin/env python3
"""Generate LRDA vs GRDA misclassification review viewer.
Trains the best model (spatial_all + GBM_deep), finds cases where the model
disagrees with the IIIC crowd label, generates EEG images, and builds an
HTML viewer where MW can review and relabel.
Predicted LRDA cases first, then predicted ... |
74d5b35a928c187077641e35c67c9d6b63fa8db03768213016f1d31520b9a023 | Python | 18,504 | 402 | import numpy as np
from sklearn.tree import BaseDecisionTree
from utils.dbms_utils import DBMSUtils
class DTMSQL(object):
"""
This class implements the SQL wrapper for a Sklearn's Decision Tree Model (DTM).
"""
def __init__(self, classification: bool = False):
"""
This method initiali... |
3bbbb1f39fec7c1b9df2e1a2ed96e3f77ade5729643e13dff98453cc32ed21f6 | Python | 18,508 | 453 | """
RDA Task B & C experiments: channel identification and LRDA/GRDA classification.
Task B: Channel identification methods (using VE-search frequency baseline).
Task C: LRDA vs GRDA classification methods (using VE-search freq + VE thresh=0.10).
Final: combined best of each.
Usage:
conda run -n foe python code/e... |
c64cbe397900dcaf28facf70c726453a3293c3c583f46d42e6e1e167d3649bbf | Python | 18,512 | 404 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from examples/modular-transformers/modular_new_task_model.py.
# Do NOT edit this file manually as any edits will be overwritten by the generat... |
d77a9fcac1b310c0b688f14bf34aee6382d2ab7f2840a8305653c1a81c07cc3e | Python | 18,512 | 518 | """
analysis_specs/bids.py
=======================
BIDS-related specs:
BIDSSpec — raw BIDS modality folder check (glob-based)
BIDSDWISpec — BIDS DWI acq-label discovery + AP/PA file check
BIDSFuncSBRefSpec — sbref ↔ bold pairing + timing gap check
─── To change expected patterns ────────────... |
5d84c047f694fc73147c446a92f4da298473c1df0f13ffdbfffa65a29e940462 | Python | 18,520 | 488 | """Torch modules for graph convolutions(GCN)."""
# pylint: disable= no-member, arguments-differ, invalid-name
import torch as th
from torch import nn
from torch.nn import init
from .... import function as fn
from ....base import DGLError
from ....convert import block_to_graph
from ....heterograph import DGLBlock
from ... |
56f57582b5441e8660a5bd7bfafcd15e3ba04a50b001167417a2fca9c94afacc | Python | 18,526 | 531 | # Copyright 2025 Microsoft and the HuggingFace Team. 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 require... |
3ab9fbe049dcffb3cddf4cc5d13ac7d0efd15f3c82ce3dbef47cfbb20e0b5ee1 | Python | 18,546 | 449 | """Isotropic remeshing of triangle meshes after Botsch and Kobbelt.
Each iteration splits long edges, collapses short edges, flips edges towards
valence 6, smooths tangentially and projects the vertices back onto the input
surface. Every operation runs in rounds over sets of edges whose
neighborhoods do not overlap, s... |
740df048dcd361d519a2e6b5961cfe48e5635486c33bf00aa542ccf4b4c93cbb | Python | 18,557 | 370 | # Copyright 2023 The HuggingFace Inc. team. 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 appl... |
dfdb220a3fa5667d47a158d63ebfd9c2b8f2162aabe373a28f3c85fa30ac0613 | Python | 18,564 | 440 | '''
Implementation of MARS model.
@author: maria
'''
import torch
import pandas as pd
import numpy as np
import anndata
from scipy.spatial import distance
import scanpy.api as sc
from collections import OrderedDict
from collections import defaultdict
from model.loss import loss_task, loss_test, reconstruction_loss
f... |
059697ebe0fadce02067d205767be1222b3ab159680ca315f6080609a3082fa1 | Python | 18,591 | 506 | """
Train HemiCET v2 — 8-channel hemisphere CET-UNet (retrain on cleaned labels).
Trains a single-hemisphere evidence model using 5-fold patient-stratified CV.
v2: 675 GT cases (vs 665 in v1), with 15 bad cases removed and 61 timing
corrections from 3 review rounds. Models saved to hemi_cet_v2/.
Dataset:
- LPD: aff... |
a2d6bd07958def29ff3d297223d5bc7ad97fecd066c51adb11b1b5b78906c95b | Python | 18,600 | 496 | import numpy as np
from scipy import stats
from scipy import signal
from scipy.optimize import curve_fit
import glob
import yaml
import re
import matplotlib.pyplot as plt
import pickle
def save_pkl(obj, path):
'''Function saving an object as a pickle file.
:param obj: python object (list, dictionary...) to b... |
0d982ff7798f76621e8f907fb676afaa6f18e055a4561acfe7ca17cc991f5a18 | Python | 18,603 | 426 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/chmv2/modular_chmv2.py.
# Do NOT edit this file manually as any edits will be overwritten by the generation of
# ... |
fad8fea34635486cf9d598924a14f488f1b5c6b048baad689c2f69eb68232a45 | Python | 18,635 | 630 | # -*- coding: utf-8 -*-
"""
Functions for operating on images + surfaces
"""
import gzip
import os
from pathlib import Path
from typing import Iterable
import nibabel as nib
from nibabel.filebasedimages import ImageFileError
import numpy as np
from scipy.interpolate import griddata
PARCIGNORE = [
'unknown', 'cor... |
392f332603e661f8348652961ed950633d341faaec216a34920de4a6ebaa192c | Python | 18,639 | 492 | from concurrent.futures import ThreadPoolExecutor, as_completed
from itertools import count
from matplotlib.ticker import PercentFormatter
from statsmodels.stats.proportion import proportion_confint
import matplotlib
import numpy
import pandas
import yaml
from matplotlib import pyplot
from numpy import ndarray
from nu... |
3336760f047edcc6a1f383ddca8a5d14f86e9125dcd956965126509a0023f0de | Python | 18,653 | 436 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/dpt/modular_dpt.py.
# Do NOT edit this file manually as any edits will be overwritten by the generation of
# ... |
10c0d838b84a1b3164f16b504a49a3afb7cbbb550d25279fd94d5a03a17dc727 | Python | 18,689 | 524 | """
=======
Records
=======
"""
import sys
import os
import shutil
from datetime import datetime, timedelta
from PySide6.QtWidgets import QTableWidgetItem, QApplication, QMenu
from PySide6.QtCore import Qt, QTimer
from PySide6.QtGui import QCursor, QIcon, QCursor, QAction
from openbci_stream.utils import HDF5Reader
... |
f269d33ff99f5bf923eed6845db9c72b17eb446a5f5472c349a1807270ac7e4a | Python | 18,710 | 501 | """
Evaluate HemiCET (Experiment 5.3) — 8-channel hemisphere CET-UNet.
Three evaluation configurations:
Config 1: HemiCET evidence only + DP
Config 2: max(HPP, HemiCET) + DP [product-boost]
Config 3: Product-boost(HPP, HemiCET) + DP + all improvements
Comparisons:
- Per-hemisphere baseline (exp0): F1≈0.672
... |
99126098320ae77bdda364f78917205a879fbd702c871cf2580737d4a424c13d | Python | 18,711 | 527 | """Reinhard H&E stain normalization."""
from __future__ import division
import cv2
import numpy as np
from typing import Tuple, Dict, Optional
from contextlib import contextmanager
from . import utils as ut
from .utils import lab_split_numpy as lab_split
from .utils import merge_back_numpy as merge_back
# ---------... |
9161180dcb6c35942ebb9c6b5c47277ed2d893bf74a5bd41fa39bb0bc27c1c15 | Python | 18,717 | 525 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... |
f3e3f8ddf4b16b790ddca7f1eb5b82bb8bb8b219844ba226ea3666909acb6cfa | Python | 18,717 | 468 | # Copyright 2025 HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
4ba4dfacef4dfbd4f64c473484afae50d7339c0e94826423128ea61cceebc85d | Python | 18,719 | 544 | """Utilities for batching/unbatching graphs."""
from collections.abc import Mapping
from . import backend as F, convert, utils
from .base import ALL, DGLError, EID, is_all, NID
from .heterograph import DGLGraph
from .heterograph_index import disjoint_union, slice_gidx
__all__ = ["batch", "unbatch", "slice_batch"]
... |
95b06a5c0e79b8a36eb97c680c8ecfa133ac364f6f97ebf07813501234e2be59 | Python | 18,761 | 474 | #!/usr/bin/env python
# @license
# Copyright 2018 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 applicab... |
0549d9f3e63e16a98fa636d47cb8a83316839b8be52b7e39e15e4a442f99dae8 | Python | 18,789 | 386 | # Copyright 2021 The HuggingFace Inc. team.
#
# 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 ... |
050ee766b1f4b98aa3134daa1414ee0118f645822a498681470ec926eb6c87ad | Python | 18,806 | 433 | #!/usr/bin/env python3
"""LRDA laterality v3 -- train on the wider MW-only pool, validate on 3-rater consensus.
Trains a laterality classifier on the much larger MW-only LRDA pool
(~919 segments / ~812 patients drawn from segment_labels.csv, excluding
all patients in the 200-segment independent-expert manifest), then
... |
84fcaa12a93c677f44f3425b8ffc3d47490a74f5a4bc28da633e0c5b4e82a010 | Python | 18,824 | 369 | # Copyright 2023 The HuggingFace Inc. team. 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 appl... |
cdc57454c33750314b26771259eb63b614433a66b4e2214673884eb01abe698f | Python | 18,846 | 555 | """Configure sphinx-polyversion for building documentation."""
import asyncio
import os
import re
import subprocess
import sys
from pathlib import Path
from bs4 import BeautifulSoup
from jinja2 import Environment, FileSystemLoader
from sphinx_polyversion import apply_overrides, logger
from sphinx_polyversion.git impo... |
83e7d685412d55ce14638110bad6f56bbc120b73c372f0c438d0e9fd46b5f1e2 | Python | 18,853 | 420 | # Copyright 2025 The HuggingFace Inc. team. 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 appl... |
07390d64e8fcfa710674fa4c6ee9cd60051db384d56026040dc88168f1328710 | Python | 18,857 | 337 | import random
import numpy as np
import pandas as pd
np.random.seed(99)
random.seed(42)
################################################################################
#### The warnings from Sklearn are so annoying that I have to shut it off #######
import warnings
warnings.filterwarnings("ignore")
from... |
b3c6002169a41d445c002f967efc022b41d7d2b869eb1976cae204fe2da7353c | Python | 18,864 | 439 | # Copyright 2025 the HuggingFace Team. 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 applicabl... |
766d248822817ba923c7493ade99887598d160732fd8c040282c2b5e6fbde443 | Python | 18,865 | 511 | """
Round 6: Teager-Kaiser Energy Operator (TKEO) experiment.
TKEO = x[n]^2 - x[n-1]*x[n+1]
A one-sample computation that suppresses 1/f background and produces sharp pulses
at each discharge. Should be better than pointiness for complex LPD morphology.
Variants:
r6_tkeo_fft_s002 - TKEO FFT, sigma=0.02*fs
r6... |
827f6b46795b3705af7a0b644fda6b116ad289b71b1610d26079e87252f85e87 | Python | 18,893 | 605 | #!/usr/bin/env python
"""
The *fMRIPrep* on Docker wrapper
This is a lightweight Python wrapper to run *fMRIPrep*.
Docker must be installed and running. This can be checked
running ::
docker info
Please acknowledge this work using the citation boilerplate that *fMRIPrep* includes
in the visual report generated for... |
6888dee46b18278446eb4736860e5989d91088eff63492a17263e17f3f6a3396 | Python | 18,902 | 474 | """
Build self-contained annotation viewer HTML for Round 2.
Inlines manifest data and base64-encodes PNGs into a single HTML file.
Includes numerator/denominator calculator and algorithm estimate buttons.
Run: conda run -n foe_dl python code/dl/build_round2_viewer.py
"""
import csv
import base64
import json
from pa... |
5f31dcec57cde5ba84f66bdf216e90281a9155ac33950eb8cc0e8fad9112d120 | Python | 18,921 | 572 | import json
import os
import tempfile
import dgl
import dgl.backend as F
import numpy as np
import pyarrow.parquet as pq
import pytest
import torch
from dgl.data.utils import load_graphs, load_tensors
from dgl.distributed.partition import (
_etype_tuple_to_str,
_get_inner_edge_mask,
_get_inner_node_mask,
... |
f67d7c5e81548f4333d3754419ea77ed7a6cf665ec4de2244d573c40991ee5fb | Python | 18,972 | 551 | import argparse
import os
import asyncio
from collections import defaultdict
import datetime
from smcore import hardcore
from smcore import agent
import curses
class SafeHTTPTransit(hardcore.HTTPTransit):
def __del__(self):
# smcore.HTTPTransit schedules aiohttp cleanup in __del__, which can run
... |
1f85f50b94a9291a93e28d170097f2aa9b2bb6585193e41ad7995d85d0eb0c80 | Python | 18,994 | 408 | import numpy as np
import matplotlib.pyplot as plt
import scipy
import time
import sklearn
import sklearn.manifold
import scipy.io
from . import data_files
def get_markers(data, labels, num_markers, method='centers', epsilon=1, sampling_rate=1, n_neighbors=3, max_constraints=1000, redundancy=0.01, verbose=True):
... |
716218b54d8f60f497a062407c8d4697204b79cd4a53bad808cc9b3f430aa309 | Python | 18,998 | 393 | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 10 11:01:43 2020
@author: yqiu
"""
import torch
#import torch.nn as nn
#from torch.nn import functional as F
import numpy as np
import datetime
#from scipy.stats import pearsonr
import matplotlib.pyplot as plt
from scipy.stats import pearsonr#Pearson corr... |
d2890ef529db9003b045e82ebfd5f6ceafb7964d4a7e85ab9cf5d1cbf0ccf9b8 | Python | 18,999 | 523 | """
Evaluate learned model vs ridge baseline using the same patient-level CV.
Run: conda run -n foe_dl python code/dl/evaluate.py
"""
import sys
import os
import time
import warnings
import numpy as np
from pathlib import Path
from scipy.stats import spearmanr, pearsonr
from scipy.signal import find_peaks, butter, fil... |
594bc5a8e3526d3d9a22fca771bae3db6e3dc28e2c819f3960b54effb7db7d6e | Python | 19,004 | 452 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/jais2/modular_jais2.py.
# Do NOT edit this file manually as any edits will be overwritten by the generation of
# ... |
a048946bfb713171c69e8305accabe5feae5bd199f5d79f6638e6e341c26b1e3 | Python | 19,047 | 483 | # Copyright 2025 The HuggingFace Inc. team. 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 appl... |
f2b812d2f0c03e8b785049b334973f5d64d4da391ad1c3e119ce578d6eb8789b | Python | 19,047 | 541 | from __future__ import annotations
from collections import ChainMap
from dataclasses import asdict, dataclass
from pathlib import Path
from typing_extensions import Literal
PATTERN_PATH = Path(__file__).parent / "patterns"
@dataclass
class WFCConfig:
"""Dataclass for holding WFC configuration parameters.
... |
d04338dd4cfe8cd0845642fad2837bcbed1f89abb3223b8d48ac910adacf01e5 | Python | 19,052 | 446 | """
Compare Method A (original pd_detect_alternate) vs Method B (pointiness+ACF)
across L/G classification, frequency accuracy, and spatial extent.
"""
import sys, os, itertools
import numpy as np
import pandas as pd
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from pathlib import Path
from ... |
d364ad502e6f0350aa655314f9c31a979690f0b10d0a7c0cad1af1d38e27f9e1 | Python | 19,082 | 386 | # Copyright 2023 The HuggingFace Inc. team.
#
# 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 ... |
9316b0b0af70673ade801877b4f9958ca9f9252501ff5e45d10031f357412e2a | Python | 19,116 | 504 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init, CrossEntropyLoss
from datasets import Variable
class RNN(nn.Module):
def __init__(self,
vocabulary,
rnn_type='GRU',
embedding_size=128,
hidden_size=512,... |
c4fa489eace7b5c09d4fb334bfe8ecdaf8bb6c282037e2c72785135b6fd8fec7 | Python | 19,138 | 383 | import datetime
from enum import Enum
from pathlib import Path
from typing import Optional, TYPE_CHECKING
import numpy as np
from PIL import Image
from PyQt5.QtWidgets import QApplication
from magicgui import widgets, use_app
from magicgui.types import FileDialogMode
from magicgui.widgets import Container
from seg2li... |
0ad25e0365f676ebc83f523dd87415fab266a6868ca010e4565bdaf589821334 | Python | 19,146 | 530 | """Wave Function Collapse solver. Implementation based on https://github.com/ikarth/wfc_2019f"""
from __future__ import annotations
import itertools
import logging
import math
from typing import Any, Callable, Collection, Iterable, Iterator, Mapping, TypeVar
# from scipy import sparse # type: ignore
import numpy
im... |
8a942de0d05b90f3bbbde858eaf1bd85c493fed48272fda89111306d345f5b1b | Python | 19,146 | 568 | # This program predicts Ki values in the form of pCHEMBL/MW values of molecules for the target protein coagulation factor F11a with Shannon entropy framework: Shannon entropies based on SMILES, SMARTS and InChiKey, fractional Shannon entropy and MW as descriptors
# import the necessary packages
from imutils import pa... |
e468352cc5e61304b07b8a049d4ece6161abad7d06b9a8960ab8672728e6d0ec | Python | 19,156 | 486 | """
Generate threshold sweep figure: spatial extent agreement vs threshold.
For PD (PDProfiler) and RDA (RDA-PLV), sweep the threshold used to
binarize per-channel scores, converting to spatial extent = count(score > T) / 18.
Plot MAE, Pearson r, and ICC(3,1) as functions of the threshold.
Layout: 2x3 subplot
Row 1... |
04d6e1fad8a3f987cf6fdfc361c4c73f085467ed24670a2efbc78b89ea020000 | Python | 19,194 | 479 | """
Build annotation_viewer.html for round 4 with inlined base64 images.
Supports both GPD and LPD with subtype filtering.
"""
import json, base64
import pandas as pd
from pathlib import Path
BASE = Path(__file__).resolve().parent.parent
R4_DIR = BASE / 'data' / '_archive' / 'pd_round4'
IMG_DIR = R4_DIR / 'images'
d... |
1ecf8af39c11915086e7344674ea09f35dba6f52e7a4d46db1df8d947aab36f2 | Python | 19,229 | 561 | # Copyright 2023 Microsoft Corporation
# Copyright (c) 2026 ByteDance Ltd. and/or its affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# This file has been modified by ByteDance Ltd. and/or its affiliates. on 2026.
#
# Original file was released under MIT, with the full license text
# available at licenses/folx_MIT.... |
b18a57dba6b24b6f653632c61317a9a949261db131c5b2e44405e958dc9530da | Python | 19,274 | 472 | # Copyright 2026 The HuggingFace Team. 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 applicabl... |
adbc0855d94d3b82acb42e2ccdbbd1c42d163e834347adec0fe817b7491532d0 | Python | 19,283 | 528 | import torch
import slideflow as sf
import rasterio
import numpy as np
import shapely.affinity as sa
from typing import Tuple, Union, Optional, List, Dict
from torchvision import transforms
from os.path import join, exists
from rich.progress import track
from shapely.ops import unary_union
from shapely.geometry import... |
4624c6f72d5b49c3fc52b915f428887891c31cc27db27785725a18f6bd9f91f7 | Python | 19,300 | 535 | """Reusable Bento-dashboard components for the Brain-Folding Simulator.
* ``SegmentedControl`` — replaces radio groups (2D/3D, Varying/Constant, Direct/CG)
* ``NumericField`` — a spin-box-like line edit with steppers + inline error,
preserving scientific notation (1.0e-8, 4.7e-4)
*... |
b26a14bb092f9e6c2b57e940588e33b5459b1febe2210356dc9f1ef2a81a2013 | Python | 19,310 | 567 | """
Harvest LRDA and GRDA segments from the morgoth1 IIIC S3 dataset.
Steps:
1. Load the IIIC events spreadsheet
2. Parse expert vote distributions to find LRDA/GRDA-dominant segments
3. Filter to segments with >= 3 expert votes
4. LRDA: up to 5 segments per patient, up to 300 patients (~1000 segments)
5. GRDA: up to ... |
295e3514743e513cf204f47a72642503dede44d636b0bf55ac8c30e989ad62c2 | Python | 19,322 | 575 | # repo originally forked from https://github.com/Confusezius/Deep-Metric-Learning-Baselines
"""to do:
clean all of the files - particularly the main.py and also the losses and dataset files and the file for doing the dataloading
-- fast loading etc
need to change all of the copyrights at the top of all of the files... |
277a5b3641fad6775d0fe21e99806fa590d7d48c147134865a26347b57dee170 | Python | 19,384 | 400 | # Copyright 2026 BioHub and The HuggingFace Inc. team. 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 requi... |
8ec61eb40b46a9dd9be4ed863995a34d54078b43a31739af65a11a89fb448db7 | Python | 19,398 | 323 | #
# Pyserini: Python interface to the Anserini IR toolkit built on Lucene
#
# 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... |
41e64e276dde0da42008c470c9a0a525444249cf43ffa83475dd8765e81c03e9 | Python | 19,429 | 334 | ## Program: VMTK
## Language: Python
## Date: February 12, 2018
## Version: 1.4
## Copyright (c) Richard Izzo, Luca Antiga, All rights reserved.
## See LICENSE file for details.
## This software is distributed WITHOUT ANY WARRANTY; without even
## the implied warranty of MERCHANTABILITY or FITNE... |
2d236cc34bafe710249d7088bb5ebe0101bd2e7668f5a59f898cc44ee3ade5b6 | Python | 19,441 | 497 | # Copyright 2025 Deepseek AI and The HuggingFace Team. 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 requi... |
ec51d5e89d0ea73afb01aab0c9c579fe2029f4638982f58b2c2ed5ea8e028362 | Python | 19,442 | 459 | #!/usr/bin/env python3
"""
Render publication-quality EEG characterization figures from JSON data.
Self-contained: only requires matplotlib, numpy, scipy, json.
Reads figure_*_examples_data.json and produces figure_*_examples.png at 300 DPI.
"""
import json
import os
import sys
import numpy as np
import matplotlib
ma... |
5e72ae335641a1e75dfe19fada7ecb00f117520308d231f47c48a60a7a18403f | Python | 19,492 | 389 | # Copyright 2021 The HuggingFace Inc. team.
#
# 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 ... |
e6ffe29b677c91d6fff0496e0af0bcbe57ceed8966fbef3e80acf7393f92cae8 | Python | 19,496 | 526 | """
Round 6: Harmonic Product Spectrum (HPS) — anti-subharmonic frequency estimation.
HPS: P_final(f) = P(f) * P(2f) * P(3f)
The product naturally promotes the true fundamental frequency by requiring
energy at harmonic multiples. Subharmonic peaks (e.g. at f/2) get suppressed
because their 3rd harmonic (3*f/2) typica... |
1a0bdc29e055e9dd9486a3a9c1d05badfc3735bfd7fc8d4b4fb015506cf1fcbf | Python | 19,517 | 617 | """Provide tests for JuniferNiftiSpheresMasker class."""
# Authors: Synchon Mandal <s.mandal@fz-juelich.de>
# License: AGPL
from pathlib import Path
import nibabel
import numpy as np
import pytest
from nilearn._utils import data_gen
from nilearn.image import get_data
from nilearn.maskers import NiftiSpheresMasker
fr... |
c2353854a56a9395e5afaec9914a5bb1ff1fda5409ab57cbc097e4983ebc7997 | Python | 19,523 | 409 | # Copyright 2026 The HuggingFace Team. 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 applicabl... |
cfa7b99bfe377b62ca1afe7b70a3aca91a14a6c9f74452594149a3ed25e0e447 | Python | 19,541 | 503 | """
Round 6: Generalized Eigenvalue Decomposition (GED) spatial filtering for frequency estimation.
LPDs are lateralized — ~9 of 18 channels are pure noise from the quiet hemisphere.
Per-channel frequency → median is diluted by these noisy channels.
GED creates an optimal spatial filter that maximizes periodic signal ... |
2af66216a9826b5af663b92944114e0682abfc75f4d060fec760830a9bc07cc1 | Python | 19,545 | 580 | #!/usr/bin/env python3
"""Generate LPD laterality review viewer.
Runs pd_detect_alternate on all LPD segments without ground-truth laterality,
generates EEG images, and builds an HTML viewer for MW to label laterality.
Controls:
← (left arrow) = Left laterality
→ (right arrow) = Right laterality
Space ... |
ecde901597aa6f526d6f8caea8196a2e33610661d2558d4f4870e365953e4373 | Python | 19,551 | 594 |
"""
multiHierarchy.py: Functions for performing, characterizing, and testing
subpartitioning of low-level partitions.
Naming conventions:
- We assume that L0 partitions are obtained from whole-chromosome
partitioning
- L1 partitions are obtained by partitioning individual L0 partitions
"""
import numpy... |
cf1744b2a1bf04a831d16103ed010fb14d2186e7e77180fd0142f5675d30485b | Python | 19,556 | 451 | #!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtkmeshreader.py,v $
## Language: Python
## Date: $Date: 2006/07/17 09:53:14 $
## Version: $Revision: 1.16 $
## Copyright (c) Luca Antiga, David Steinman. All rights reserved.
## See LICENSE file for details.
## This software is distr... |
9da49de7540d5a4a4f5b3bf3dbb915ece1cc5f234eeb117a1bc5ecfb0f8a8710 | Python | 19,559 | 449 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/lfm2_vl/modular_lfm2_vl.py.
# Do NOT edit this file manually as any edits will be overwritten by the generation o... |
64e0fc79de5278d08722e4b3dc8c56c97a46df7d0c96ad650bf6db1418b54b32 | Python | 19,567 | 445 | """Write a compact, provenance-preserving quantitative imaging report."""
from __future__ import annotations
import asyncio
import json
from pathlib import Path
from typing import Any
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
from sm_image import SMImage
from sm_samp... |
81d44938d1967eb45e13c210604ba6e8d93df931c9582813ee3835c55090f133 | Python | 19,594 | 531 | """
Round 7: Dynamic Time Warping (DTW) template matching for discharge detection.
KEY INSIGHT: Fixed cross-correlation template matching failed because EEG discharge
morphology varies in duration/phase. DTW handles this temporal warping naturally.
Templates: data/templates_C_lpd.npy, data/templates_C_gpd.npy (8x50, ... |
54667d0b2221ba32df7ab50299a2814775b5032ef373949b070f5573b746be89 | Python | 19,605 | 638 |
# coding: utf-8
# # Graphs from the NSPN 2K cohort questionaire data
#
# These graph analyses are created by Kirstie, started on 11th May 2016, based on correlation matrices from Jan.
# In[1]:
import community
import forceatlas2
import matplotlib.pylab as plt
get_ipython().magic('matplotlib inline')
import matplot... |
85cd5dba7c181bc55268b6a32d515fe045bfd6ade658744182259835044bba65 | Python | 19,627 | 384 | # Copyright 2024 Cohere team. 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 ... |
37f6a1b75a693861bcf742712ad5cf00dbddaea813eb1b2602d0aee9ad5bbd45 | Python | 19,652 | 545 | # Copyright 2022 The OFA-Sys Team Authors and The HuggingFace Team. 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
#
#... |
372f951f903343e705c23e14a878b93d64f4c4b5fc7bb026c0223f7d948240dd | Python | 19,654 | 699 | """Torch modules for TWIRLS"""
# pylint: disable=invalid-name, useless-super-delegation, no-member
import torch as tc
import torch.nn as nn
import torch.nn.functional as F
from .... import function as fn
class TWIRLSConv(nn.Module):
r"""Convolution together with iteratively reweighting least squre from
`Gra... |
b703902b433f8709d456e141320a9c00b7157dc41024aad7b957129ba7276f28 | Python | 19,673 | 481 | # Portions of this code were adapted from
# https://github.com/jingraham/neurips19-graph-protein-design
import numpy as np
import tensorflow as tf
from tensorflow.keras import *
from tensorflow.keras.layers import *
from gvp import *
class MQAModel(Model):
def __init__(self, node_features, edge_features,
... |
e139202540223a107dd3810e5ed94fdd389d3e11cf14836d7c4525908e27f502 | Python | 19,684 | 369 | # Copyright 2026 The HuggingFace Inc. team.
#
# 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 ... |
79ef3a81ff3c6278eac747b8e4ebdfe3908cb239458c307ba12c2c7d87cdf96e | Python | 19,692 | 753 | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
# Load modules
import os, glob
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.callbacks import ReduceLROnPlateau, EarlyStopping
from tensorflow.keras.optimizers import Adam, RMSprop
from tensorflow.keras... |
d8537a0d7894c8143542429db42c8e3a108338b37199e94f09cce5823c726495 | Python | 19,692 | 464 | # Copyright 2025 the HuggingFace Team. 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 applicabl... |
e2ef330a3b8043cc5e4d3c441a444f42ab6c780dbb87ca1a8b3d1f0705367cf5 | Python | 19,707 | 448 | ### This script models and runs a 3D GNN-based network architecture to predict logp values of molecules as per the dataset
# Importing necessary packages
import time
start_time = time.time()
from openbabel import pybel
import networkx as nx
import pandas as pd
import matplotlib.pyplot as plt
# Importing... |
c731c0254db6ad2b3167bf9470ca6c0d64ac63223d431958d8de2e3926da03a8 | Python | 19,708 | 415 | """Adapted from Nematode: https://github.com/demelin/nematode """
import sys
import tensorflow as tf
import numpy
# ModuleNotFoundError is new in 3.6; older versions will throw SystemError
if sys.version_info < (3, 6):
ModuleNotFoundError = SystemError
try:
from . import model_inputs
from . import mrt_ut... |
2a40205a7e31de36c40bb5bcdb3d28f21d6b22ca67ac5c8fc96d05a7c49232a6 | Python | 19,712 | 396 | # Copyright 2021 The HuggingFace Inc. team.
#
# 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 ... |
4cfe96609b0e5a9b294c4db4ac51cd1e15d559e36d30d84e232523981ec772f6 | Python | 19,713 | 498 |
import os
import sys
import ast
import warnings
import asyncio
import argparse
import zlib
import pathlib
import tempfile
import json
import re
import pandas as pd
import numpy as np
import SimpleITK as sitk
import pydicom
def get_csv_contract() -> dict:
"""Return the side-effect-free QIWS CSV contract used by p... |
45e4c663c1d3c704123d1be9d10ffd1100a632d5e7f9111120d4fc7fbc4d8a7e | Python | 19,727 | 476 | # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
#
# 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
#
# Unle... |
28492d2f55af30c6e62a2c4be747689569a2d06fba94380ebe1164b2c42a3099 | Python | 19,733 | 521 | """
Upload single-channel 512x512 CT nodule samples to the blackboard.
CSV contract:
- `image-512x512`: `.seri` manifest for the 512x512 CT reconstruction used as the
single-channel image source
- `label_mask`: `.nii.gz` nodule segmentation defined on that same 512x512 image grid
- `label_dict`: `.json` case metadat... |
9eb1e945d69e1f29e20e7538779f3c9dfc43469becf03b2349e031b35a930719 | Python | 19,735 | 493 | #!/usr/bin/env python3
"""
Generate Fig 3: RDA Characterization Pipeline composite figure.
Three-panel horizontal layout:
Panel A (left): Input 19-channel EEG (average reference, 10s)
Panel B (center): Architecture flowchart (W05 iterative narrowband refinement)
Panel C (right): Output visualization (EEG + na... |
7274d6eb6566a7f743b71e136f727cf3526eaae0e963af0e6cef4679bac92d79 | Python | 19,747 | 492 | # pylint: disable=not-callable
# pylint: disable=no-member
import numpy as np
import torch
import mnist_utils
import functions as F
def set_tensor(arr, device):
return torch.from_numpy(arr).float().to(device)
class QCodingNetwork(object):
def __init__(self, cf):
self.device = cf.device
sel... |
87d1ab61b59f5d8a008d79f925d89f44800b423eef973df09a30085d337083af | Python | 19,747 | 357 | """Find maximum projected boundary spans near supplied per-label directions.
The tool is domain-neutral. It operates on labelled mesh regions and explicit
2D plane/tangent records, returning positive/negative boundary endpoints and
traceable angular-search QC.
"""
from __future__ import annotations
import asyncio
i... |
171fddd43bc370aaca8c889759c40382745a5e2ec2205b6bb24dd6d3a628b625 | Python | 19,755 | 512 | from rl_nav.runners import episodic_runner, lifelong_runner
import numpy as np
from rl_nav import constants
import os
import copy
import random
class LifelongQLearningHierarchyRunner(lifelong_runner.LifelongRunner):
def __init__(self, config, unique_id: str):
super().__init__(config=config, unique_id=uni... |
0471bd5e0d56f148d32a67da37120f7f1a1f27a876938fb3d0fdef1ec06a639d | Python | 19,765 | 428 | # Copyright 2020 The HuggingFace Team. 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 applicabl... |
1abec5dea55e8dd1ce4175ab95669adc262f6f4bbc48b3669fea3ece5a425c01 | Python | 19,775 | 389 | import collections
import itertools
import os
import json
import warnings
import torch
from torch_geometric.data import Data, Batch
import numpy as np
import h5py
from .from_pymatgen.lattice import find_neighbors, _one_to_three, _compute_cube_index, _three_to_one
from .utils import flt2cplx
class Collater:
def ... |
32e4bebc140c02e09a6e0f8329e76cfeada73580fdc27779c41fcb58d9db9bcb | Python | 19,791 | 583 | """
Generate frequency annotation viewer for newly harvested LPD segments.
Reads harvest_manifest.json, generates morgoth-style EEG images,
and builds an HTML viewer for MW to annotate frequency.
Must run with: conda run -n foe python code/generate_freq_annotation_viewer.py
"""
import sys, json, base64, io
import nu... |
9c0a9a6c9e71ce434f98fe00e48563a00ee0bcdcd2b924ce8001d8fc9079335b | Python | 19,791 | 472 | import numpy as np
import imgui
import threading
from typing import Union, Optional
from ..gui import imgui_utils
import slideflow as sf
#----------------------------------------------------------------------------
def _apply_cmap(img, cmap):
import matplotlib.pyplot as plt
cmap = plt.get_cmap(cmap)
ret... |
48e38ca5e2c25e73590b9487f9ab237f776cd457680dec6fcc4496d261ce9acb | Python | 19,829 | 490 | #!/usr/bin/env python
from __future__ import print_function, absolute_import # NEED TO STAY AS TOP IMPORT
import vtk
import sys
import math
from vmtk import vtkvmtk
def ReadPolyData(filename):
reader = vtk.vtkXMLPolyDataReader()
reader.SetFileName(filename)
reader.Update()
return reader.GetOutput()
def ... |
c44fa2a5792ea40f019747e4b29ffdae5a93db119f6ae56594b5e24932a63883 | Python | 19,849 | 199 | from Utils.Settings import window_spike_clu, window_spike_hist, output_folder_calculations, neuropixel_dataset, output_folder_figures_calculations, var_thr
import os
from allensdk.brain_observatory.ecephys.ecephys_project_cache import EcephysProjectCache
import dill
from tqdm import tqdm
import pandas as pd
from Utils.... |
55c321734a5617b842699bf21c6f50cd20a1caf8f6d16af2adb64bb7f903e5cc | Python | 19,861 | 507 | # Copyright 2022 The HuggingFace Team and Microsoft Research AI4Science 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... |
a0a9ec5a5eccbf36f452d9975a07279e05590c8eed55b8454a6a96d2f6f65f19 | Python | 19,898 | 620 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import math
import random
import time
from collections import OrderedDict
import dgl
import dgl.function as fn
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn.functional as F
import torch.optim as optim
from dgl.dataloading... |
443b31e33ed25d7fd7b990217fd316cd5a8d9e0b88fa0c403b9485aef7918fb5 | Python | 19,900 | 465 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/ernie4_5/modular_ernie4_5.py.
# Do NOT edit this file manually as any edits will be overwritten by the generation... |
207e1289f2fda9b1effefb6fc93519ff68467087d28f5189632b97cccdf896ff | Python | 19,916 | 508 | # pylint: disable=not-callable
# pylint: disable=no-member
import numpy as np
import torch
import mnist_utils
import functions as F
def set_tensor(arr, device):
return torch.from_numpy(arr).float().to(device)
class QCodingNetwork(object):
def __init__(self, cf):
self.device = cf.device
sel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.