Given a TemporalData object, can I determine whether it's a TimeSeries or an EventSeries?

5

If I have a function that accepts TemporalData objects, is there some mechanism whereby it can determine what kind of object it gets (TimeSeries vs. EventSeries)?

Michael Stern

Posted 2016-07-12T15:36:46.147

Reputation: 4 380

Answers

6

data = RandomReal[{-1, 1}, 10];
ts = TimeSeries[data, Automatic];
es = EventSeries[data, Automatic];

First/@{es, ts}

{EventSeries, TimeSeries}

or

eventSeriesQ = First@#===EventSeries &

eventSeriesQ/@{es, ts}

{True, False}

kglr

Posted 2016-07-12T15:36:46.147

Reputation: 302 076