Skip to content

Commit

Permalink
root_indx --> tree_root
Browse files Browse the repository at this point in the history
  • Loading branch information
aphearin committed Jun 20, 2024
1 parent 057f9be commit 10e0af5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions diffmah/fitting_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

DLOGM_CUT = 2.5
T_FIT_MIN = 1.0
HEADER = "# root_indx logm0 logtc early_index late_index t_peak loss n_points_per_fit fit_algo\n"
HEADER = "# tree_root logm0 logtc early_index late_index t_peak loss n_points_per_fit fit_algo\n"
DEFAULT_NCHUNKS = 50

LJ_Om = 0.310
Expand All @@ -31,7 +31,7 @@
def write_collated_data(outname, fit_data_strings, chunk_arr=None):
import h5py

root_indx = fit_data_strings[:, 0].astype(int)
tree_root = fit_data_strings[:, 0].astype(int)
logm0 = fit_data_strings[:, 1].astype(float)
logtc = fit_data_strings[:, 2].astype(float)
early_index = fit_data_strings[:, 3].astype(float)
Expand All @@ -42,7 +42,7 @@ def write_collated_data(outname, fit_data_strings, chunk_arr=None):
fit_algo = fit_data_strings[:, 8].astype(int)

with h5py.File(outname, "w") as hdf:
hdf["root_indx"] = root_indx
hdf["tree_root"] = tree_root
hdf["logm0"] = logm0
hdf["logtc"] = logtc
hdf["early_index"] = early_index
Expand Down Expand Up @@ -128,7 +128,7 @@ def log_mah_loss_uparams(u_params, loss_data):
loss_and_grads_kern = jjit(value_and_grad(log_mah_loss_uparams))


def get_outline_bad_fit(root_indx, loss_data, npts_mah, algo):
def get_outline_bad_fit(tree_root, loss_data, npts_mah, algo):
log_mah_target = loss_data[1]
logm0 = log_mah_target[-1]
logtc, early, late = -1.0, -1.0, -1.0
Expand All @@ -137,20 +137,20 @@ def get_outline_bad_fit(root_indx, loss_data, npts_mah, algo):
_floats = (logm0, logtc, early, late, t_peak, loss_best)
out_list = ["{:.5e}".format(float(x)) for x in _floats]
out_list = [str(x) for x in out_list]
out_list = [str(root_indx), *out_list, str(npts_mah), str(algo)]
out_list = [str(tree_root), *out_list, str(npts_mah), str(algo)]
outline = " ".join(out_list) + "\n"
return outline


def get_outline(root_indx, loss_data, u_p_best, loss_best, npts_mah, algo):
def get_outline(tree_root, loss_data, u_p_best, loss_best, npts_mah, algo):
"""Return the string storing fitting results that will be written to disk"""
t_peak = loss_data[2]
p_best = get_bounded_mah_params(DiffmahUParams(*u_p_best))
logm0, logtc, early, late = p_best
_floats = (logm0, logtc, early, late, t_peak, loss_best)
out_list = ["{:.5e}".format(float(x)) for x in _floats]
out_list = [str(x) for x in out_list]
out_list = [str(root_indx), *out_list, str(npts_mah), str(algo)]
out_list = [str(tree_root), *out_list, str(npts_mah), str(algo)]
outline = " ".join(out_list) + "\n"
return outline

Expand Down

0 comments on commit 10e0af5

Please sign in to comment.