def set_agelim(self, redshift): ''' Set the Age limit based on age of the universe ''' C = Cosmology() # self.age_lims[1] = np.log10(C.lookback_time(20.) - # C.lookback_time(redshift)) self.age = np.log10(C.lookback_time(20.) - C.lookback_time(redshift)) self.tdiff = np.diff(10**np.vstack([[0.] + self.ages, [self.age + 9.] * (len(self.ages) + 1)]).min(axis=0))
def set_agelim(self, redshift): ''' Set the Age limit based on age of the universe ''' C = Cosmology() self.age = np.log10(C.lookback_time(20.) - C.lookback_time(redshift)) # adjust priors on all age bins that are too old indx_too_old = np.where( self.age < np.array(self.ages)-9. )[0] if len(indx_too_old) > 1: for num in indx_too_old[1:]+1: setattr(self, 'sfr_' + str(num), -99.) setattr(self, 'sfr_' + str(num) + '_lims', [-99-1e-9,-99+1e-9]) setattr(self, 'sfr_' + str(num) + '_delta', 1e-9)
def get_max_ssp_age(args, z=None): ''' Identify the maximum SSP age for the sample (i.e., at upper/lower redshifts) Max SSP age is the time between redshift z=20 and redshift of the galaxy Parameters ---------- args : class The args class is carried from function to function with information from command line input and config.py z : float (optional) if specific redshift is passed, evaluate max age at that redshift otherwise, evaluate for the range of redshifts of the sample Returns ------- maxage : tuple of (float, float) the youngest and oldest maximum age (in log years) of sample galaxies ''' C = Cosmology() if z is not None: maxage = np.log10(C.lookback_time(20) - C.lookback_time(z)) + 9. return maxage if not args.test: F = Table.read(args.filename, format='ascii') z = F['z'] zrange = (min(z), max(z)) else: zrange = args.test_zrange # ages in log years: maxage_lo = np.log10(C.lookback_time(20) - C.lookback_time(zrange[1])) + 9. maxage_hi = np.log10(C.lookback_time(20) - C.lookback_time(zrange[0])) + 9. return (maxage_lo, maxage_hi)
def set_agelim(self, redshift): ''' Set the Age limit based on age of the universe ''' C = Cosmology() self.age = np.log10(C.lookback_time(20.) - C.lookback_time(redshift))