Skip to content

Commit

Permalink
fix_t functionality restored, passing inspiral kwargs to ode func class
Browse files Browse the repository at this point in the history
  • Loading branch information
cchapmanbird committed Nov 27, 2024
1 parent f8f14f1 commit 6c30559
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
9 changes: 8 additions & 1 deletion few/trajectory/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ def __call__(
new_t = np.arange(int(T/dt)) * dt

# upsample everything
out = tuple(self.inspiral_generator.eval_integrator_spline(new_t).T)
upsamp_traj = self.inspiral_generator.eval_integrator_spline(new_t).T
if fix_t:
if np.any(upsamp_traj[1] == 0):

trunc_ind = np.where(upsamp_traj[1] == 0)[0][0]
upsamp_traj = upsamp_traj[:,:trunc_ind]
new_t = new_t[:trunc_ind]
out = tuple(upsamp_traj)

return (new_t,) + out
2 changes: 1 addition & 1 deletion few/trajectory/inspiral.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def __init__(

self.enforce_schwarz_sep = enforce_schwarz_sep
self.inspiral_generator = get_integrator(
func, file_directory=file_directory, enforce_schwarz_sep=enforce_schwarz_sep, rootfind_separatrix=rootfind_separatrix
func, file_directory=file_directory, enforce_schwarz_sep=enforce_schwarz_sep, rootfind_separatrix=rootfind_separatrix, **kwargs
)

self.func = self.inspiral_generator.func
Expand Down
28 changes: 14 additions & 14 deletions few/trajectory/integrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,19 @@ def get_integrator(func, file_directory=None, **kwargs):

# integrator.add_ode(func_i.encode(), file_directory.encode())

func_inst = func(file_directory=file_directory)

if func_inst.integrate_constants_of_motion:
return AELQIntegrate(
func,
file_directory=file_directory,
**kwargs,
)
else:
return APEXIntegrate(
func,
file_directory=file_directory,
**kwargs,
)
# if func_inst.integrate_constants_of_motion:
# return AELQIntegrate(
# func,
# file_directory=file_directory,
# **kwargs,
# )
# else:
return APEXIntegrate(
func,
file_directory=file_directory,
**kwargs,
)

class Integrate:
def __init__(
Expand All @@ -115,12 +114,13 @@ def __init__(
rootfind_separatrix: bool=True,
enforce_schwarz_sep: bool=False,
file_directory: Optional[str]=None,
**kwargs
):
self.buffer_length = buffer_length
self.file_directory = file_directory

self.base_func = func
self.func = func(file_directory=file_directory)
self.func = func(file_directory=file_directory, **kwargs)

self.ode_info = get_ode_properties(self.func)

Expand Down

0 comments on commit 6c30559

Please sign in to comment.