predict_with_zd_interpolation
- lstchain.reco.dl1_to_dl2.predict_with_zd_interpolation(rf, param_array, features)
Obtain a RF prediction which takes into account the difference between the telescope elevation (alt_tel, i.e. 90 deg - zenith) and those of the MC training nodes. The dependence of image parameters (for a shower of given characteristics) with zenith is strong at angles beyond ~50 deg, due to the change in airmass. Given the way Random Forests work, if the training is performed with a discrete distribution of pointings, the prediction of the RF will be biased for pointings in between those used in training. If zenith is used as one of the RF features, there will be a sudden jump in the predictions halfway between the training nodes.
To solve this, we compute here two predictions for each event, one using the elevation (alt_tel) of the training pointing which is closest to the telescope pointing, and another one usimg the elevation of the sceond-closest pointing. Then the values are interpolated (linearly in cos(zenith)) to the actual zenith pointing (90 deg - alt_tel) of the event.
- Parameters:
- rfsklearn.ensemble.RandomForestRegressor or RandomForestClassifier,
The random forest we want to apply (must contain alt_tel among the training parameters).
- param_arraypandas.DataFrame
Dataframe containing the features needed by the RF. It must also contain four additional columns: alt0, alt1, w0, w1, which can be added with the function add_zd_interpolation_info. These are the event-wise telescope elevations for the closest and 2nd-closest training pointings (alt0 and alt1), and the event-wise weights (w0 and w1) which must be applied to the RF prediction at the two pointings to obtain the interpolated value at the actual telescope pointing. Since the weights are the same (for a given event) for different RFs, it does not make sense to compute them here - they are pre-calculated by add_zd_interpolation_info.
- featureslist of str
List of the names of the image features used by the RF.