-1

If a filter's group delay is N, the filtered signal using this filter is sig_filtered, what does sig_filtered[N::] mean in python?

I saw other usages of this python operator "::", e.g. A[::3] in another post (What is :: (double colon) in Python when subscripting sequences?), where A is a list. Can somebody give out a summary on how to use this python operator "::"?

Linda
  • 37
  • 5
  • "The filter's group delay is N" ... some context is needed. What is `sig_filtered` and what is a group delay? This is specific to some class and is not a general python thing. – tdelaney Dec 10 '20 at 23:33
  • 1
    It's not an operator, really, it's syntatic sugar for creating a slce object to pass to `sig_filtered[]` – juanpa.arrivillaga Dec 10 '20 at 23:40

1 Answers1

0

sig_filtered[N::] is the same as sig_filtered[N:] and the same as sig_filtered[N::1], or sig_filtered[N:len(sig_filtered):1], or sig_filtered[N:len(sig_filtered)].

There are three values which define a slice: start, stop and step, e.g. data[start:stop:step]

  • You can omit start and will default to 0.
  • You can omit stop and it will default to the full length.
  • You can omit step and it will default to 1.

These behave the same way as the arguments to the range function

zvone
  • 18,045
  • 3
  • 49
  • 77
  • I don't think any of those defaults are correct. Where did you get that from? – superb rain Dec 10 '20 at 23:42
  • @superbrain Of course it is a simplification, they default to `None`, but that explains nothing about the behaviour of the defaults. In case of a `list`, they behave as if the values I wrote were used. – zvone Dec 11 '20 at 01:35