Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeseries attributes like t.sampling_rate should be more tightly integrated #90

Open
ivanov opened this issue Nov 5, 2011 · 2 comments

Comments

@ivanov
Copy link
Member

ivanov commented Nov 5, 2011

right now, not only do sampling_rate and sampling_interval not know about each other, so you have to set both if you're changing them, but they also don't know about their underlying data.

In [21]: ts.UniformTime(0,10,10)
Out[21]: UniformTime([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9.], time_unit='s')

In [22]: ut = _

In [23]: ut*10
Out[23]: UniformTime([  0.,  10.,  20.,  30.,  40.,  50.,  60.,  70.,  80.,  90.], time_unit='s')

In [24]: ut2 = ut*10

In [25]: ut2.sampling_rate
Out[25]: 1.0 Hz
@arokem
Copy link
Member

arokem commented Nov 5, 2011

OK - I think that this refers to your recent commit, here:

4fd9528

So:

In [24]: ut
Out[24]: UniformTime([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.], time_unit='s')

In [25]: ut *= 2
In [26]: ut
Out[26]: UniformTime([ 0., 2., 4., 6., 8., 10., 12., 14., 16., 18.], time_unit='s')

In [27]: ut.sampling_interval
Out[27]: 2.0 s

and:

In [28]: ut.sampling_interval
Out[28]: 0.5 Hz

On the other hand:

In [28]: ut.duration
Out[28]: 10.0 s

Maybe these functions could change the duration as well?

@arokem
Copy link
Member

arokem commented Nov 5, 2011

And this is also true:

In [35]: ut = ts.UniformTime(0,10,10)

In [36]: ut.sampling_rate = 2

In [37]: ut
Out[37]: UniformTime([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.], time_unit='s')

What do you think about that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants