desihub / specter

A toolkit for simulating multi-object spectrographs
Other
8 stars 7 forks source link

Memory #49

Closed oleksandr-pavlyk closed 7 years ago

oleksandr-pavlyk commented 7 years ago

In fit_traces moved creation of array of rescaled values out of the loop, since it was the same on each iteration.

While rescaling array values to [-1,1] grouped factors so that array is multiplied by a scalar once, rather than twice.

when eval is called with vector ispec use legval with tensor input, rather than use comprehension with multiple calls to legval with vector coefficients.

Now:

(knltest_base) [19:25:00 fxsatlin04 code]$ python compare-extract.py reference.npz  test6.npz
Runtime 1.6x faster: 8.4 -> 5.2 sec
Comparing results:
key   exact  close
flux  False  True
ivar  False  True
R     False  True
oleksandr-pavlyk commented 7 years ago

@sbailey reference.npz was saved using the pre-dungeon master of specter, like you suggested, which explains the large speed-up factor.

sbailey commented 7 years ago

Thanks! Merging into memory branch now before final cleanup of memory branch to merge with master.