WakenAI / sc_filter_interp

WakenAI switched-cap filter model based on numpy and using interpolation.
1 stars 1 forks source link

Q: `sample_sig_chans` takes `sig_chans` but no `t_vec_out`? #1

Open thorwhalen opened 4 years ago

thorwhalen commented 4 years ago

Here goes....

    def sample_sig_chans(self, sig_chans, f_chan=1000., t_start=0., num_samp_kind='max-same', interp_kind='linear', split=0.5): ...

I see sig_chans is passed in, but no t_vec_out.

My thought is that t_vec_out is the x of the interpolation that happens in sample_sig_chans, so unless you have a (trustworthy) regular sample rate, you need the t_vec_out.

thorwhalen commented 4 years ago

Okay, I see a self._t_vec_out property that is written dynamically, and read in sample_sig_chans.

The titling question remains valid though: Perhaps better expressed as "why the different treatment of sig_chans and t_vec_out?

cyoung944 commented 4 years ago

This is a little strange. Would it make more sense to just require you pass t_vec_out? Alternatively, this sample_sig_chans doesn't need to be a class method and can be moved to a function outside of the class.

thorwhalen commented 4 years ago

Just in case any purists are watching: As it stand, sample_sig_chans is not a class method but an instance method. See for example here.

I just checked, and indeed _t_vec_out is the only instance attribute used in sample_sig_chans, so indeed, I believe it would be cleaner if refactored as a standalone function that took t_vec_out as an input.