How to load .ephys data.

In this part, we are going to load some .ephys data which is the file format that Jan has created. The format is pretty straightforward to understand and to work with.  
Within RZ2ephys.py there is a function called readEphysFile() to load those files. Once the .ephys file has been loaded using:
 data, ci_stim = ephysData = ep.readEphysFile(fileName) 
the variable data contains all the sweeps we have saved to disk during an experiment.
To do so, we could E.g. use the Ephys_Search.py program, open it in Spyder, and set the filename E.g. to "H:/Ephys/data.ephys" 
After the program is done saving the data, we can open it and play it back.
This can be seen in example21()
Note, that we will only see raw data since example21() does not perform any data analysis.

import RZ2ephys as ep
from matplotlib import pyplot as plt
import pandas as pd
def example21():   
    print("")
    print("Let's process ephys sata ")
    print("let's build a pipeline to process some actual data")    
    #name the dataSource -- out entry point of the pipeline ephysDataPipeline
    ephysDataPipeline = pipeline.Datasource()    
    ephysDataPipeline.setName("Eyphs PushDataSource")
    aDatasink = pipeline.Datasink()
    aDatasink.setName("Eyphs DataSink")
    aPlugin = pipeline.MplSweepDataDisplay(plt)
    aPlugin.setName("Eyphs DataDisplay")
    ephysDataPipeline.setOutput(aPlugin)
    aPlugin.setOutput(aDatasink)
     
    #load some data
    rootDir = 'H:\Ephys'
    fileName = rootDir+'\data.ephys.ephys'
    csv_df = pd.read_csv(rootDir+"\data.ephys.csv")
    data, ci_stim = ephysData = ep.readEphysFile(fileName)
    print("Data loaded...")
    
     #get the number of sweeps
    numSweeps = len(data)
    print("numSweeps: ", numSweeps)

    while True:
        # go through all the sweeps and make one data frame per sweep
        for sweepIdx in range(numSweeps):
            sweepDataFrame = pipeline.Dataframe()
            sweepDataFrame.setFrameNumber(sweepIdx)
            sweepDataFrame.setData(data[sweepIdx])
            ephysDataPipeline.addDataframe(sweepDataFrame)
            ephysDataPipeline.run()