phys2bids.physio_obj.BlueprintInput

class phys2bids.physio_obj.BlueprintInput(timeseries, freq, ch_name, units, trigger_idx, num_timepoints_found=None, thr=None, time_offset=0)[source]

Main input object for phys2bids.

Contains the blueprint to be populated. !!! Pay attention: there’s rules on how to populate this object. See below (“Attention”) !!!

timeseries

List of numpy 1d arrays - one for channel, plus one for time. Time channel has to be the first. Contains all the timeseries recorded. Supports different frequencies!

Type:

(ch, [tps]) list

freq

List of floats - one per channel. Contains all the frequencies of the recorded channel. Support different frequencies!

Type:

(ch) list of floats

ch_name

List of names of the channels - can be the header of the columns in the output files.

Type:

(ch) list of strings

units

List of the units of the channels.

Type:

(ch) list of strings

trigger_idx

The trigger index. Optional. Default is 0.

Type:

int

num_timepoints_found

Amount of timepoints found in the automatic count. This is initialised as “None” and then computed internally, if check_trigger_amount() is run.

Type:

int or None

thr

Threshold used by check_trigger_amount() to detect trigger points. This is initialised as “None” and then computed internally, if check_trigger_amount() is run.

Type:

float or None

time_offset

Time offset found by check_trigger_amount(). This is initialised as 0 and then computed internally, if check_trigger_amount() is run.

Type:

float

ch_amount:

Property. Returns number of channels (ch).

rename_channels:

Changes the list “ch_name” in a controlled way.

return_index:

Returns the proper list entry of all the properties of the object, given an index.

delete_at_index:

Returns all the proper list entry of the properties of the object, given an index.

check_trigger_amount:

Counts the amounts of triggers and corrects time offset in “time” ndarray. Also adds property ch_amount.

Notes

The timeseries (and as a consequence, all the other properties) should start with an entry for time. It should have the same length of the trigger - hence same sampling. Meaning: - timeseries[0] → ndarray representing time - timeseries[chtrig] → ndarray representing trigger - timeseries[0].shape == timeseries[chtrig].shape

As a consequence: - freq[0] == freq[chtrig] - ch_name[0] = ‘time’ - units[0] = ‘s’ - Actual number of channels +1 <= ch_amount