Automated recordings

Sample automation of recording start/stop.

Minimal start example

import pyeCubeStream
from datetime import datetime

ec = pyeCubeStream.eCubeStream()
ec.add([ ('Headstages', 4), ('DigitalPanel', (6,10)) ])
    # add all channels on headstage 4, and channels 6-10 (inclusive) of the DigitalPanel

datetimestring = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
ec.remotesave('experiment1_' + datetimestring)
    # Will start recording experiment1_2021-04-17_14-03-01/ in the designated data directory

For more information on designating a data directory, see Pre-configuring options. This can also be changed at any time using the record command in ServerNode.

Predefined start automation

import pyeCubeStream
from datetime import datetime

# we define session names and what sources to include in an object of our own choosing;
# e.g., a list of (name, sources)
session_defs = [
    ( 'experiment1_', [('Headstages', 4), ('DigitalPanel', (1, 8))] ),
    ( 'experiment2_', [('Headstages', 8, (1, 128)), ('DigitalPanel', (1, 8))] ),
    ( 'experiment3_', [('Headstages', 10), ('AnalogPanel', (1, 4)), ('DigitalPanel', (9, 16))] )
]

for sessiondef in session_defs:
    ec = pyeCubeStream.eCubeStream() # Start a eCubeStream connection

    name = sessiondef[0] # session name from the above table
    sources = sessiondef[1] # predefined list of sources from the above table

    ec.add(sources)
    datetimestring = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
    ec.remotesave(name + datetimestring)
        # trigger recording, just like minimal start example above

    del ec # Close down and clean up all added sources

Minimal stop example

import pyeCubeStream
from datetime import datetime

ec = pyeCubeStream.eCubeStream()
recordsessions = ec.listremotesessions() # lists all running sessions
ec.remotestopsave(recordsessions[0]) # stop the first running session
Last modified April 17, 2021