-
Notifications
You must be signed in to change notification settings - Fork 29
Fix output NaNs and event names #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
astroJeff
wants to merge
3
commits into
development-deprecated
Choose a base branch
from
fix_output_NaNs
base: development-deprecated
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -186,18 +186,18 @@ def __init__( | |
| def __call__(self, binary): | ||
| """Perform the CEE step for a BinaryStar object.""" | ||
| # Determine which star is the donor and which is the companion | ||
| if binary.event in ["oCE1", "oDoubleCE1"]: | ||
| if binary.event in ["CE1_start", "DCE_start"]: | ||
| donor_star = binary.star_1 | ||
| comp_star = binary.star_2 | ||
| elif binary.event in ["oCE2", "oDoubleCE2"]: | ||
| elif binary.event in ["CE2_start", "DCE_start"]: | ||
| donor_star = binary.star_2 | ||
| comp_star = binary.star_1 | ||
| else: | ||
| raise ValueError("CEE does not apply if `event` is not " | ||
| "`oCE1`, 'oDoubleCE1' or `oCE2`, 'oDoubleCE1'") | ||
| "'CE1_start', 'CE2_start', or 'DCE_start'") | ||
|
|
||
| # Check for double CE | ||
| if binary.event in ["oDoubleCE1", "oDoubleCE2"]: | ||
| if binary.event is "DCE_start": | ||
| double_CE = True | ||
| else: | ||
| double_CE = False | ||
|
|
@@ -214,23 +214,61 @@ def __call__(self, binary): | |
| 'stripped_He_Core_He_burning']: | ||
| # system merges | ||
| binary.state = 'merged' | ||
| if binary.event in ["oCE1", "oDoubleCE1"]: | ||
| binary.event = "oMerging1" | ||
| if binary.event in ["oCE2", "oDoubleCE2"]: | ||
| binary.event = "oMerging2" | ||
| if double_CE: | ||
| binary.event = 'DCE_merger' | ||
| else: | ||
| binary.event = 'CE_merger' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, CE_merger_start (or CE_merging_start) |
||
|
|
||
| for key in BINARYPROPERTIES: | ||
| # the binary attributes that are changed in the CE step | ||
| if key not in ["time", "state", "event", 'V_sys', | ||
| 'mass_transfer_case', | ||
| 'nearest_neighbour_distance']: | ||
| setattr(binary, key, np.nan) # the rest become np.nan | ||
| if key == 'mass_transfer_case': | ||
| setattr(binary, key, 'None') | ||
| stars = [donor_star, comp_star] | ||
| # for now we just add all initial mass to the (merger) star_1 | ||
| masses = [donor_star.mass + comp_star.mass, np.nan] | ||
| star_states = [donor_star.state, comp_star.state] | ||
| for star, star_state, mass in zip(stars, star_states, masses): | ||
| star.mass = mass | ||
| star.state = star_state | ||
| for key in STARPROPERTIES: | ||
| # the binary attributes that are changed in the CE step | ||
| if key not in ["mass", "state"]: | ||
| setattr(star, key, np.nan) | ||
| return | ||
|
|
||
| if self.common_envelope_option_for_HG_star == "pessimistic": | ||
| # Merging if HG donor | ||
| if donor_star.state in ['H-rich_Shell_H_burning']: | ||
| # system merges | ||
| binary.state = 'merged' | ||
| if binary.event in ["oCE1", "oDoubleCE1"]: | ||
| binary.event = "oMerging1" | ||
| if binary.event in ["oCE2", "oDoubleCE2"]: | ||
| binary.event = "oMerging2" | ||
|
|
||
| if double_CE: | ||
| binary.event = 'DCE_merger' | ||
| else: | ||
| binary.event = 'CE_merger' | ||
|
|
||
| for key in BINARYPROPERTIES: | ||
| # the binary attributes that are changed in the CE step | ||
| if key not in ["time", "state", "event", 'V_sys', | ||
| 'mass_transfer_case', | ||
| 'nearest_neighbour_distance']: | ||
| setattr(binary, key, np.nan) # the rest become np.nan | ||
| if key == 'mass_transfer_case': | ||
| setattr(binary, key, 'None') | ||
| stars = [donor_star, comp_star] | ||
| # for now we just add all initial mass to the (merger) star_1 | ||
| masses = [donor_star.mass + comp_star.mass, np.nan] | ||
| star_states = [donor_star.state, comp_star.state] | ||
| for star, star_state, mass in zip(stars, star_states, masses): | ||
| star.mass = mass | ||
| star.state = star_state | ||
| for key in STARPROPERTIES: | ||
| # the binary attributes that are changed in the CE step | ||
| if key not in ["mass", "state"]: | ||
| setattr(star, key, np.nan) | ||
| return | ||
|
|
||
| # Calculate binary's evolution | ||
|
|
@@ -668,26 +706,38 @@ def CEE_simple_alpha_prescription( | |
| print("during the assumed windloss phase after postCE") | ||
| print("with 'common_envelope_option_after_succ_CEE' :", | ||
| common_envelope_option_after_succ_CEE) | ||
| print("the orbit cahnged from postCEE : ", | ||
| print("the orbit changed from postCEE : ", | ||
| orbital_period_postCEE) | ||
| print("to : ", orbital_period_f) | ||
| separation_f = cf.orbital_separation_from_period(orbital_period_f, | ||
| mc1_f, mc2_f) | ||
|
|
||
| if state1_i == 'stripped_He_Central_He_depleted': | ||
| if donor == binary.star_1: | ||
| binary.event = 'CC1' | ||
| binary.event = 'CC1_start' | ||
| elif donor == binary.star_2: | ||
| binary.event = 'CC2' | ||
| binary.event = 'CC2_start' | ||
| else: | ||
| binary.event = None | ||
| if binary.event == 'CE1_start': | ||
| binary.event = 'CE1_end' | ||
| elif binary.event == 'CE2_start': | ||
| binary.event = 'CE2_end' | ||
| elif double_CE: | ||
| binary.event = 'DCE_end' | ||
| else: | ||
| raise ValueError( | ||
| "Impossible binary.event condition. binary.event = {}" | ||
| "dont know how to proceed", | ||
| format(binary.event)) | ||
|
|
||
|
|
||
|
|
||
|
|
||
| # Adjust binary properties | ||
| binary.separation = separation_f | ||
| binary.orbital_period = orbital_period_f | ||
| binary.eccentricity = 0.0 | ||
| binary.state = 'detached' | ||
| # binary.event = None | ||
|
|
||
| for key in BINARYPROPERTIES: | ||
| # the binary attributes that are changed in the CE step | ||
|
|
@@ -803,10 +853,28 @@ def CEE_simple_alpha_prescription( | |
| else: | ||
| # system merges | ||
| binary.state = 'merged' | ||
| if binary.event in ["oCE1", "oDoubleCE1"]: | ||
| binary.event = "oMerging1" | ||
| if binary.event in ["oCE2", "oDoubleCE2"]: | ||
| binary.event = "oMerging2" | ||
| binary.event = 'CE_merger' | ||
|
|
||
| for key in BINARYPROPERTIES: | ||
| # the binary attributes that are changed in the CE step | ||
| if key not in ["time", "state", "event", 'V_sys', | ||
| 'mass_transfer_case', | ||
| 'nearest_neighbour_distance']: | ||
| setattr(binary, key, np.nan) # the rest become np.nan | ||
| if key == 'mass_transfer_case': | ||
| setattr(binary, key, 'None') | ||
| # binary.event = 'END' | ||
| stars = [donor, comp_star] | ||
| # for now we just add all initial mass to the (merger) star_1 | ||
| masses = [m1_i+m2_i, np.nan] | ||
| star_states = [donor.state, comp_star.state] | ||
| for star, star_state, mass in zip(stars, star_states, masses): | ||
| star.mass = mass | ||
| star.state = star_state | ||
| for key in STARPROPERTIES: | ||
| # the binary attributes that are changed in the CE step | ||
| if key not in ["mass", "state"]: | ||
| setattr(star, key, np.nan) | ||
|
|
||
| if verbose: | ||
| print("system merges due to one of the two star's core filling" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe make it obvious it is at the onset/start of the process of merging (not just in general a merger product), by making it "DCE_merger_start", consistent with your implementation of "*_start" in this PR