These are chat archives for thunder-project/thunder

18th
May 2015
tomsains
@tomsains
May 18 2015 10:54
@freeman-lab Is there a way of selecting a range of indexes from a TimeSeries object. For example how would i select a particular epoch in an experiment so that I compute stats and maps for just that epoch?
Jason Wittenbach
@jwittenbach
May 18 2015 15:36
tomsains
@tomsains
May 18 2015 15:41
@jwittenbach thank you that is much simpler than my work around! I had been trying to use pythons inbuilt range function to create a sequence of numbers corresponding to
the index of the epoch and then select them all with thunder's select() function.
Jason Wittenbach
@jwittenbach
May 18 2015 16:00

Ah yeah, that would be a bit more circuitous! Though sometimes (at least in my day-to-day use cases) the experimental data comes with an extra "index" indicating the experimental epochs (e.g. [1,1,1,1,1,2,2,2,2,2,3,3,3,....]. In this case, another solution is to do something really similar to what you were trying. You can set this extra data as another index and then use the "multi-index" functionality that we recently built in:
http://thunder-project.org/thunder/docs/generated/thunder.TimeSeries.html#thunder.TimeSeries.selectByIndex

Something like

series = tsc.loadSeries(...)
epochs = [1,1,1,1,1,2,2,2,2,.....]
series.index = np.vstack([series.index, epochs]).T
ep = 5   #epoch of interest
subseries = series.selectByIndex(level=1, ep)