def apply_rescaling(self, frm_in, frm_out, n_avg, virtual_param):
"""Apply rescaling and averaging operations."""
frm_out.i = frm_in.i
# --- perform averaging on histograms
val = np.float_(self.factor) / np.float_(n_avg)
# --- rescale distance histograms
if frm_out.has_key(base.loc_histograms):
X = frm_out.get_data(base.loc_histograms)
dict_util.scale_values(X, val)
# --- multiref: rescale shell XX histogram
if (virtual_param is not None and self.geometry == 'MultiReferenceStructure'):
if frm_out.has_key(base.loc_shell_Hxx):
X = frm_out.get_data(base.loc_shell_Hxx)
dict_util.scale_values(X, val)
# --- rescale length histograms
if frm_out.has_key(base.loc_len_histograms):
X = frm_out.get_data(base.loc_len_histograms)
dict_util.scale_values(X, val)
# ---
frm_out.put_data('log', frm_in.get_data('log'))
frm_out.put_meta(self.get_meta(n_avg=n_avg))
评论列表
文章目录