;+ ; NAME : ; SUMER_REFORMAT ; ; PURPOSE : ; Reformat SUMER data for a Raster or Temporal Sequence ; ; CALLING SEQUENCE: ; SUMER_REFORMAT, OldData, OldPos, $ ; NewDim, NewPos, Bin ; INPUTS: ; ; OldData an array of spectral images ; OldNw x OldNy x OldNline ; OldPOs an array of the detector coordinates of the lower left ; corners of the lines ; ; OldPos(0,*) : spectral coordinates ; OldPOs(1,*) : spatial coordinates ; ; OUTPUTS: ; ; NewDim a two element array of the spectrograms ; NewPOs a new array of detector coordinates of the lower ; left corners of the new line set ; Bin a factor for binning in the direction of repetition ; (e.g.raster scan direction or temporal sequence direction) ; ; HISTORY: ; J. Chae 1998 Sept ;- pro SUMER_reformat_event, event common new_format_block, widget , par if belong(event.id , widget.field) then begin widget_control, event.id , get_value=val case event.id of widget.field(0) : par.nw=val>1 widget.field(1) : par.ny = val>1 ; widget.field(3) : begin ; ; par.step_bin = val ; end widget.field(2) : par.nline=val>1 endcase return endif if event.id eq widget.draw then begin case par.action of '' : begin widget_control, widget.pos_w, set_value= $ string(event.x, event.y, par.image(event.x, event.y)*par.step_bin, $ format='("Position : ", i, ", ", i, " Value :", i)') end 'Y Position': begin yc=event.y ymin = (yc-par.ny/2)>0 ymax = (ymin+par.ny-1)<359 ymin = ymax-par.ny+1 device, set_graphics=6 col=1 while col lt !d.table_size do col=col+col widget_control, widget.pos_w, get_uvalue=xy plots, xy+0.5, /dev, color=col xy = [[0, ymin], [1023, ymin], [1023, ymax], [0, ymax], [0, ymin]] plots, xy+0.5, /dev, color=col widget_control, widget.pos_w, set_uvalue=xy device, set_graphics=3 if event.press eq 4 then begin plots, xy+0.5, /dev par.pos(1, *) = ymin-1 par.action='' endif end 'Spectral Position':begin xc=event.x xmin = (xc-par.nw/2)>0 xmax = (xmin+par.nw-1)<1023 xmin = xmax-par.nw+1 device, set_graphics=6 col=1 while col lt !d.table_size do col=col+col widget_control, widget.pos_w, get_uvalue=xy plots, xy+0.5, /dev, color=col xy = [[xmin, 0], [xmax, 0], [xmax, 359], [xmin, 359], [xmin, 0]] plots, xy+0.5, /dev, color=col widget_control, widget.pos_w, set_uvalue=xy device, set_graphics=3 if event.press eq 4 then begin plots, xy+0.5, /dev par.pos(0, par.line) = xmin+1-(par.nw mod 2 eq 0) par.line=par.line+1 endif if par.line eq par.nline then begin par.action='' widget_control, widget.base, sensitive=1 par.line=0 endif end endcase endif else case event.value of 'Done': begin widget_control, widget.base, /destroy end 'Show' :begin widget_control, widget.draw, get_value=id wset, id device, copy=[0,0,!d.x_size, !d.y_size,0,0, widget.backing] Pos = par.pos ; sumer_ll_pos(par.Nw, par.Ny, par.refpixel(*, 0:par.nline-1)) for l=0, par.nline-1 do begin xy = [[pos(0,l), pos(1, l)], [pos(0,l)+par.nw-1, pos(1, l)], $ [pos(0,l)+par.nw-1, pos(1, l)+par.ny-1], [pos(0,l), pos(1, l)+par.ny-1], $ [pos(0,l), pos(1, l)]] plots, xy+0.5, /dev endfor end 'Color' :begin xloadct, group=event.id, modal=1 end 'Y Position': begin ;widget_control, widget.base, sensitive=0 ; widget_control, widget.draw, sensitive=1 par.action='Y Position' widget_control, widget.draw, get_value=id wset, id device, copy=[0,0,!d.x_size, !d.y_size,0,0, widget.backing] Pos = par.pos ; sumer_ll_pos(par.Nw, par.Ny, par.refpixel(*, 0:par.nline-1)) for l=0, par.nline-1 do begin xy = [[pos(0,l), 0], [pos(0,l)+par.nw-1, 0], $ [pos(0,l)+par.nw-1, 359], [pos(0,l), 359], $ [pos(0,l), 0]] plots, xy+0.5, /dev endfor widget_control, widget.pos_w, set_uvalue=[-1,-1] end 'Spectral Position' : begin ;widget_control, widget.base, sensitive=0 ; widget_control, widget.draw, sensitive=1 par.action='Spectral Position' par.line = 0 widget_control, widget.draw, get_value=id wset, id device, copy=[0,0,!d.x_size, !d.y_size,0,0, widget.backing] Pos = par.pos; sumer_ll_pos(par.Nw, par.Ny, par.refpixel(*, 0:par.nline-1)) for l=0, 0 do begin xy = [[0, pos(1,l)], [1023, pos(1, l)], $ [1023, pos(1, l)+par.ny-1], [0, pos(1, l)+par.ny-1], $ [0, pos(1, l)]] plots, xy+0.5, /dev endfor widget_control, widget.pos_w, set_uvalue=[-1,-1] end endcase end pro SUMER_REFORMAT, OldData, OldPos, $ NewDim, NewPos, step_bin common new_format_block, widget , par Nline = n_elements(OldData(0,0,*)) Nw = n_elements(OldData(*,0,0)) Ny = n_elements(OldData(0,*,0)) pos=intarr(2, 10) pos(*, 0:nline-1)=oldpos step_bin=1 base = widget_base(title='Reformat SUMER Spectral Setup', /col) options =cw_bgroup(base, /row, /no_release, /return_name, $ ['Done', 'Show', 'Color', 'Y Position', 'Spectral Position'] , /frame ) base1 = widget_base(base, /row) field=intarr(5) field(0) = cw_field(base1, title='N_Spectral :', value=Nw, $ xsize=6, /all_events, integer=1, /frame) field(1)= cw_field(base1, title='N_Spatial :', value=Ny, $ xsize=6, /all_events, integer=1, /frame) field(2)= cw_field(base1, title='N_line :', value=Nline, $ xsize=6, /all_events, integer=1, /frame) ;field(3)= cw_field(base1, title='Binning Factor :', value=bin, $ ; xsize=6, /all_events, integer=1, /frame) draw = widget_draw(base, xsize=1024, ysize=360, $ /button_events, /motion_events, /frame) pos_w =widget_text(base, ysize=1, xsize=28, /frame, $ value=' Position : 0, 0 Value : 0 ') widget_control, base, /realize widget_control, draw, get_value=id widget_control, pos_w, set_uvalue=[-1,-1] ;Pos = sumer_ll_pos(Nw, Ny, refpixel(*, 0:nline-1)) image=fltarr(1024, 360) for l=nline-1, 0, -1 do $ image(pos(0,l):pos(0,l)+nw-1, pos(1,l):pos(1, l)+ny-1 ) = $ olddata(*,*, l) tvscl, image window, /pixmap, /free, xs=!d.x_size, ys=!d.y_size backing = !d.window device, copy=[0,0,!d.x_size, !d.y_size, 0,0, id] wset, id widget={base:base, field:field, draw:draw, backing:backing, pos_w:pos_w} par={ nw:nw, ny:ny, oldnstep:1, $ step_bin:step_bin, nline:nline, $ pos:pos, image:image, action:'', line:0} xmanager, 'SUMER_REFORMAT', base, /modal NewDim = [par.nw,par.ny , par.nline] NewPos=par.pos(*, 0:par.nline-1) step_bin=par.step_bin end