Other Parsers

This page covers ionique’s specialized parsers. Each is briefly described with its parameters and a usage example.

FilterDerivativeSegmenter

Detects segment boundaries using the derivative of a lowpass-filtered signal. Sharp transitions produce large derivative values that cross a threshold.

FilterDerivativeSegmenter — filtered signal and its derivative

Parameter

Default

Description

low_threshold

1

Lower derivative threshold for transition detection.

high_threshold

2

Upper derivative threshold.

cutoff_freq

1000.0

Lowpass cutoff (Hz) applied before derivative computation.

sampling_freq

1e5

Sampling frequency (Hz).

from ionique.parsers import FilterDerivativeSegmenter

parser = FilterDerivativeSegmenter(
    low_threshold=1.5,
    high_threshold=3.0,
    cutoff_freq=2000,
    sampling_freq=100000,
)
trace.parse(parser, newrank="event", at_child_rank="vstep")

NoiseFilterParser

Classifies signal regions as clean or noisy based on local variance. Useful for excluding unstable portions of a trace before event detection.

NoiseFilterParser — clean vs noisy regions

Parameter

Default

Description

noise_threshold

60

Variance threshold for noise classification.

detect_noise

True

If True, returns noisy regions. If False, returns clean regions.

from ionique.parsers import NoiseFilterParser

# Keep only clean regions
parser = NoiseFilterParser(noise_threshold=60, detect_noise=False)
trace.parse(parser, newrank="clean", at_child_rank="vstep")

# Then parse events in clean regions only
trace.parse(event_parser, newrank="event", at_child_rank="clean")

snakebase_parser

Segments the signal based on peak-to-peak amplitude changes. Detects regions where the local amplitude exceeds a threshold.

snakebase_parser — peak-to-peak amplitude segmentation

Parameter

Default

Description

threshold

1.5

Amplitude threshold for segmentation.

from ionique.parsers import snakebase_parser

parser = snakebase_parser(threshold=1.5)
trace.parse(parser, newrank="event", at_child_rank="vstep")

ExclusionParser

Excludes specified time regions from analysis. The remaining (non-excluded) portions become child segments.

ExclusionParser — excluding time regions

Parameter

Default

Description

regions

(required)

List of (start_sec, end_sec) tuples specifying time intervals to exclude.

from ionique.parsers import ExclusionParser

# Exclude two noisy time windows
parser = ExclusionParser(regions=[
    (0.2, 0.4),    # exclude 0.2–0.4 seconds
    (1.2, 1.4),    # exclude 1.2–1.4 seconds
])
trace.parse(parser, newrank="clean", at_child_rank="vstep")

lambda_event_parser

A rule-based parser that detects events using a simple threshold and optional filtering rules.

lambda_event_parser — threshold-based detection

Parameter

Default

Description

threshold

90

Current threshold for event detection (as percentage of baseline).

rules

None

List of callable rules for post-filtering.

from ionique.parsers import lambda_event_parser

parser = lambda_event_parser(threshold=85)
trace.parse(parser, newrank="event", at_child_rank="vstep")

IVCurveParser and IVCurveAnalyzer

These two classes work together to extract current–voltage (IV) relationships from multi-voltage-step recordings.

IV curve — current vs voltage

IVCurveParser identifies the voltage protocol pattern:

from ionique.parsers import IVCurveParser

parser = IVCurveParser(voltage_array)
patterns = parser.parse()
# Returns matched voltage patterns for IV analysis

IVCurveAnalyzer computes mean current at each voltage level:

from ionique.parsers import IVCurveAnalyzer

analyzer = IVCurveAnalyzer(
    current=current_array,
    parent_segment=vstep,
    sampling_frequency=100000,
    method="simple",
)
iv_data = analyzer.analyze()
# Returns {voltage_value: (mean_current, std_current), ...}

MemoryParse

Reconstructs segments from precomputed boundaries. Useful for loading previously saved analysis results.

from ionique.parsers import MemoryParse

parser = MemoryParse(
    starts=[1000, 3000, 7000],
    ends=[1500, 3800, 7200],
)
trace.parse(parser, newrank="event", at_child_rank="vstep")