-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Hi @wrguenthner,
I've been starting to test PyThermo with the Tc1D software I've been developing and have encountered an issue I thought I would raise here. I've noticed that when I pass in a dense thermal history with something like 10,000 points, the cooling rate and time steps are quite small and this causes a crash in the ketcham_anneal() function:
Traceback (most recent call last):
File "/Users/whipp/Work/Modeling/Source/Python/tc1d-git/tc1d/tc1d_cli.py", line 810, in <module>
main()
File "/Users/whipp/Work/Modeling/Source/Python/tc1d-git/tc1d/tc1d_cli.py", line 803, in main
tc1d.prep_model(params)
File "/Users/whipp/Work/Modeling/Source/Python/tc1d-git/tc1d/tc1d.py", line 1574, in prep_model
run_model(params)
File "/Users/whipp/Work/Modeling/Source/Python/tc1d-git/tc1d/tc1d.py", line 2693, in run_model
) = calculate_ages_and_tcs(
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/whipp/Work/Modeling/Source/Python/tc1d-git/tc1d/tc1d.py", line 529, in calculate_ages_and_tcs
ahe_age, corr_ahe_age, zhe_age, corr_zhe_age = he_ages(
^^^^^^^^
File "/Users/whipp/Work/Modeling/Source/Python/tc1d-git/tc1d/tc1d.py", line 375, in he_ages
ap_anneal, ap_tT = tT.ketcham_anneal()
^^^^^^^^^^^^^^^^^^^
File "/Users/whipp/micromamba/envs/whipp-2025/lib/python3.12/site-packages/pythermo/tT_path.py", line 358, in ketcham_anneal
rho_r_array, relevant_tT = self.anneal(kinetics_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/whipp/micromamba/envs/whipp-2025/lib/python3.12/site-packages/pythermo/tT_path.py", line 202, in anneal
if present_old_track > 0:
^^^^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'present_old_track' where it is not associated with a value
I have a feeling this has something to do with how the data are handled in when tT.tT_interpolate() is called, as the returned array is simply: [[ 0. 273.15]], when I have passed in an array of 10,000 time-temperature pairs cooling from about 163 degrees over 49.5 My.
I suppose it might not be intended for users to pass in huge, dense t-T histories, but perhaps these should still be tolerated and the interpolation function should only modify the t-T history if needed. Or perhaps the reordering of the points and conversions to seconds and Kelvins should be separate, such that the interpolation would be optional if the t-T history is dense.
Any thoughts on this one?