temp module

temp.CheckMissingPacketsTD(data, mode)[source]
temp.check_stream_data(data, signal=None, expected_tick_step=250)[source]

Checks a data stream for missing sequences, length mismatches, and irregular tick intervals.

Parameters:
  • data (dict) -- Dictionary containing 'GlobalSequences', 'GlobalPacketSizes', 'TicksInMses'

  • expected_tick_step (int) -- Expected difference between consecutive ticks in milliseconds

Returns:

Report containing missing sequences, length mismatches, and irregular tick indices

Return type:

dict

temp.correct4MissingSamples(LFP, TicksInS, GlobalPacketSizes)[source]

Replace missing samples with NaNs in LFP data based on received packets and their timestamps.

Parameters:
  • LFP -- dict with 'Fs' (sampling rate in Hz) and 'data' (numpy array of shape [nChannels, nSamples])

  • TicksInS -- numpy array of packet timestamps in seconds

  • GlobalPacketSizes -- list or array of packet sizes (number of samples per packet)

Returns:

Updated LFP with missing samples replaced by NaNs

Return type:

dict

temp.deduplicate_packets(raw_ticks, raw_sizes)[source]

Merges packets that share the same tick (stim OFF behaviour). Returns two aligned arrays:

ticks[i] -> timestamp in ms sizes[i] -> total bytes received at that tick (sum of all packets sharing it)

Indices are coherent: ticks[i] always corresponds to sizes[i].

temp.detect_gaps(ticks, expected_interval=250)[source]

Checks for missing samples between consecutive ticks. Returns a list of dicts describing each gap found.

temp.follows_pattern(lst, pattern=[38, 24, 38, 25])[source]
temp.morlet_wavelet(f, fs, n_cycles=7)[source]
temp.wavelet_transform(x, fs, freqs)[source]