PulseFiles

class PulseFile(intensity_in_mA=1, mode='biphasic', pulsewidth_in_ms=0.1, burstcount=1, isi_in_ms=49.8)[source]

Programmatically generate repetitive a biphasic or monophasic pulses

Parameters
  • intensity_in_mA (float = 1) – the amplitude of the first rectangular pulse

  • mode (str {"biphasic", "monophasic"}) – whether the pulse will be monophasic of biphasic, i.e. followed by a rectangular pulse with inverted amplitude

  • pulsewidth_in_ms (float = 0.1) – the width of each rectangular pulse

  • burstcount (int = 1) – how often these pulses will be repeated

  • isi_in_ms (float = 49.8) – how much time will pass between pulses

After initialization, run compile() to generate amplitudes and durations. These can be downloadwed with STG4000s download()

compile()[source]

compile the pulsefile to compressed amps and durs

Returns

  • amplitudes_in_mA (List[float]) – a list of amplitudes

  • durations_in_ms (List[float]) – a list of durations

property duration_in_ms

the duration of the complete stimulation including all bursts

decompress(amplitudes_in_mA=[0], durations_in_ms=[0], rate_in_hz=50000)[source]

decompress amplitudes and durations into a continuously sampled signal

Parameters
  • amplitudes_in_mA (List[float,] = [0]) – a list of amplitudes

  • durations_in_ms (List[float,] = [0]) – a list of the respective durationas

  • rate_in_hz (int = 50_000) – the sampling rate of the decompressed signal

Returns

signal – a list of amplitudes comprising the signal continuously sampled at the given rate

Return type

List[float]

dump(pulsefiles, filename='~/Desktop/test.dat')[source]

save Pulsefiles into a dat file readable by MC Stimulus II

Parameters
  • pulsefiles (List[PulseFile]) – a list of pulsefiles. The order defines the channel for which the respective pulsefile will be stored

  • filename (Union[str, Path] = '~/Desktop/test.dat') – the filename of the file

encode(pulsefile, channel=0)[source]

encode a pulsefile into ascii format

Parameters
  • pulsefile (PulseFile) – a pulsefile

  • channel (int) – the channel, indexing starts at 0

Return type

List[str]

Returns

  • content (str) – the content of the file

entrain(pulsefile, ibi_in_ms, count)[source]

compile and repeat a pulsefile separated by ibi_in_ms

Parameters
  • pulsefile (PulseFile) – defines a burst

  • ibi_in_ms (float) – how long to wait between bursts

  • count (int) – how many bursts you want to apply

Return type

Tuple[List[float], List[float]]

Returns

  • amps (List[float]) – a list of amplitudes

  • durs (List[float]) – a list of durations