slac207 / cs207project

MIT License
0 stars 4 forks source link

#40 Rewrite ArrayTimeSeries to take advantage of np storage, rewrite tests #41

Closed cocochrane closed 8 years ago

cocochrane commented 8 years ago

These are the changes in ArrayTimeSeries:

  1. init(): now checks sizes of times and values
  2. getitem(): uses np.take() which is faster than regular indexing (says the internet)
  3. setitem(): uses np.put() likewise faster than regular indexing/setting
  4. len(): uses np.size()
  5. values: just returns the values (doesn't need to cast into a np array again)
  6. times: just returns the times (doesn't need to cast into a np array again)
  7. interpolate: now uses np.searchsorted() instead of the binary_search code
  8. neg(): uses numpy multiplication
  9. abs(): uses numpy absolute value
  10. bool(): uses np.count_nonzero()
  11. add(): uses numpy addition
  12. mul(): uses numpy multiplication
  13. eqtimes(): uses np.array_equal()
  14. eqvalues(): uses np.array_equal()

Functions omitted (should just inherit these from the parent because I can't find a faster way to implement them):

  1. repr()
  2. str()
  3. iter()
  4. contains()
  5. itertimes()
  6. iteritems()
  7. itervalues()
  8. items()
  9. identity()
  10. lazy()
  11. pos()
  12. sub()
  13. eq()

@brennan-ae See anything on this bottom list that you think could be sped up? I was unsure whether I should use the numpy iterator?

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-0.2%) to 99.82% when pulling 454555f3d45d590549ceb22858add95667adc2c7 on ChangeArrayTS into c101a66c35b83bcee5560b0f18bee1b23ba08591 on master.