;+ ; Name: spex_merge_struct ; ; Purpose: Merge the time intervals for two spex summ (fit results) structures. Everything else in the structures is assumed ; to be the same, including the fit function and the number of parameters. Input and output can be either the original format ; spex_summ structure or the packetized form (see spex_conv_struct.pro) ; ; Calling sequence: ; new_struct = spex_merge_struct(s1, s2) ; ; Calling arguments: ; s1 - first ospex summ structure ; s2 - second ospex summ structure ; ; Output: ; new_struct - spex summ structure with merged time intervals. E.g. if s1 has 12 time intervals and s2 has 20 time intervals, for each ; tag in new_struct that is dimensioned by time will be dimensioned to 32. Format will be original or packetized based on format of s1. ; ; Written: 4-Jan-2013, Kim Tolbert ; Modifications: ; ;- function spex_merge_struct,s1,s2 s1_new = tag_exist(s1, 'spex_summ_intervals') ? s1 : spex_conv_struct(s1) s2_new = tag_exist(s2, 'spex_summ_intervals') ? s2 : spex_conv_struct(s2) snew = rep_tag_value(s1_new, [s1_new.spex_summ_intervals, s2_new.spex_summ_intervals], 'spex_summ_intervals') snew = tag_exist(s1, 'spex_summ_intervals') ? snew : spex_conv_struct(snew) return, snew end