@@ -1159,6 +1159,17 @@ def dielectronic_recombination_rate(self) -> u.cm**3 / u.s:
1159
1159
else :
1160
1160
raise ValueError (f"Unrecognized fit type { self ._drparams ['fit_type' ]} " )
1161
1161
1162
+ @cached_property
1163
+ @needs_dataset ('trparams' )
1164
+ @u .quantity_input
1165
+ def _total_recombination_rate (self ) -> u .cm ** 3 / u .s :
1166
+ temperature_data = self ._trparams ['temperature' ].to_value ('K' )
1167
+ rate_data = self ._trparams ['recombination_rate' ].to_value ('cm3 s-1' )
1168
+ f_interp = interp1d (temperature_data , rate_data , fill_value = 'extrapolate' , kind = 'cubic' )
1169
+ f_interp = PchipInterpolator (np .log10 (temperature_data ), np .log10 (rate_data ), extrapolate = True )
1170
+ rate_interp = 10 ** f_interp (np .log10 (self .temperature .to_value ('K' )))
1171
+ return u .Quantity (rate_interp , 'cm3 s-1' )
1172
+
1162
1173
@cached_property
1163
1174
@u .quantity_input
1164
1175
def recombination_rate (self ) -> u .cm ** 3 / u .s :
@@ -1172,18 +1183,43 @@ def recombination_rate(self) -> u.cm**3 / u.s:
1172
1183
1173
1184
\alpha_{R} = \alpha_{RR} + \alpha_{DR}
1174
1185
1186
+ .. warning::
1187
+
1188
+ For most ions, this total recombination rate is computed by summing the
1189
+ outputs of the `radiative_recombination_rate` and `dielectronic_recombination_rate` methods.
1190
+ However, for some ions, total recombination rate data is available in the
1191
+ so-called ``.trparams`` files. For these ions, the output of this method
1192
+ will *not* be equal to the sum of the `dielectronic_recombination_rate` and
1193
+ `radiative_recombination_rate` method. As such, when computing the total
1194
+ recombination rate, this method should always be used.
1195
+
1175
1196
See Also
1176
1197
--------
1177
1198
radiative_recombination_rate
1178
1199
dielectronic_recombination_rate
1179
1200
"""
1201
+ # NOTE: If the trparams data is available, then it is prioritized over the sum
1202
+ # of the dielectronic and radiative recombination rates. This is also how the
1203
+ # total recombination rates are computed in IDL. The reasoning here is that the
1204
+ # total recombination rate data, if available, is more reliable than the sum of
1205
+ # the radiative and dielectronic recombination rates. According to P. Young, there
1206
+ # is some slight controversy over this within some communities, but CHIANTI has chosen
1207
+ # to prioritize this data if it exists.
1208
+ try :
1209
+ tr_rate = self ._total_recombination_rate
1210
+ except MissingDatasetException :
1211
+ self .log .debug (f'No total recombination data available for { self .ion_name } .' )
1212
+ else :
1213
+ return tr_rate
1180
1214
try :
1181
1215
rr_rate = self .radiative_recombination_rate
1182
1216
except MissingDatasetException :
1217
+ self .log .debug (f'No radiative recombination data available for { self .ion_name } .' )
1183
1218
rr_rate = u .Quantity (np .zeros (self .temperature .shape ), 'cm3 s-1' )
1184
1219
try :
1185
1220
dr_rate = self .dielectronic_recombination_rate
1186
1221
except MissingDatasetException :
1222
+ self .log .debug (f'No dielectronic recombination data available for { self .ion_name } .' )
1187
1223
dr_rate = u .Quantity (np .zeros (self .temperature .shape ), 'cm3 s-1' )
1188
1224
return rr_rate + dr_rate
1189
1225
0 commit comments