%%{ init: {
'theme':'base',
'themeVariables': {
'background': '#a7d2eb', /* light backdrop */
'lineColor' : '#09205A', /* navy outlines / arrows */
'primaryColor' : '#005CA9', /* dark blue */
'secondaryColor': '#238FD6', /* light blue */
'tertiaryColor' : '#F57C00' /* orange accent */
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
TIFF file stubber - Creates a stub of a TIFF file with only the first n pages. | |
Preserves all metadata, tags, and structure of the original pages. | |
""" | |
from pathlib import Path | |
import tifffile | |
import numpy as np | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import h5py | |
import numpy as np | |
from typing import Optional | |
from scipy.sparse import csc_matrix | |
from pathlib import Path | |
def stub_caiman_hdf5(input_file: str, output_file: Optional[str] = None, n_timestamps: int = 10, n_units: Optional[int] = None, stub_one_photon_quantities: bool = True): | |
""" | |
Create a stubbed version of a CaImAn HDF5 file with reduced units and timestamps. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hdf5plugin | |
import h5py | |
import numpy as np | |
from hdmf.backends.hdf5.h5_utils import H5DataIO | |
from pynwb.testing.mock.file import mock_NWBFile | |
from pathlib import Path | |
from pynwb import NWBHDF5IO | |
from pynwb.file import TimeSeries | |
from neuroconv.tools.nwb_helpers import AVAILABLE_HDF5_COMPRESSION_METHODS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
import h5py | |
import numpy as np | |
# ──────────────────────────────────────────────────────────────────────────── | |
def copy_group( | |
src_group, | |
dst_group, | |
stub_frames: int, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
stub_scan_image_file.py | |
────────────────────────────────────────────────────────────────────────────── | |
Functions for creating stub ScanImage TIFF files with modified metadata. | |
""" | |
import re | |
import shutil | |
import struct |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
from pydub import AudioSegment | |
import numpy as np | |
import scipy.io.wavfile as wav | |
# Create output directory | |
output_dir = Path("audio_test_files") | |
output_dir.mkdir(exist_ok=True) | |
# Define output filenames with realistic names |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def stub_ome_dataset(file_path, num_timepoints=3, output_dir=None): | |
""" | |
Create a stubbed version of an OME-TIFF dataset based on a file path. | |
Parameters: | |
----------- | |
file_path : str or Path | |
Path to any TIFF file in the dataset | |
num_timepoints : int, optional | |
Number of timepoints to keep in the stub, default is 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
import numpy as np | |
import shutil | |
from typing import Union, Optional, Tuple | |
def get_memmap_shape(filename: Union[str, Path], | |
dtype: Union[str, np.dtype], | |
num_channels: Optional[int] = None, | |
offset: int = 0) -> Tuple[int, ...]: | |
"""Calculate the shape of a memory-mapped binary file. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from hdmf.data_utils import AbstractDataChunkIterator, DataChunk | |
import numpy as np | |
from PIL import Image | |
from pathlib import Path | |
from hdmf.backends.hdf5.h5_utils import H5DataIO | |
def generate_random_images(num_images, width=256, height=256, mode='RGB', seed=None, | |
output_dir="generated_images", format='PNG'): | |
""" |
NewerOlder