;+ ; NAME: ; FONTENLA_MODEL_READER ; PURPOSE: ; Read a (.txt) model file into an IDL seesion ; CATEGORY: ; CALLING SEQUENCE: ; model = fontenla_model_reader(filename) ; INPUTS: ; filename, string (e.g. 'Model1005.tab.txt') ; OPTIONAL (KEYWORD) INPUT PARAMETERS: ; OUTPUTS: ; structure containing model data. For definitions see the Fontenla ; paper at http://adsabs.harvard.edu/abs/2009ApJ...707..482F ; COMMON BLOCKS: ; SIDE EFFECTS: ; RESTRICTIONS: ; MODIFICATION HISTORY: ; 7-June-2010 (Hugh Hudson) ;- function fontenla_model_reader, filename, qdebug=qdebug data = float(rd_tfile(filename,13,4)) model = {index:1., height:1.D, temperature:1.D, n_e:1.D, $ n_p:1.D, n_a:1.D, n_h:1.D, v_t:1.D, accel:1.D, bHminus:1.D,$ vel:1.D, bH2:1.D, bH2plus:1.D} nindex = n_elements(data[0,*]) model = replicate(model, nindex) for i = 0, nindex-1 do begin model[i].index = reform(data[0,i]) model[i].height = reform(data[1,i]) model[i].temperature = reform(data[2,i]) model[i].n_e = reform(data[3,i]) model[i].n_p = reform(data[4,i]) model[i].n_a = reform(data[5,i]) model[i].n_h = reform(data[6,i]) model[i].v_t = reform(data[7,i]) model[i].accel = reform(data[8,i]) model[i].bHminus = reform(data[9,i]) model[i].vel = reform(data[10,i]) model[i].bH2 = reform(data[11,i]) model[i].bH2plus = reform(data[12,i]) endfor if keyword_set(qdebug) then stop return, model end