def star_age(field, data): if data.ds.cosmological_simulation: conformal_age = data[ptype, 'conformal_birth_time'] formation_time = convert_ramses_ages(data.ds, conformal_age) formation_time = data.ds.arr(formation_time, 'code_time') else: formation_time = data['particle_birth_time'] return data.ds.current_time - formation_time
def particle_age(field, data): msg = ("The RAMSES particle_age field has been deprecated since " "it did not actually represent particle ages in all " "cases. To get the time when a particle was formed use " "the particle_birth_time field instead. To get the " "age of a star particle, use the star_age field") if not isinstance(data, FieldDetector): issue_deprecation_warning(msg, stacklevel=2) if data.ds.cosmological_simulation: conformal_age = data[ptype, 'conformal_birth_time'] ret = convert_ramses_ages(data.ds, conformal_age) return data.ds.arr(ret, 'code_time') else: return data[ptype, 'particle_birth_time']