Skip to content

Instantly share code, notes, and snippets.

View h-mayorquin's full-sized avatar

Heberto Mayorquin h-mayorquin

View GitHub Profile
@h-mayorquin
h-mayorquin / stub_tseries_08162024_1918_multisequence.py
Created June 5, 2026 01:33
Stub Bruker TSeries-08162024-1918-002 Timed Element multi-cycle (3 cycles x 3 frames, 1024x1024->64x64)
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "numpy",
# "tifffile",
# "lxml",
# ]
# ///
import shutil, uuid
import xml.etree.ElementTree as ET
@h-mayorquin
h-mayorquin / stub_tseries_02022026_multisequence.py
Created June 5, 2026 01:33
Stub Bruker TSeries-02022026 Brightness Over Time multi-burst (3 bursts x 5 frames, 1026x1026->64x64, with botData + voltage)
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "numpy",
# "tifffile",
# "lxml",
# ]
# ///
"""Complete, faithful stub of TSeries-02022026-001 (multi-burst Brightness Over Time).
@h-mayorquin
h-mayorquin / generate_stub.py
Created June 5, 2026 00:51
Stub + anonymize an OpenEphys OneBox NP2014 recording: truncate to 1 s (30,000 samples), empty event arrays, anonymize probe/headstage/basestation serials and machine name, preserve directory structure, structure.oebin (non-sequential CH334,CH332,... electrode_index wiring), settings.xml, sync_messages. Source: SpikeInterface issue #4394 (OneBox…
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "numpy",
# ]
# ///
"""
Generate a stubbed version of the OneBox NP2014 dataset for testing.
Takes the full recording and produces a 1-second stub with anonymized
@h-mayorquin
h-mayorquin / create_and_verify.py
Created June 4, 2026 22:11
Verify OME-TIFF DimensionOrder axis semantics: write one OME-TIFF per valid DimensionOrder (XYCZT, XYCTZ, XYZCT, XYZTC, XYTCZ, XYTZC) with self-identifying pixels, read back with tifffile, confirm OME-XML order and physical array layout agree. Context: NWB (Neurodata Without Borders) schema issue #660.
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "tifffile",
# "numpy",
# ]
# ///
"""
Create OME-TIFF files with different DimensionOrder values and verify that
tifffile respects the ordering for non-spatial dimensions (T, C, Z).
@h-mayorquin
h-mayorquin / stub_ncs.py
Created June 4, 2026 21:20
Neuralynx .ncs stub scripts: header + first N records, and a window of records around the largest timestamp jump (gap_tolerance_ms / over-segmentation repros)
#!/usr/bin/env python3
import argparse
import os
import sys
HEADER_SIZE = 16_384 # bytes
RECORD_SIZE = 1_044 # bytes (UInt64 + 3x UInt32 + 512x Int16)
def stub_ncs(input_path: str, output_path: str, keep_records: int = 5) -> dict:
@h-mayorquin
h-mayorquin / stub_bruker_voltagerecording.py
Last active June 4, 2026 15:22
Stub Bruker VoltageRecording intracellular (DANDI 001538, 9 CC/VC examples, CSV->100 samples, XML SamplesAcquired/AcquisitionTime amended to match)
# /// script
# requires-python = ">=3.10"
# dependencies = []
# ///
"""Stub Bruker PrairieView VoltageRecording (intracellular ephys) for a Bruker icephys fixture.
Surmeier Zhai 2025 'Somatic excitability' (current-clamp, mV) + 'Sr-oEPSC' (voltage-clamp, pA)
sessions. Each example = the VoltageRecording XML (verbatim, carries units/scaling/device) + the
CSV truncated to 100 samples (Time(ms), Primary). Picked to exercise mV vs pA, scaling Divisors,
Multiclamp700B device-name variants, old 2016 sessions (see INTRACELLULAR_EXAMPLES.md).
@h-mayorquin
h-mayorquin / stub_bot_04122024.py
Created June 3, 2026 22:19
Stub Surmeier 04122024 Bruker BOT with VoltageOutput stim channel (PV 5.6.64.200, 50nM dopamine, 128x128->16x16)
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "imagecodecs",
# "numpy",
# "tifffile",
# ]
# ///
"""Stub the Surmeier BOT acetylcholine recording for ophys_testing_data on gin.
@h-mayorquin
h-mayorquin / stub_zseries_20231129.py
Created June 3, 2026 22:19
Stub Bruker ZSeries plain Z-stack (PV 5.5.64.600, 158->5 planes, 512x512->64x64)
# /// script
# requires-python = ">=3.10"
# dependencies = ["numpy", "tifffile"]
# ///
"""Stub the PV 5.5.64.600 Bruker ZSeries (plain Z-stack) for ophys_testing_data.
Source: bruker_binary.zip / bruker_binary/ZSeries-20231129-001/ (158-plane Z-stack,
single channel Ch2/"Green", 512x512 uint16, + References + RAWDATA binary + .nii export).
This is the first plain `ZSeries` (static Z-stack, no time) fixture; existing volumetric
fixtures are `TSeries ZSeries Element` (volume-over-time), a different Sequence type.
@h-mayorquin
h-mayorquin / generate_imu_stub.py
Created June 2, 2026 21:15
Stub Inscopix .imu (9 channels, first 100 samples per stream; session timingInfo numTimes patched)
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "numpy",
# ]
# ///
"""
Stub an Inscopix raw .imu file down to its first N samples.
Raw .imu layout (isxcore `IMUFile`, structs in `api/isxIMUFile.h`):
@h-mayorquin
h-mayorquin / generate_gpio_stub.py
Created June 2, 2026 21:15
Stub Inscopix .gpio (NVista3, 26 channels, first 1000 CAPTURE_ALL packets ~1 s; header eventCount/sessionDataOffset patched)
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "numpy",
# ]
# ///
"""
Stub an Inscopix raw .gpio file down to its first N event packets.
Raw .gpio layout (isxcore `NVista3GpioFile`, structs in