Commit 173d3956 authored by Médéric Boquien's avatar Médéric Boquien
Browse files

Let's avoid using costly np.max() functions on ordered arrays. The max will...

Let's avoid using costly np.max() functions on ordered arrays. The max will always be the last element. Also use the fact that the arrays are sorted to select the last 100 elements to compute the average SFR.
parent da5b1e5c
......@@ -82,12 +82,12 @@ class SED(object):
if value:
sfh_time, sfh_sfr = value
sfh_age = np.max(sfh_time) - sfh_time
sfh_age = sfh_time[-1] - sfh_time
self._sfh = value
self.add_info("sfr", sfh_sfr[-1], True, True)
self.add_info("average_sfr", np.mean(sfh_sfr[sfh_age <= AV_LAPSE]),
self.add_info("average_sfr", np.mean(sfh_sfr[-AV_LAPSE:]),
True, True)
self.add_info("age", np.max(sfh_time), False, True)
self.add_info("age", sfh_time[-1], False, True)
@property
def fnu(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment