fixed properties for non-initialized sims
@@ -146,20 +146,25 @@ class BaseSim(ParsObj):
def n(self):
''' Count the number of people -- if it fails, assume none '''
try: # By default, the length of the people dict
- output = len(self.people)
+ return len(self.people)
except: # If it's None or missing
- output = 0
- return output
+ return 0
@property
def npts(self):
''' Count the number of time points '''
+ try:
return int(self['n_days'] + 1)
+ except:
+ return 0
@property
def tvec(self):
''' Create a time vector '''
+ try:
return np.arange(self.npts)
+ except:
+ return np.arange([])
@property
def datevec(self):
@@ -171,7 +176,10 @@ class BaseSim(ParsObj):
simulation time step
"""
+ try:
return self['start_day'] + self.tvec * dt.timedelta(days=1)
+ except:
+ return []
def inds2dates(self, inds, dateformat=None):
