Skip to content

Commit

Permalink
fixup more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexCarpenter46 committed Jan 16, 2025
1 parent 6a9f158 commit 2b84c0c
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 41 deletions.
12 changes: 9 additions & 3 deletions src/IO/H5/Python/FunctionsOfTimeFromVolume.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,14 @@ def functions_of_time_from_volume(
]

for fot_name, fot in functions_of_time.items():
functions_of_time_at_match_time_dict[fot_name] = (
fot.func_and_2_derivs(fot_times[which_obs_id])
)
fot_at_match_time = fot.func_and_2_derivs(fot_times[which_obs_id])
if len(fot_at_match_time[0]) != 1:
functions_of_time_at_match_time_dict[fot_name] = [
[coef for coef in x] for x in fot_at_match_time
]
else:
functions_of_time_at_match_time_dict[fot_name] = [
x[0] for x in fot_at_match_time
]

return functions_of_time_at_match_time_dict
58 changes: 30 additions & 28 deletions support/Pipelines/Bbh/Ringdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,28 +168,19 @@ def start_ringdown(
)
match_time = evaluated_fot_dict["MatchTime"]

# This section checks for functions of time in the dictionary and changes
# them from tuples to lists and or lists of lists. It also alters some
# values in the evaluated functions of time dictionary. The ringdown only
# requires the outer boundary expansion map so here we set the inner
# expansion map to the identity (this should be changed to a settle to const
# at a later time). We also set the translation map to 0 since translation
# is not supported in the transition to ringdown yet.
if "ExpansionOuterBoundary" in evaluated_fot_dict:
evaluated_fot_dict["ExpansionOuterBoundary"] = [
x[0] for x in evaluated_fot_dict["ExpansionOuterBoundary"]
]
else:
# This section checks for functions of time in the dictionary. It also
# alters some values in the evaluated functions of time dictionary. The
# ringdown only requires the outer boundary expansion map so here we set the
# inner expansion map to the identity (this should be changed to a settle to
# const at a later time). We also set the translation map to 0 since
# translation is not supported in the transition to ringdown yet.
if "ExpansionOuterBoundary" not in evaluated_fot_dict:
raise ValueError(
f"The transition to ringdown script requires the "
f" ExpansionOuterBoundary functions of time to be valid at the"
f" match time. "
)
if "Rotation" in evaluated_fot_dict:
evaluated_fot_dict["Rotation"] = [
[coef for coef in x] for x in evaluated_fot_dict["Rotation"]
]
else:
if "Rotation" not in evaluated_fot_dict:
evaluated_fot_dict["Rotation"] = [
[1.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0],
Expand Down Expand Up @@ -256,17 +247,28 @@ def start_ringdown(
ringdown_params["ShapeMapLMax"] = int(ringdown_ylm_coefs[0][4])
ringdown_params["PathToAhCCoefsH5File"] = path_to_output_h5
ringdown_params["AhCCoefsSubfilePrefix"] = output_subfile_prefix
ringdown_params["Rotation"] = str(evaluated_fot_dict["Rotation"][0])
ringdown_params["dtRotation"] = str(evaluated_fot_dict["Rotation"][1])
ringdown_params["dt2Rotation"] = str(evaluated_fot_dict["Rotation"][2])
ringdown_params["ExpansionOuterBdry"] = str(
evaluated_fot_dict["ExpansionOuterBoundary"]
)
ringdown_params["Translation"] = str(evaluated_fot_dict["Translation"][0])
ringdown_params["dtTranslation"] = str(evaluated_fot_dict["Translation"][1])
ringdown_params["dt2Translation"] = str(
evaluated_fot_dict["Translation"][2]
)

ringdown_params["Rotation"] = yaml.safe_dump(
evaluated_fot_dict["Rotation"][0], default_flow_style=True
).strip()
ringdown_params["dtRotation"] = yaml.safe_dump(
evaluated_fot_dict["Rotation"][1], default_flow_style=True
).strip()
ringdown_params["dt2Rotation"] = yaml.safe_dump(
evaluated_fot_dict["Rotation"][2], default_flow_style=True
).strip()
ringdown_params["ExpansionOuterBdry"] = yaml.safe_dump(
evaluated_fot_dict["ExpansionOuterBoundary"], default_flow_style=True
).strip()
ringdown_params["Translation"] = yaml.safe_dump(
evaluated_fot_dict["Translation"][0], default_flow_style=True
).strip()
ringdown_params["dtTranslation"] = yaml.safe_dump(
evaluated_fot_dict["Translation"][1], default_flow_style=True
).strip()
ringdown_params["dt2Translation"] = yaml.safe_dump(
evaluated_fot_dict["Translation"][2], default_flow_style=True
).strip()

# To avoid interpolation errors, put outer boundary of ringdown domain
# slightly inside the outer boundary of the inspiral domain
Expand Down
8 changes: 4 additions & 4 deletions support/Pipelines/Bbh/Ringdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,18 @@ DomainCreator:
# and has not been tested for other configurations.
SizeInitialValues: [0.0, -1.0, 0.0]
RotationMap:
InitialValues:
InitialQuaternions:
- {{ Rotation }}
- {{ dtRotation }}
- {{ dt2Rotation }}
DecayTimescaleRotation: 1.0
DecayTimescale: 1.0
ExpansionMap:
# During the ringdown, only the outer boundary's expansion map is
# applied.
InitialValues: [1.0, 0.0, 0.0]
InitialValuesOuterBoundary: {{ ExpansionOuterBdry }}
DecayTimescaleExpansion: 1.0
DecayTimescaleExpansionOuterBoundary: 1.0
DecayTimescale: 1.0
DecayTimescaleOuterBoundary: 1.0
TranslationMap:
InitialValues:
- {{ Translation }}
Expand Down
16 changes: 10 additions & 6 deletions tests/Unit/IO/H5/Python/Test_FunctionsOfTimeFromVolume.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,17 @@ def tearDown(self):

def test_functions_of_time_from_volume(self):
expected_rot_fot = [
DataVector(size=4, fill=0.5),
DataVector(size=4, fill=0.0),
DataVector(size=4, fill=0.0),
[0.5, 0.5, 0.5, 0.5],
[0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0],
]
expected_exp_fot = [0.0, 0.0, 0.0]
expected_exp_outer_bdry_fot = [0.0, 0.0, 0.0]
expected_translation_fot = [
[0.0, 0.0, 0.0],
[0.0, 0.0, 0.0],
[0.0, 0.0, 0.0],
]
expected_exp_fot = 3 * [DataVector(size=1, fill=0.0)]
expected_exp_outer_bdry_fot = 3 * [DataVector(size=1, fill=0.0)]
expected_translation_fot = 3 * [DataVector(size=3, fill=0.0)]

fot_dict = functions_of_time_from_volume(
str(self.volume_data), "ForContinuation", 6.0
Expand Down

0 comments on commit 2b84c0c

Please sign in to comment.