Skip to content

Commit

Permalink
Add comments to explain temperature interpolation in temperature_from…
Browse files Browse the repository at this point in the history
…_filter_ratio.py (#302)

* Adding equation explanation

* Trying to fix trailing-whitespace
  • Loading branch information
joyvelasquez authored Oct 22, 2024
1 parent c3923e4 commit c39ee68
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions xrtpy/response/temperature_from_filter_ratio.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,13 @@ def _derive_temperature(
# pixels are assigned a temperature of 0
ok_cnt[n] += 1

# Performs linear interpolation between two adjacent temperatures in Tmodel,
# based on the observed filter ratio (`data_ratio`) and the model ratios (`model_ratio`).
# `a` and `b` represent differences between the observed and model ratios.
# The equation weighs the temperatures proportionally, with more weight given
# to the temperature whose model ratio is closer to the observed filter ratio.
# This ensures a smooth transition between temperature values, providing a more
# accurate estimate when the observed filter ratio lies between two model ratios.
ok_num[ok_cnt != 1] = 0
a = np.abs(model_ratio[ok_num] - data_ratio)
b = np.abs(model_ratio[np.maximum((ok_num - 1), 0)] - data_ratio)
Expand Down

0 comments on commit c39ee68

Please sign in to comment.