You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Utilities for working with regularly sampled time series data, including index-time conversions, signal processing primitives, and array manipulation functions.
4
4
5
-
## Overview
6
-
7
-
This package provides low-level building blocks for signal processing workflows, particularly for neuroscience and electrophysiology applications where data is regularly sampled at a known frequency. The focus is on efficient, allocation-conscious implementations suitable for processing large datasets.
8
-
9
-
## Features
10
-
11
-
### Index/Time Conversion
12
-
13
-
Convert between sample indices and time values for regularly sampled data:
5
+
## Quick Example
14
6
15
7
```julia
16
8
using SignalIndices
17
9
18
-
fs =30000.0# 30 kHz sampling rate
19
-
start_t =0.0
20
-
21
-
# Convert time to index
22
-
idx = t_to_ndx(0.5, fs, start_t) # First sample at or after 0.5s
23
-
24
-
# Convert index to time
25
-
t = ndx_to_t(15001, fs, start_t) # Time of sample 15001
26
-
27
-
# Duration and time intervals
28
-
dur = duration(30001, fs) # Duration spanned by 30001 samples
result = sum(skipnothing([1, nothing, 2, nothing, 3])) # 6
70
-
```
71
-
72
-
## Relation to Other Packages
73
-
74
-
### vs DSP.jl
75
-
76
-
[DSP.jl](https://github.com/JuliaDSP/DSP.jl) provides comprehensive digital signal processing including filters, FFTs, and spectral analysis. SignalIndices.jl is complementary, focusing on:
[SampledSignals.jl](https://github.com/JuliaAudio/SampledSignals.jl) focuses on audio I/O with rich type hierarchies for audio buffers. This package has different goals:
84
-
- No audio-specific functionality
85
-
- Focus on index/time math and signal primitives
86
-
- Designed for neuroscience/electrophysiology workflows
87
-
88
-
### vs TimeSeries.jl
89
-
90
-
[TimeSeries.jl](https://github.com/JuliaStats/TimeSeries.jl) provides `TimeArray` types for financial/irregular time series. SignalIndices.jl assumes regular sampling and works with plain arrays, computing times from indices and sampling rates rather than storing timestamps.
26
+
| Package | Focus |
27
+
|---------|-------|
28
+
|**SignalIndices.jl**| Index/time math, edge detection, and array primitives for regularly sampled data |
29
+
|[DSP.jl](https://github.com/JuliaDSP/DSP.jl)| Filters, FFTs, spectral analysis — use *with* SignalIndices for bookkeeping |
30
+
|[SampledSignals.jl](https://github.com/JuliaAudio/SampledSignals.jl)| Audio I/O with rich buffer types — audio-specific |
31
+
|[TimeSeries.jl](https://github.com/JuliaStats/TimeSeries.jl)|`TimeArray` types for financial/irregular time series — stores timestamps per sample |
91
32
92
33
## Installation
93
34
@@ -97,57 +38,9 @@ using Pkg
97
38
Pkg.develop(path="/path/to/SignalIndices")
98
39
```
99
40
100
-
## API Reference
101
-
102
-
### Type Utilities
103
-
-`div_type(T)` - Determine appropriate floating-point type for division
104
-
105
-
### Index/Time Conversion
106
-
-`ndx_to_t(i, fs, start_t)` - Index to time
107
-
-`t_to_ndx(t, fs, start_t)` - Time to index (first sample at or after)
108
-
-`t_to_last_ndx(t, fs, start_t)` - Time to index (last sample at or before)
109
-
-`t_sup_to_ndx(t, fs, start_t)` - Time to index (last sample before)
110
-
-`clip_ndx(idx, len)` - Clamp index to valid range
111
-
-`n_ndx(start, stop)` - Count indices in range
112
-
-`duration(npoints, fs)` - Time span of samples
113
-
-`time_interval(npoints, fs, start_t)` - Start/end time tuple
114
-
115
-
### Bin/Window Operations
116
-
-`bin_bounds(binno, binsize)` - Index bounds for a bin
117
-
-`bin_center(binno, binsize)` - Center index of a bin
118
-
-`expand_selection(ib, ie, imax, expansion)` - Expand index range
119
-
120
-
### Signal Processing
121
-
-`moving_sum(signal, window)` / `moving_sum!(out, signal, window)` - Sliding sum
122
-
-`find_all_edge_triggers(arr, threshold, comp)` - Find all threshold crossings
123
-
-`find_first_edge_trigger(arr, threshold, comp)` - Find first crossing
124
-
-`thresh_cross(arr, threshold, comp)` - Threshold crossing indices
125
-
-`indices_above_thresh(arr, threshold)` - Contiguous regions above threshold
126
-
-`local_extrema(signal, comp)` - Find local maxima/minima
127
-
-`find_local_extrema(signal, start; findmax, right_on_ties)` - Hill-climb to extremum
128
-
-`uniformhist(values, bins)` / `uniformhist!(counts, values, bins)` - Fast histogram
129
-
-`filter_no_collisions(as, bs, radius)` - Remove elements too close to reference
130
-
-`window_counts(times, duration)` - Count events in sliding window
0 commit comments