diff --git a/posydon/binary_evol/DT/step_merged.py b/posydon/binary_evol/DT/step_merged.py index 9f4867368..d3c32bee3 100644 --- a/posydon/binary_evol/DT/step_merged.py +++ b/posydon/binary_evol/DT/step_merged.py @@ -91,15 +91,23 @@ def __call__(self,binary): merged_star_properties = self.merged_star_properties if self.verbose: - print("Before Merger", binary.star_1.state, binary.star_2.state, - binary.state, binary.event) - print("M1 , M2, he_core_mass1, he_core_mass2: ", - binary.star_1.mass, binary.star_2.mass, - binary.star_1.he_core_mass, binary.star_2.he_core_mass) - print("star_1.center_he4, star_2.center_he4, star_1.surface_he4, " - "star_2.surface_he4: ", binary.star_1.center_he4, - binary.star_2.center_he4, binary.star_1.surface_he4, - binary.star_2.surface_he4) + print("Before Merger:\n" + f"_____________\n") + print(f"M1 = {binary.star_1.mass}\n" + f"M2 = {binary.star_2.mass}\n" + f"he_core_mass1 = {binary.star_1.he_core_mass}\n" + f"he_core_mass2 = {binary.star_2.he_core_mass}\n" + f"co_core_mass1 = {binary.star_1.co_core_mass}\n" + f"co_core_mass2 = {binary.star_2.co_core_mass}\n") + print(f"star_1.center_h1 = {binary.star_1.center_h1}\n" + f"star_2.center_h1 = {binary.star_2.center_h1}\n" + f"star_1.center_he4 = {binary.star_1.center_he4}\n" + f"star_2.center_he4 = {binary.star_2.center_he4}\n" + f"star_1.center_c12 = {binary.star_1.center_c12}\n" + f"star_2.center_c12 = {binary.star_2.center_c12}\n" + f"star_1.surface_he4 = {binary.star_1.surface_he4}\n" + f"star_2.surface_he4 = {binary.star_2.surface_he4}\n" + f"_____________\n") if binary.state == "merged": if binary.event == 'oMerging1': @@ -121,428 +129,616 @@ def __call__(self,binary): else: raise ValueError("step_merged initiated but binary is not in valid merging state!") - binary.event = None + #binary.event = None if self.verbose: - print("After Merger", binary.star_1.state, binary.star_2.state, - binary.state, binary.event) - print("M_merged , he_core_mass merged: ", binary.star_1.mass, - binary.star_1.he_core_mass) - print("star_1.center_he4, star_1.surface_he4: ", - binary.star_1.center_he4, binary.star_1.surface_he4) + print("After Merger:\n" + f"_____________\n" + f"star_1.state = {binary.star_1.state}\n" + f"star_2.state = {binary.star_2.state}\n" + f"binary.state = {binary.state}\n" + f"binary.event = {binary.event}\n") + if binary.event == 'oMerging1': + print(f"M_merged = {binary.star_1.mass}\n" + f"he_core_mass merged = {binary.star_1.he_core_mass}\n" + f"co_core_mass merged = {binary.star_1.co_core_mass}\n") + print(f"star_1.center_h1 = {binary.star_1.center_h1}\n" + f"star_1.center_he4 = {binary.star_1.center_he4}\n" + f"star_1.center_c12 = {binary.star_1.center_c12}\n" + f"star_1.surface_he4 = {binary.star_1.surface_he4}\n") + elif binary.event=='oMerging2': + print(f"M_merged = {binary.star_2.mass}\n" + f"he_core_mass merged = {binary.star_2.he_core_mass}\n" + f"co_core_mass merged = {binary.star_2.co_core_mass}\n") + print(f"star_2.center_h1 = {binary.star_2.center_h1}\n" + f"star_2.center_he4 = {binary.star_2.center_he4}\n" + f"star_2.center_c12 = {binary.star_2.center_c12}\n" + f"star_2.surface_he4 = {binary.star_2.surface_he4}\n") super().__call__(binary) - def merged_star_properties(self, star_base, comp): + def mass_weighted_avg(self, star1, star2, abundance_name, mass_weight1="mass", mass_weight2='mass'): + """Compute the mass-weighted average of an abundance between two stars. + + Parameters + ---------- + star1 : SingleStar + Primary star + star2 : SingleStar + Companion star + abundance_name : str + Name of the SingleStar attribute to average. + mass_weight1 : str + Mass attribute to use as weight for star1. Special values + ``"H-rich_envelope_mass"`` and ``"He-rich_envelope_mass"`` are + computed on the fly; any other value is looked up directly on the + star object. + mass_weight2 : str or None + Mass attribute for star2. """ - Make assumptions about the core/total mass, and abundances of the star of a merged product. + # give NaN if the abundance is not defined for one of the stars + A1 = getattr(star1, abundance_name, np.nan) + A2 = getattr(star2, abundance_name, np.nan) + if A1 is None: + A1 = np.nan + if A2 is None: + A2 = np.nan + + if mass_weight1 == "mass": + M1 = getattr(star1, "mass", np.nan) + elif mass_weight1 == "H-rich_envelope_mass": + M1 = getattr(star1, "mass", np.nan) - getattr(star1, "he_core_mass", np.nan) + elif mass_weight1 == "He-rich_envelope_mass": + M1 = getattr(star1, "he_core_mass", np.nan) - getattr(star1, "co_core_mass", np.nan) + else: + M1 = getattr(star1, mass_weight1, np.nan) + + if M1 is None: + M1 = np.nan + + if mass_weight2 == "mass": + M2 = getattr(star2, "mass", np.nan) + elif mass_weight2 == "H-rich_envelope_mass": + M2 = getattr(star2, "mass", np.nan) - getattr(star2, "he_core_mass", np.nan) + elif mass_weight2 == "He-rich_envelope_mass": + M2 = getattr(star2, "he_core_mass", np.nan) - getattr(star2, "co_core_mass", np.nan) + else: + M2 = getattr(star2, mass_weight2, np.nan) - Similar to the table of merging in BSE + if M2 is None: + M2 = np.nan + + den = M1 + M2 + if not (np.isfinite(A1) and np.isfinite(A2) and np.isfinite(M1) and np.isfinite(M2)): + mass_weighted_avg_value = np.nan + elif den == 0: + mass_weighted_avg_value = np.nan + else: + mass_weighted_avg_value = (A1 * M1 + A2 * M2) / den + + if self.verbose: + print(f"Mass weighted average for {abundance_name}:\n" + f"weight 1: {mass_weight1}\n" + f"weight 2: {mass_weight2}\n" + f"A_base = {A1}\n" + f"M_base_abundance = {M1}\n" + f"A_comp = {A2}\n" + f"M_comp_abundance = {M2}\n" + f"mass_weighted_avg = {mass_weighted_avg_value}\n") + + return mass_weighted_avg_value + + def _apply_nan_attributes(self, star, extra_nan_keys=None): + """Set to np.nan the attributes of the star that are not expected to be meaningful after a merger event. + + Parameters set to np.nan are: + - all attributes containing the substrings + {"log_", "lg_", "surf_", "conv_", "lambda", "profile"} + - all attributes in the set: + {"c12_c12", "total_moment_of_inertia", "spin",} + + Parameters + ---------- + star: SingleStar + The star for which the attributes will be set to np.nan + extra_nan_keys: set of str + Set of keys to be set to np.nan in addition to the default ones. + """ + if extra_nan_keys is None: + extra_nan_keys = set() + + _NAN_SUBSTRINGS = ("log_", "lg_", "surf_", "conv_", "lambda", "profile") + _NAN_KEYS = set(["c12_c12", "total_moment_of_inertia", "spin"]) + + for key in STARPROPERTIES: + if any(sub in key for sub in _NAN_SUBSTRINGS) or (key in extra_nan_keys) or (key in _NAN_KEYS): + setattr(star, key, np.nan) + + def merged_star_properties(self, star_base, comp): + """Set the properties of the merged star after a merger event. + + Generally, the Roche lobe overflowing star becomes star_base, except + when the companion is further evolved than star_base, in which + case the comp becomes the base for the merged star. + + Abundances are mass-weighted averages of the two stars, with the + weights depending on the type of merger and the abundance considered. star_base: Single Star - is our base star that engulfs its companion. The merged star will have this star as a base + The star that engulfs its companion. + (generally the base for the merged_star) comp: Single Star - is the star that is engulfed + The star that is engulfed by star_base. """ - #by default the stellar attributes that keep the same value from the - #merged_star = copy.copy(star_base) + # By default the stellar attributes are kept from star_base. merged_star = star_base s1 = star_base.state s2 = comp.state - def mass_weighted_avg(star1=star_base,star2=comp, abundance_name="center_h1", mass_weight1="mass", mass_weight2=None): - A1 = getattr(star1, abundance_name) - A2 = getattr(star2, abundance_name) - if mass_weight1 == "H-rich_envelope_mass": - M1 = getattr(star1, "mass") - getattr(star1, "he_core_mass") - elif mass_weight1 == "He-rich_envelope_mass": - M1 = getattr(star1, "he_core_mass") - getattr(star1, "co_core_mass") - else: - M1 = getattr(star1, mass_weight1) - - if mass_weight2 is None: - mass_weight2 = mass_weight1 - if mass_weight2 == "H-rich_envelope_mass": - M2 = getattr(star2, "mass") - getattr(star2, "he_core_mass") - elif mass_weight2 == "He-rich_envelope_mass": - M2 = getattr(star2, "he_core_mass") - getattr(star2, "co_core_mass") - else: - M2 = getattr(star2, mass_weight2) - return (A1*M1 + A2*M2 ) / (M1+M2) # MS + MS if ( s1 in LIST_ACCEPTABLE_STATES_FOR_HMS and s2 in LIST_ACCEPTABLE_STATES_FOR_HMS): - #these stellar attributes change value + # Mix central and surface abundances of the two stars with + # mass-weighted averages based on the total masses of the two stars. + parameters_to_mix = ["center_h1", "center_he4", "center_c12", "center_n14", "center_o16", + "surface_h1", "surface_he4", "surface_c12", "surface_n14", "surface_o16"] + + for abundance_name in parameters_to_mix: + #TODO: should I check if the abundaces above end up in ~1 (?) + setattr(merged_star, abundance_name, self.mass_weighted_avg(star_base, + comp, + abundance_name=abundance_name, + mass_weight1="mass", + mass_weight2='mass')) + + # The change of masses occurs after the calculation of weighted averages merged_star.mass = (star_base.mass + comp.mass) * (1.-self.rel_mass_lost_HMS_HMS) - #TODO for key in ["center_h1", "center_he4", "center_c12", "center_n14","center_o16"]: - merged_star.center_h1 = mass_weighted_avg() - merged_star.center_he4 = mass_weighted_avg(abundance_name = "center_he4") - merged_star.center_c12 = mass_weighted_avg(abundance_name = "center_c12") - merged_star.center_n14 = mass_weighted_avg(abundance_name = "center_n14") - merged_star.center_o16 = mass_weighted_avg(abundance_name = "center_o16") - #TODO: should I check if the abundaces above end up in ~1 (?) - - # weigheted mixing on the surface abundances - merged_star.surface_h1 = mass_weighted_avg(abundance_name = "surface_h1") - merged_star.surface_he4 = mass_weighted_avg(abundance_name = "surface_he4") - merged_star.surface_c12 = mass_weighted_avg(abundance_name = "surface_c12") - merged_star.surface_n14 = mass_weighted_avg(abundance_name = "surface_n14") - merged_star.surface_o16 = mass_weighted_avg(abundance_name = "surface_o16") - - for key in STARPROPERTIES: - # these stellar attributes become np.nan - for substring in ["log_", "lg_", "surf_", "conv_", "lambda", "profile"]: - if (substring in key) : - setattr(merged_star, key, np.nan) - if key in [ "c12_c12", "center_gamma", - "avg_c_in_c_core", "total_moment_of_inertia", "spin", "envelope_binding_energy"]: - setattr(merged_star, key, np.nan) + + # Set parameters that are not expected to be meaningful after a merger to np.nan + self._apply_nan_attributes(merged_star, + extra_nan_keys=set(["center_gamma", + "avg_c_in_c_core", + "envelope_binding_energy"])) + + # Set companion to a massless remnant. massless_remnant = convert_star_to_massless_remnant(comp) - #postMS + MS + # postMS + MS elif (s1 in LIST_ACCEPTABLE_STATES_FOR_POSTMS and s2 in LIST_ACCEPTABLE_STATES_FOR_HMS): - merged_star.mass = star_base.mass + comp.mass #TODO: in step_CEE we need to eject part of the (common) envelope - - # weigheted mixing on the surface abundances of the whole comp with the envelope of star_base - merged_star.surface_h1 = mass_weighted_avg(abundance_name = "surface_h1", mass_weight1="H-rich_envelope_mass", mass_weight2="mass") - merged_star.surface_he4 = mass_weighted_avg(abundance_name = "surface_he4", mass_weight1="H-rich_envelope_mass", mass_weight2="mass") - merged_star.surface_c12 = mass_weighted_avg(abundance_name = "surface_c12", mass_weight1="H-rich_envelope_mass", mass_weight2="mass") - merged_star.surface_n14 = mass_weighted_avg(abundance_name = "surface_n14", mass_weight1="H-rich_envelope_mass", mass_weight2="mass") - merged_star.surface_o16 = mass_weighted_avg(abundance_name = "surface_o16", mass_weight1="H-rich_envelope_mass", mass_weight2="mass") + # weighted mixing on the surface abundances of the whole + # companion with the envelope of star_base + parameters_to_mix = ["surface_h1", "surface_he4", "surface_c12", "surface_n14", "surface_o16"] + for abundance_name in parameters_to_mix: + setattr(merged_star, abundance_name, self.mass_weighted_avg(star_base, + comp, + abundance_name=abundance_name, + mass_weight1="H-rich_envelope_mass", + mass_weight2="mass")) + + # The change of masses occurs after the calculation of weighted averages + # Note that the he core mass is unchanged, which means that + # adding the mass changes the envelope mass only. + merged_star.mass = star_base.mass + comp.mass - for key in STARPROPERTIES: - # these stellar attributes become np.nan - for substring in ["log_", "lg_", "surf_", "conv_", "lambda", "profile"]: - if (substring in key) : - setattr(merged_star, key, np.nan) - if key in [ "c12_c12", "center_gamma", - "avg_c_in_c_core", "total_moment_of_inertia", "spin"]: - setattr(merged_star, key, np.nan) + # Set parameters that are not expected to be meaningful after a merger to np.nan + self._apply_nan_attributes(merged_star) + # Set burning luminosities and star state. merged_star.log_LHe = star_base.log_LHe merged_star.log_LZ = star_base.log_LZ - merged_star.state = check_state_of_star(merged_star, star_CO=False) # TODO for sure this needs testing! + massless_remnant = convert_star_to_massless_remnant(comp) - # as above but opposite stars + # MS + postMS (the opposite of above) elif (s1 in LIST_ACCEPTABLE_STATES_FOR_HMS and s2 in LIST_ACCEPTABLE_STATES_FOR_POSTMS): + merged_star = comp + + parameters_to_mix = ["surface_h1", "surface_he4", "surface_c12", "surface_n14", "surface_o16"] + for abundance_name in parameters_to_mix: + setattr(merged_star, abundance_name, self.mass_weighted_avg(star_base, + comp, + abundance_name=abundance_name, + mass_weight1="mass", + mass_weight2="H-rich_envelope_mass",)) + + # The change of masses occurs after the calculation of weighted averages merged_star.mass = star_base.mass + comp.mass - merged_star.surface_h1 = mass_weighted_avg(abundance_name = "surface_h1", mass_weight2="H-rich_envelope_mass", mass_weight1="mass") - merged_star.surface_he4 = mass_weighted_avg(abundance_name = "surface_he4", mass_weight2="H-rich_envelope_mass", mass_weight1="mass") - merged_star.surface_c12 = mass_weighted_avg(abundance_name = "surface_c12", mass_weight2="H-rich_envelope_mass", mass_weight1="mass") - merged_star.surface_n14 = mass_weighted_avg(abundance_name = "surface_n14", mass_weight2="H-rich_envelope_mass", mass_weight1="mass") - merged_star.surface_o16 = mass_weighted_avg(abundance_name = "surface_o16", mass_weight2="H-rich_envelope_mass", mass_weight1="mass") - - for key in STARPROPERTIES: - # these stellar attributes become np.nan - for substring in ["log_", "lg_", "surf_", "conv_", "lambda", "profile"]: - if (substring in key) : - setattr(merged_star, key, np.nan) - if key in [ "c12_c12", "center_gamma", - "avg_c_in_c_core", "total_moment_of_inertia", "spin"]: - setattr(merged_star, key, np.nan) + # Set parameters that are not expected to be meaningful after a merger to np.nan + self._apply_nan_attributes(merged_star) + # Set burning luminosities and star state. merged_star.log_LHe = comp.log_LHe merged_star.log_LZ = comp.log_LZ + merged_star.state = check_state_of_star(merged_star, star_CO=False) - merged_star.state = check_state_of_star(merged_star, star_CO=False) # TODO for sure this needs testing! - massless_remnant = convert_star_to_massless_remnant(comp) + massless_remnant = convert_star_to_massless_remnant(star_base) - #postMS + postMS + # postMS + postMS elif (s1 in LIST_ACCEPTABLE_STATES_FOR_POSTMS and s2 in LIST_ACCEPTABLE_STATES_FOR_POSTMS): + # Weighted central abundances if merging cores. - # add total and core masses - for key in ["mass", "he_core_mass", "c_core_mass", "o_core_mass", "co_core_mass"]: - current = getattr(star_base, key) + getattr(comp, key) - setattr(merged_star, key,current) + parameters_to_mix = ["center_h1", "center_he4", "center_c12", "center_n14", "center_o16", + 'avg_c_in_c_core'] - # weighted central abundances if merging cores. Else only from star_base - if star_base.co_core_mass == 0 and comp.co_core_mass == 0: # two stars with Helium cores - merged_star.center_h1 = mass_weighted_avg(mass_weight1="he_core_mass") - merged_star.center_he4 = mass_weighted_avg(abundance_name = "center_he4", mass_weight1="he_core_mass") - merged_star.center_c12 = mass_weighted_avg(abundance_name = "center_c12", mass_weight1="he_core_mass") - merged_star.center_n14 = mass_weighted_avg(abundance_name = "center_n14", mass_weight1="he_core_mass") - merged_star.center_o16 = mass_weighted_avg(abundance_name = "center_o16", mass_weight1="he_core_mass") - elif (star_base.co_core_mass > 0 and comp.co_core_mass == 0): # star_base with CO core and the comp has a He core + # two stars with Helium cores + if star_base.co_core_mass == 0 and comp.co_core_mass == 0: + mass_weight1 = 'he_core_mass' + mass_weight2 = 'he_core_mass' + + for abundance_name in parameters_to_mix: + setattr(merged_star, abundance_name, self.mass_weighted_avg(star_base, + comp, + abundance_name = abundance_name, + mass_weight1 = mass_weight1, + mass_weight2 = mass_weight2)) + + setattr(merged_star, "center_gamma", np.nan) + + # star_base with CO core and the comp has a He core + elif (star_base.co_core_mass > 0 and comp.co_core_mass == 0): pass # the central abundances are kept as the ones of star_base - elif (comp.co_core_mass > 0 and star_base.co_core_mass == 0): # comp with CO core and the star_base has a He core - merged_star.center_h1 = comp.center_h1 - merged_star.center_he4 = comp.center_he4 - merged_star.center_c12 = comp.center_c12 - merged_star.center_n14 = comp.center_n14 - merged_star.center_o16 = comp.center_o16 + + # Companion with CO core and the star_base has a He core + elif (comp.co_core_mass > 0 and star_base.co_core_mass == 0): + + for abundance_name in parameters_to_mix: + setattr(merged_star, abundance_name, getattr(comp, abundance_name)) + + setattr(merged_star, "center_gamma", comp.center_gamma) + + # both stars have CO cores elif (star_base.co_core_mass > 0 and comp.co_core_mass > 0): - merged_star.center_h1 = mass_weighted_avg(mass_weight1="co_core_mass") #TODO : maybe he_core_mass makes more sense? - merged_star.center_he4 = mass_weighted_avg(abundance_name = "center_he4", mass_weight1="co_core_mass") - merged_star.center_c12 = mass_weighted_avg(abundance_name = "center_c12", mass_weight1="co_core_mass") - merged_star.center_n14 = mass_weighted_avg(abundance_name = "center_n14", mass_weight1="co_core_mass") - merged_star.center_o16 = mass_weighted_avg(abundance_name = "center_o16", mass_weight1="co_core_mass") + + #TODO : maybe he_core_mass makes more sense? + mass_weight1='co_core_mass' + mass_weight2='co_core_mass' + + for abundance_name in parameters_to_mix: + setattr(merged_star, abundance_name, self.mass_weighted_avg(star_base, + comp, + abundance_name=abundance_name, + mass_weight1=mass_weight1, + mass_weight2=mass_weight2)) + + setattr(merged_star, "center_gamma", np.nan) + else: - Pwarn("weird compbination of CO core masses during merging", "EvolutionWarning") - - # weigheted mixing on the surface abundances based on the envelopes of the two stars - merged_star.surface_h1 = mass_weighted_avg(abundance_name = "surface_h1", mass_weight1="H-rich_envelope_mass", mass_weight2="H-rich_envelope_mass") - merged_star.surface_he4 = mass_weighted_avg(abundance_name = "surface_he4", mass_weight1="H-rich_envelope_mass", mass_weight2="H-rich_envelope_mass") - merged_star.surface_c12 = mass_weighted_avg(abundance_name = "surface_c12", mass_weight1="H-rich_envelope_mass", mass_weight2="H-rich_envelope_mass") - merged_star.surface_n14 = mass_weighted_avg(abundance_name = "surface_n14", mass_weight1="H-rich_envelope_mass", mass_weight2="H-rich_envelope_mass") - merged_star.surface_o16 = mass_weighted_avg(abundance_name = "surface_o16", mass_weight1="H-rich_envelope_mass", mass_weight2="H-rich_envelope_mass") - - - for key in STARPROPERTIES: - # these stellar attributes become np.nan - for substring in ["log_", "lg_", "surf_", "conv_", "lambda", "profile"]: - if (substring in key) : - setattr(merged_star, key, np.nan) - if key in [ "c12_c12", "center_gamma", - "avg_c_in_c_core", "total_moment_of_inertia", "spin"]: - setattr(merged_star, key, np.nan) - merged_star.state = check_state_of_star(merged_star, star_CO=False) # TODO for sure this needs testing! + Pwarn("Unexpected combination of CO core masses during merging", "EvolutionWarning") + + additional_parameter_to_mix = ['surface_h1', 'surface_he4', 'surface_c12', 'surface_n14', 'surface_o16'] + + # Weighted mixing on the surface abundances based on the envelopes of the two stars + for abundance_name in additional_parameter_to_mix: + setattr(merged_star, abundance_name, self.mass_weighted_avg(star_base, + comp, + abundance_name=abundance_name, + mass_weight1="H-rich_envelope_mass", + mass_weight2="H-rich_envelope_mass")) + + # Add total and core masses after calculations of weighted average + for key in ["mass", "he_core_mass", "c_core_mass", "o_core_mass", "co_core_mass"]: + current = getattr(star_base, key) + getattr(comp, key) + setattr(merged_star, key,current) + + # Set parameters that are not expected to be meaningful after a merger to np.nan + self._apply_nan_attributes(merged_star) + + # TODO for sure this needs testing! + merged_star.state = check_state_of_star(merged_star, star_CO=False) massless_remnant = convert_star_to_massless_remnant(comp) - #postMS + HeMSStar + # postMS + HeMS elif (s1 in LIST_ACCEPTABLE_STATES_FOR_POSTMS and s2 in LIST_ACCEPTABLE_STATES_FOR_HeMS): + # Keep surface abundances from star_base. - # add total and core masses + parameters_to_mix = ["center_h1", "center_he4", "center_c12", "center_n14", "center_o16", "avg_c_in_c_core"] + + # Weighted central abundances if merging cores. + # two stars with only Helium cores, not CO cores + if star_base.co_core_mass == 0 and comp.co_core_mass == 0: + + for abundance_name in parameters_to_mix: + setattr(merged_star, abundance_name, self.mass_weighted_avg(star_base, + comp, + abundance_name=abundance_name, + mass_weight1="he_core_mass", + mass_weight2="he_core_mass")) + + setattr(merged_star, "center_gamma", np.nan) + + # star_base with CO core and the comp has just a He core (is a HeMS star) + # Keep central abundances as those from star_base. + elif (star_base.co_core_mass > 0 and comp.co_core_mass == 0): + pass + + else: + Pwarn("Unexpected combination of CO core masses during merging", "EvolutionWarning") + + # add total and core masses after abundance mass weighted calculations for key in ["mass", "he_core_mass", "c_core_mass", "o_core_mass", "co_core_mass"]: current = getattr(star_base, key) + getattr(comp, key) - setattr(merged_star, key,current) + setattr(merged_star, key, current) - # weighted central abundances if merging cores. Else only from star_base - if star_base.co_core_mass == 0 and comp.co_core_mass == 0: # two stars with only Helium cores, not CO cores - merged_star.center_h1 = mass_weighted_avg(mass_weight1="he_core_mass") - merged_star.center_he4 = mass_weighted_avg(abundance_name = "center_he4", mass_weight1="he_core_mass") - merged_star.center_c12 = mass_weighted_avg(abundance_name = "center_c12", mass_weight1="he_core_mass") - merged_star.center_n14 = mass_weighted_avg(abundance_name = "center_n14", mass_weight1="he_core_mass") - merged_star.center_o16 = mass_weighted_avg(abundance_name = "center_o16", mass_weight1="he_core_mass") - elif (star_base.co_core_mass > 0 and comp.co_core_mass == 0): # star_base with CO core and the comp has just a He core (is a HeMS star) - pass # the central abundances are kept as the ones of star_base - else: - Pwarn("weird compbination of CO core masses during merging", "EvolutionWarning") - - for key in STARPROPERTIES: - # these stellar attributes become np.nan - for substring in ["log_", "lg_", "surf_", "conv_", "lambda", "profile"]: - if (substring in key) : - setattr(merged_star, key, np.nan) - if key in [ "c12_c12", "center_gamma", - "avg_c_in_c_core", "total_moment_of_inertia", "spin"]: - setattr(merged_star, key, np.nan) - merged_star.state = check_state_of_star(merged_star, star_CO=False) # TODO for sure this needs testing! + # Set parameters that are not expected to be meaningful after a merger to np.nan + self._apply_nan_attributes(merged_star) + + # TODO for sure this needs testing! + merged_star.state = check_state_of_star(merged_star, star_CO=False) massless_remnant = convert_star_to_massless_remnant(comp) - # as above but opposite stars + # HeMS + postMS (the opposite of above) elif (s1 in LIST_ACCEPTABLE_STATES_FOR_HeMS and s2 in LIST_ACCEPTABLE_STATES_FOR_POSTMS): + # surface abundances from comp + merged_star = comp + parameters_to_mix = ["center_h1", "center_he4", "center_c12", "center_n14", "center_o16", "avg_c_in_c_core"] - # add total and core masses - for key in ["mass", "he_core_mass", "c_core_mass", "o_core_mass", "co_core_mass"]: - current = getattr(star_base, key) + getattr(comp, key) - setattr(merged_star, key,current) - - # weighted central abundances if merging cores. Else only from star_base + # Weighted central abundances if merging cores. Else only from comp if star_base.co_core_mass == 0 and comp.co_core_mass == 0: # two stars with only Helium cores, not CO cores - merged_star.center_h1 = mass_weighted_avg(mass_weight1="he_core_mass") - merged_star.center_he4 = mass_weighted_avg(abundance_name = "center_he4", mass_weight1="he_core_mass") - merged_star.center_c12 = mass_weighted_avg(abundance_name = "center_c12", mass_weight1="he_core_mass") - merged_star.center_n14 = mass_weighted_avg(abundance_name = "center_n14", mass_weight1="he_core_mass") - merged_star.center_o16 = mass_weighted_avg(abundance_name = "center_o16", mass_weight1="he_core_mass") - elif (star_base.co_core_mass == 0 and comp.co_core_mass > 0): # star_base is the HeMS Star and comp has a CO core - pass # the central abundances are kept as the ones of star_base + + for abundance_name in parameters_to_mix: + setattr(merged_star, abundance_name, self.mass_weighted_avg(star_base, + comp, + abundance_name=abundance_name, + mass_weight1="he_core_mass", + mass_weight2="he_core_mass")) + + setattr(merged_star, "center_gamma", np.nan) + + # star_base is the HeMS Star and comp has a CO core + # the central abundances are kept from comp + elif (star_base.co_core_mass == 0 and comp.co_core_mass > 0): + pass else: - Pwarn("weird compbination of CO core masses during merging", "EvolutionWarning") + Pwarn("Unexpected combination of CO core masses during merging", "EvolutionWarning") - for key in STARPROPERTIES: - # these stellar attributes become np.nan - for substring in ["log_", "lg_", "surf_", "conv_", "lambda", "profile"]: - if (substring in key) : - setattr(merged_star, key, np.nan) - if key in [ "c12_c12", "center_gamma", - "avg_c_in_c_core", "total_moment_of_inertia", "spin"]: - setattr(merged_star, key, np.nan) + # add total and core masses after weighted averages above + for key in ["mass", "he_core_mass", "c_core_mass", "o_core_mass", "co_core_mass"]: + current = getattr(star_base, key) + getattr(comp, key) + setattr(merged_star, key, current) - merged_star.state = check_state_of_star(merged_star, star_CO=False) # TODO for sure this needs testing! - massless_remnant = convert_star_to_massless_remnant(comp) + # Set parameters that are not expected to be meaningful after a merger to np.nan + self._apply_nan_attributes(merged_star) - #postMS + HeStar that is not in HeMS + # TODO for sure this needs testing! + merged_star.state = check_state_of_star(merged_star, star_CO=False) + massless_remnant = convert_star_to_massless_remnant(star_base) + + # postMS + postHeMS elif (s1 in LIST_ACCEPTABLE_STATES_FOR_POSTMS and s2 in LIST_ACCEPTABLE_STATES_FOR_POSTHeMS): + parameters_to_mix = ["center_h1", "center_he4", "center_c12", "center_n14", "center_o16", "avg_c_in_c_core"] + + # Weighted central abundances if merging cores + # Two stars with Helium cores + if star_base.co_core_mass == 0 and comp.co_core_mass == 0: + + for abundance_name in parameters_to_mix: + setattr(merged_star, abundance_name, + self.mass_weighted_avg(star_base, + comp, + abundance_name=abundance_name, + mass_weight1="he_core_mass", + mass_weight2="he_core_mass")) + + setattr(merged_star, "center_gamma", np.nan) + + # Star_base with CO core and the comp has a He core + # the central abundances are kept as the ones of star_base + elif (star_base.co_core_mass > 0 and comp.co_core_mass == 0): + pass + + # comp with CO core and the star_base has a He core + elif (comp.co_core_mass > 0 and star_base.co_core_mass == 0): + + for abundance_name in parameters_to_mix: + setattr(merged_star, abundance_name, getattr(comp, abundance_name)) + + setattr(merged_star, "center_gamma", comp.center_gamma) + + # both stars have CO cores + elif (star_base.co_core_mass > 0 and comp.co_core_mass > 0): + + for abundance_name in parameters_to_mix: + setattr(merged_star, abundance_name, + self.mass_weighted_avg(star_base, + comp, + abundance_name=abundance_name, + mass_weight1="co_core_mass", + mass_weight2="co_core_mass")) + + setattr(merged_star, "center_gamma", np.nan) + + else: + Pwarn("Unexpected combination of CO core masses during merging", "EvolutionWarning") + # add total and core masses for key in ["mass", "he_core_mass", "c_core_mass", "o_core_mass", "co_core_mass"]: current = getattr(star_base, key) + getattr(comp, key) - setattr(merged_star, key,current) + setattr(merged_star, key, current) - # weighted central abundances if merging cores. Else only from star_base - if star_base.co_core_mass == 0 and comp.co_core_mass == 0: # two stars with Helium cores - merged_star.center_h1 = mass_weighted_avg(mass_weight1="he_core_mass") - merged_star.center_he4 = mass_weighted_avg(abundance_name = "center_he4", mass_weight1="he_core_mass") - merged_star.center_c12 = mass_weighted_avg(abundance_name = "center_c12", mass_weight1="he_core_mass") - merged_star.center_n14 = mass_weighted_avg(abundance_name = "center_n14", mass_weight1="he_core_mass") - merged_star.center_o16 = mass_weighted_avg(abundance_name = "center_o16", mass_weight1="he_core_mass") - elif (star_base.co_core_mass > 0 and comp.co_core_mass == 0): # star_base with CO core and the comp has a He core - pass # the central abundances are kept as the ones of star_base - elif (comp.co_core_mass > 0 and star_base.co_core_mass == 0): # comp with CO core and the star_base has a He core - merged_star.center_h1 = comp.center_h1 - merged_star.center_he4 = comp.center_he4 - merged_star.center_c12 = comp.center_c12 - merged_star.center_n14 = comp.center_n14 - merged_star.center_o16 = comp.center_o16 - elif (star_base.co_core_mass > 0 and comp.co_core_mass > 0): - merged_star.center_h1 = mass_weighted_avg(mass_weight1="co_core_mass") - merged_star.center_he4 = mass_weighted_avg(abundance_name = "center_he4", mass_weight1="co_core_mass") - merged_star.center_c12 = mass_weighted_avg(abundance_name = "center_c12", mass_weight1="co_core_mass") - merged_star.center_n14 = mass_weighted_avg(abundance_name = "center_n14", mass_weight1="co_core_mass") - merged_star.center_o16 = mass_weighted_avg(abundance_name = "center_o16", mass_weight1="co_core_mass") - else: - Pwarn("weird compbination of CO core masses during merging", "EvolutionWarning") - - for key in STARPROPERTIES: - # these stellar attributes become np.nan - for substring in ["log_", "lg_", "surf_", "conv_", "lambda", "profile"]: - if (substring in key) : - setattr(merged_star, key, np.nan) - if key in [ "c12_c12", "center_gamma", - "avg_c_in_c_core", "total_moment_of_inertia", "spin"]: - setattr(merged_star, key, np.nan) - merged_star.state = check_state_of_star(merged_star, star_CO=False) # TODO for sure this needs testing! + # Set parameters that are not expected to be meaningful after a merger to np.nan + self._apply_nan_attributes(merged_star) + + # TODO for sure this needs testing! + merged_star.state = check_state_of_star(merged_star, star_CO=False) massless_remnant = convert_star_to_massless_remnant(comp) - # as above but the opposite stars + # postHeMS + postMS (the opposite of above) elif (s1 in LIST_ACCEPTABLE_STATES_FOR_POSTHeMS and s2 in LIST_ACCEPTABLE_STATES_FOR_POSTMS): + merged_star = comp + + parameters_to_mix = ["center_h1", "center_he4", "center_c12", "center_n14", "center_o16", "avg_c_in_c_core"] + + # weighted central abundances if merging cores + # two stars with Helium cores + if star_base.co_core_mass == 0 and comp.co_core_mass == 0: + + for abundance_name in parameters_to_mix: + setattr(merged_star, abundance_name, self.mass_weighted_avg(star_base, + comp, + abundance_name=abundance_name, + mass_weight1="he_core_mass", + mass_weight2="he_core_mass")) + + setattr(merged_star, "center_gamma", np.nan) + + # star_base with CO core and the comp has a He core + elif (star_base.co_core_mass > 0 and comp.co_core_mass == 0): + + for abundance_name in parameters_to_mix: + setattr(merged_star, abundance_name, getattr(star_base, abundance_name)) + + setattr(merged_star, "center_gamma", star_base.center_gamma) + + # comp with CO core and the star_base has a He core + # the central abundances are kept as the ones of comp + elif (comp.co_core_mass > 0 and star_base.co_core_mass == 0): + pass + + # both stars have CO cores + elif (star_base.co_core_mass > 0 and comp.co_core_mass > 0): + + for abundance_name in parameters_to_mix: + setattr(merged_star, abundance_name, self.mass_weighted_avg(star_base, comp, abundance_name=abundance_name, mass_weight1="co_core_mass", mass_weight2="co_core_mass")) + + setattr(merged_star, "center_gamma", np.nan) + + else: + Pwarn("Unexpected combination of CO core masses during merging", "EvolutionWarning") + # add total and core masses for key in ["mass", "he_core_mass", "c_core_mass", "o_core_mass", "co_core_mass"]: current = getattr(star_base, key) + getattr(comp, key) setattr(merged_star, key,current) - # weighted central abundances if merging cores. Else only from star_base - if star_base.co_core_mass == 0 and comp.co_core_mass == 0: # two stars with Helium cores - merged_star.center_h1 = mass_weighted_avg(mass_weight1="he_core_mass") - merged_star.center_he4 = mass_weighted_avg(abundance_name = "center_he4", mass_weight1="he_core_mass") - merged_star.center_c12 = mass_weighted_avg(abundance_name = "center_c12", mass_weight1="he_core_mass") - merged_star.center_n14 = mass_weighted_avg(abundance_name = "center_n14", mass_weight1="he_core_mass") - merged_star.center_o16 = mass_weighted_avg(abundance_name = "center_o16", mass_weight1="he_core_mass") - elif (star_base.co_core_mass > 0 and comp.co_core_mass == 0): # star_base with CO core and the comp has a He core - pass # the central abundances are kept as the ones of star_base - elif (comp.co_core_mass > 0 and star_base.co_core_mass == 0): # comp with CO core and the star_base has a He core - merged_star.center_h1 = comp.center_h1 - merged_star.center_he4 = comp.center_he4 - merged_star.center_c12 = comp.center_c12 - merged_star.center_n14 = comp.center_n14 - merged_star.center_o16 = comp.center_o16 - elif (star_base.co_core_mass > 0 and comp.co_core_mass > 0): - merged_star.center_h1 = mass_weighted_avg(mass_weight1="co_core_mass") - merged_star.center_he4 = mass_weighted_avg(abundance_name = "center_he4", mass_weight1="co_core_mass") - merged_star.center_c12 = mass_weighted_avg(abundance_name = "center_c12", mass_weight1="co_core_mass") - merged_star.center_n14 = mass_weighted_avg(abundance_name = "center_n14", mass_weight1="co_core_mass") - merged_star.center_o16 = mass_weighted_avg(abundance_name = "center_o16", mass_weight1="co_core_mass") - else: - Pwarn("weird compbination of CO core masses during merging", "EvolutionWarning") - - for key in STARPROPERTIES: - # these stellar attributes become np.nan - for substring in ["log_", "lg_", "surf_", "conv_", "lambda", "profile"]: - if (substring in key) : - setattr(merged_star, key, np.nan) - if key in [ "c12_c12", "center_gamma", - "avg_c_in_c_core", "total_moment_of_inertia", "spin"]: - setattr(merged_star, key, np.nan) - merged_star.state = check_state_of_star(merged_star, star_CO=False) # TODO for sure this needs testing! - massless_remnant = convert_star_to_massless_remnant(comp) - # HeStar + HeStar + # Set parameters that are not expected to be meaningful after a merger to np.nan + self._apply_nan_attributes(merged_star) + + # TODO for sure this needs testing! + merged_star.state = check_state_of_star(merged_star, star_CO=False) + massless_remnant = convert_star_to_massless_remnant(star_base) + + # He star + He star elif (s1 in STAR_STATES_HE_RICH and s2 in STAR_STATES_HE_RICH): + parameters_to_mix = ["center_h1", "center_he4", "center_c12", "center_n14", "center_o16", "avg_c_in_c_core"] + # weighted central abundances if merging cores. Else only from star_base + # two stars with Helium cores + if star_base.co_core_mass == 0 and comp.co_core_mass == 0: + + for abundance_name in parameters_to_mix: + setattr(merged_star, abundance_name, self.mass_weighted_avg(star_base, + comp, + abundance_name=abundance_name, + mass_weight1="he_core_mass", + mass_weight2="he_core_mass")) + + setattr(merged_star, "center_gamma", np.nan) + + # star_base with CO core and the comp has a He core + # the central abundances are kept as the ones of star_base + elif (star_base.co_core_mass > 0 and comp.co_core_mass == 0): + pass + + # comp with CO core and the star_base has a He core + elif (comp.co_core_mass > 0 and star_base.co_core_mass == 0): + + for abundance_name in parameters_to_mix: + setattr(merged_star, abundance_name, getattr(comp, abundance_name)) + + setattr(merged_star, "center_gamma", comp.center_gamma) + + # both stars have CO cores + elif (star_base.co_core_mass > 0 and comp.co_core_mass > 0): + + for abundance_name in parameters_to_mix: + setattr(merged_star, abundance_name, self.mass_weighted_avg(star_base, + comp, + abundance_name=abundance_name, + mass_weight1="co_core_mass", + mass_weight2="co_core_mass")) + + setattr(merged_star, "center_gamma", np.nan) + + else: + Pwarn("Unexpected combination of CO core masses during merging", "EvolutionWarning") + # add total and core masses for key in ["mass", "he_core_mass", "c_core_mass", "o_core_mass", "co_core_mass"]: current = getattr(star_base, key) + getattr(comp, key) setattr(merged_star, key,current) - # weighted central abundances if merging cores. Else only from star_base - if star_base.co_core_mass == 0 and comp.co_core_mass == 0: # two stars with Helium cores - merged_star.center_h1 = mass_weighted_avg(mass_weight1="he_core_mass") - merged_star.center_he4 = mass_weighted_avg(abundance_name = "center_he4", mass_weight1="he_core_mass") - merged_star.center_c12 = mass_weighted_avg(abundance_name = "center_c12", mass_weight1="he_core_mass") - merged_star.center_n14 = mass_weighted_avg(abundance_name = "center_n14", mass_weight1="he_core_mass") - merged_star.center_o16 = mass_weighted_avg(abundance_name = "center_o16", mass_weight1="he_core_mass") - elif (star_base.co_core_mass > 0 and comp.co_core_mass == 0): # star_base with CO core and the comp has a He core - pass # the central abundances are kept as the ones of star_base - elif (comp.co_core_mass > 0 and star_base.co_core_mass == 0): # comp with CO core and the star_base has a He core - merged_star.center_h1 = comp.center_h1 - merged_star.center_he4 = comp.center_he4 - merged_star.center_c12 = comp.center_c12 - merged_star.center_n14 = comp.center_n14 - merged_star.center_o16 = comp.center_o16 - elif (star_base.co_core_mass > 0 and comp.co_core_mass > 0): - merged_star.center_h1 = mass_weighted_avg(mass_weight1="co_core_mass") - merged_star.center_he4 = mass_weighted_avg(abundance_name = "center_he4", mass_weight1="co_core_mass") - merged_star.center_c12 = mass_weighted_avg(abundance_name = "center_c12", mass_weight1="co_core_mass") - merged_star.center_n14 = mass_weighted_avg(abundance_name = "center_n14", mass_weight1="co_core_mass") - merged_star.center_o16 = mass_weighted_avg(abundance_name = "center_o16", mass_weight1="co_core_mass") - else: - Pwarn("weird compbination of CO core masses during merging", "EvolutionWarning") - # weigheted mixing on the surface abundances based on the He-rich envelopes of the two stars - merged_star.surface_h1 = mass_weighted_avg(abundance_name = "surface_h1", mass_weight1="He-rich_envelope_mass", mass_weight2="He-rich_envelope_mass") - merged_star.surface_he4 = mass_weighted_avg(abundance_name = "surface_he4", mass_weight1="He-rich_envelope_mass", mass_weight2="He-rich_envelope_mass") - merged_star.surface_c12 = mass_weighted_avg(abundance_name = "surface_c12", mass_weight1="He-rich_envelope_mass", mass_weight2="He-rich_envelope_mass") - merged_star.surface_n14 = mass_weighted_avg(abundance_name = "surface_n14", mass_weight1="He-rich_envelope_mass", mass_weight2="He-rich_envelope_mass") - merged_star.surface_o16 = mass_weighted_avg(abundance_name = "surface_o16", mass_weight1="He-rich_envelope_mass", mass_weight2="He-rich_envelope_mass") - - for key in STARPROPERTIES: - # these stellar attributes become np.nan - for substring in ["log_", "lg_", "surf_", "conv_", "lambda", "profile"]: - if (substring in key) : - setattr(merged_star, key, np.nan) - if key in [ "c12_c12", "center_gamma", - "avg_c_in_c_core", "total_moment_of_inertia", "spin"]: - setattr(merged_star, key, np.nan) - merged_star.state = check_state_of_star(merged_star, star_CO=False) # TODO for sure this needs testing! + additional_parameter_to_mix = ['surface_h1', 'surface_he4', 'surface_c12', 'surface_n14', 'surface_o16'] + for abundance_name in additional_parameter_to_mix: + setattr(merged_star, abundance_name, self.mass_weighted_avg(star_base, + comp, + abundance_name=abundance_name, + mass_weight1="He-rich_envelope_mass", + mass_weight2="He-rich_envelope_mass")) + + # Set parameters that are not expected to be meaningful after a merger to np.nan + self._apply_nan_attributes(merged_star) + + # TODO for sure this needs testing! + merged_star.state = check_state_of_star(merged_star, star_CO=False) massless_remnant = convert_star_to_massless_remnant(comp) # Star + WD elif (s1 in STAR_STATES_NOT_CO and s2 in ["WD"]): - #WD is considered a stripped CO core + parameters_to_mix = ["center_h1", "center_he4", "center_c12", "center_n14", "center_o16", "avg_c_in_c_core"] + # WD is considered a stripped CO core + # WD would always be the comp, it cannot be the engulfing star (so no need to do the opposite stars case below) + + # weighted central abundances if merging cores. Else only from star_base + # comp with CO core and the star_base has not + if (comp.co_core_mass is not None and star_base.co_core_mass == 0): + + for abundance_name in parameters_to_mix: + setattr(merged_star, abundance_name, getattr(comp, abundance_name)) + + setattr(merged_star, "center_gamma", comp.center_gamma) + + + # Star_base with CO core and the comp is a WD (so has a CO core) + elif (comp.co_core_mass is not None and star_base.co_core_mass > 0): + + for abundance_name in parameters_to_mix: + setattr(merged_star, abundance_name, self.mass_weighted_avg(star_base, + comp, + abundance_name=abundance_name, + mass_weight1="co_core_mass", + mass_weight2="co_core_mass")) + + setattr(merged_star, "center_gamma", np.nan) + + else: + Pwarn("Unexpected combination of CO core masses during merging", "EvolutionWarning") + # add total and core masses for key in ["mass", "he_core_mass", "c_core_mass", "o_core_mass", "co_core_mass"]: current = getattr(star_base, key) + getattr(comp, "mass") setattr(merged_star, key,current) - # weighted central abundances if merging cores. Else only from star_base - if (comp.co_core_mass > 0 and star_base.co_core_mass == 0): # comp with CO core and the star_base has not - merged_star.center_h1 = comp.center_h1 - merged_star.center_he4 = comp.center_he4 - merged_star.center_c12 = comp.center_c12 - merged_star.center_n14 = comp.center_n14 - merged_star.center_o16 = comp.center_o16 - elif (star_base.co_core_mass > 0 and comp.co_core_mass > 0): - merged_star.center_h1 = mass_weighted_avg(mass_weight1="co_core_mass") - merged_star.center_he4 = mass_weighted_avg(abundance_name = "center_he4", mass_weight1="co_core_mass") - merged_star.center_c12 = mass_weighted_avg(abundance_name = "center_c12", mass_weight1="co_core_mass") - merged_star.center_n14 = mass_weighted_avg(abundance_name = "center_n14", mass_weight1="co_core_mass") - merged_star.center_o16 = mass_weighted_avg(abundance_name = "center_o16", mass_weight1="co_core_mass") - else: - Pwarn("weird compbination of CO core masses during merging", "EvolutionWarning") - - for key in STARPROPERTIES: - # these stellar attributes become np.nan - for substring in ["log_", "lg_", "surf_", "conv_", "lambda", "profile"]: - if (substring in key) : - setattr(merged_star, key, np.nan) - if key in [ "c12_c12", "center_gamma", - "avg_c_in_c_core", "total_moment_of_inertia", "spin"]: - setattr(merged_star, key, np.nan) + + # Set parameters that are not expected to be meaningful after a merger to np.nan + self._apply_nan_attributes(merged_star) + merged_star.state = check_state_of_star(merged_star, star_CO=False) # TODO for sure this needs testing! massless_remnant = convert_star_to_massless_remnant(comp) diff --git a/posydon/binary_evol/DT/track_match.py b/posydon/binary_evol/DT/track_match.py index 07399cb70..445016364 100644 --- a/posydon/binary_evol/DT/track_match.py +++ b/posydon/binary_evol/DT/track_match.py @@ -52,10 +52,10 @@ val_names = [" ", "mass", "log_R", "center_h1", "surface_h1", "he_core_mass", "center_he4", "surface_he4", - "center_c12"] + "center_c12", "co_core_mass"] str_fmts = ["{:>14}", "{:>9}","{:>9}", "{:>9}", "{:>10}", "{:>12}", - "{:>10}", "{:>11}", "{:>10}"] + "{:>10}", "{:>11}", "{:>10}", "{:>12}"] row_str = " ".join(str_fmts) DIVIDER_STR = "_"*len(row_str.format(*[""]*len(str_fmts))) # MAJOR.MINOR version of imported scipy package @@ -285,7 +285,8 @@ def __init__( "surface_he4", "surface_h1", "log_R", - "center_c12" + "center_c12", + "co_core_mass" ] ) @@ -743,7 +744,8 @@ def match_to_single_star(self, star): f'surface_he4 = {star.surface_he4:.4f}, ', f'surface_h1 = {star.surface_h1:.4f}, ', f'he_core_mass = {star.he_core_mass:.3f}, ', - f'center_c12 = {star.center_c12:.4f}' + f'center_c12 = {star.center_c12:.4f},', + f'co_core_mass = {star.co_core_mass:.3f}' ) # done with matching attempts