Skip to content

Commit

Permalink
fixed correct_ash_fr correction calculation
Browse files Browse the repository at this point in the history
if the user specifies the ash fraction on ar basis
  • Loading branch information
mpecchi committed May 1, 2024
1 parent c3029ca commit e97a65b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/tga_data_analysis/tga.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,13 @@ def correct_file_values(
file["m_mg"] = file["m_p"]
file["m_p"] = file["m_mg"] / np.max(file["m_mg"]) * 100
if correct_ash_fr is not None:
file["m_p"] = file["m_p"] - np.min(file["m_p"]) + correct_ash_fr * 100
# set the ash value to zero
file["m_p"] = file["m_p"] - np.min(file["m_p"])
# shift the non-ash fraction up by enough to have ash_ar=correct_ash_fr
file["m_p"] = file["m_p"] + np.max(file["m_p"]) * (
correct_ash_fr / (1 - correct_ash_fr)
)
# scale everything to 100 %
file["m_p"] = file["m_p"] / np.max(file["m_p"]) * 100
file = file[file["T_C"] >= self.temp_initial_celsius].copy()
file["T_K"] = file["T_C"] + 273.15
Expand Down

0 comments on commit e97a65b

Please sign in to comment.