function spd_ui_part_getspec_check_num, num
compile_opt idl2, hidden
if is_numeric(num,/sci) then begin
on_ioerror, fail
calc, 'num='+num
return, double(num)
fail: return, !values.D_NAN
endif else begin
return,!values.D_NAN
endelse
end
pro spd_ui_part_getspec_reset_widget, state, uname
compile_opt idl2, hidden
for i=0, n_elements(uname)-1 do begin
id = widget_info(state.tab_id, find_by_uname=uname[i])
str_element, state, uname[i], value
if size(/type,value) gt 0 then begin
widget_control, id, set_value=value
endif else begin
endelse
endfor
end
pro spd_ui_part_getspec_sens_fac, top_id
compile_opt idl2, hidden
id = widget_info(top_id, find_by_uname='pa')
pa_set = widget_info(id,/button_set)
id = widget_info(top_id, find_by_uname='gyro')
gyro_set = widget_info(id,/button_set)
id = widget_info(top_id, find_by_uname='fac_base')
widget_control, id, sensitive = pa_set or gyro_set
id = widget_info(top_id, find_by_uname='gyro_base')
widget_control, id, sensitive = pa_set or gyro_set
id = widget_info(top_id, find_by_uname='pa_base')
widget_control, id, sensitive = pa_set or gyro_set
end
pro spd_ui_part_getspec_sens_erange, top_id
compile_opt idl2, hidden
id = widget_info(top_id, find_by_uname='energy_button')
limit_energy = widget_info(id, /button_set)
id = widget_info(top_id, find_by_uname='energy_min')
widget_control, id, sensitive = limit_energy
id = widget_info(top_id, find_by_uname='energy_max')
widget_control, id, sensitive = limit_energy
end
function spd_ui_part_getspec_check_input, state, uname, namestring, $
min=min, max=max, value=value
compile_opt idl2, hidden
tlb = state.tab_id
id = widget_info(tlb, find_by_uname=uname)
widget_control, id, get_value=value
if size(/type,value) eq 7 then begin
value = spd_ui_part_getspec_check_num(value)
endif
if finite(value,/nan) then begin
msg = 'Invalid '+strlowcase(namestring)+'.'
endif else if ~undefined(min) && value lt min then begin
msg = namestring+' must be greater than or equal to ' + $
strtrim(string(min),1) + '.'
endif else if ~undefined(max) && value gt max then begin
msg = namestring+' must be less than or equal to ' + $
strtrim(string(max),1) + '.'
endif else begin
return, 1
endelse
x=dialog_message(msg,/center)
if arg_present(value) then begin
str_element, state, uname, value
endif
return, 0
end
pro spd_ui_part_getspec_set_value, state, uname
compile_opt idl2, hidden
for i=0, n_elements(uname)-1 do begin
id = widget_info(state.tab_id, find_by_uname=uname[i])
widget_control, id, get_value=value
if n_elements(value) eq 1 then value=value[0]
str_element, state, uname[i], value, /add
endfor
end
pro spd_ui_part_getspec_set_values, state, error=error
compile_opt idl2, hidden
error= 1b
tlb = state.tab_id
a0 = spd_ui_part_getspec_check_input(state,'phi_min','Phi min',min=0,max=360,value=pmin)
a1 = spd_ui_part_getspec_check_input(state,'phi_max','Phi max',min=0,max=360,value=pmax)
if ~a0 || ~a1 then begin
return
endif
a3 = spd_ui_part_getspec_check_input(state,'start_angle','Start angle',value=sa)
if ~a3 then begin
return
endif
a0 = spd_ui_part_getspec_check_input(state,'theta_min','Theta min',min=-90,max=90,value=tmin)
a1 = spd_ui_part_getspec_check_input(state,'theta_max','Theta max',min=-90,max=90,value=tmax)
if ~a0 || ~a1 || tmin ge tmax then begin
if a0 && a1 && tmin ge tmax then x=dialog_message('Theta minimum must be less than maximum.',/center)
return
endif
a0 = spd_ui_part_getspec_check_input(state,'pa_min','Pitch Angle min',min=0,max=180,value=pamin)
a1 = spd_ui_part_getspec_check_input(state,'pa_max','Pitch Angle max',min=0,max=180,value=pamax)
if ~a0 || ~a1 || pamin ge pamax then begin
if a0 && a1 && pamin ge pamax then x=dialog_message('Pitch angle minimum must be less than maximum.',/center)
return
endif
a0 = spd_ui_part_getspec_check_input(state,'gyro_min','Gyrophase min',min=0,max=360,value=gvmin)
a1 = spd_ui_part_getspec_check_input(state,'gyro_max','Gyrophase max',min=0,max=360,value=gvmax)
if ~a0 || ~a1 || gvmin ge gvmax then begin
if a0 && a1 && gvmin ge gvmax then x=dialog_message('Gyrophase minimum must be less than maximum.',/center)
return
endif
id = widget_info(state.tab_id, find_by_uname='energy_button')
if widget_info(id, /button_set) then begin
e0 = spd_ui_part_getspec_check_input(state,'energy_min','Energy min',min=0,value=emin)
e1 = spd_ui_part_getspec_check_input(state,'energy_max','Energy max',min=0,value=emax)
if ~e0 || ~e1 || emin ge emax then begin
if e0 && e1 && emin ge emax then x=dialog_message('Phi minimun must be less than maximum.',/center)
return
endif
endif
r0 = spd_ui_part_getspec_check_input(state,'regrid_phi','Regrid dimension (long)',min=4)
r1 = spd_ui_part_getspec_check_input(state,'regrid_theta','Regrid dimension (lat)',min=2)
if ~r0 then begin
return
endif
if ~r1 then begin
return
endif
error = 0b
spd_ui_part_getspec_set_value, state, ['phi_min','phi_max', $
'start_angle', $
'theta_min','theta_max', $
'pa_min','pa_max', $
'gyro_min','gyro_max', $
'energy_min','energy_max', $
'regrid_phi', 'regrid_theta']
id = widget_info(state.tab_id, find_by_uname='suffix')
widget_control, id, get_value = suffix
state.suffix = strcompress(/remove_all, suffix)
id = widget_info(state.tab_id, find_by_uname='sst_method_clean')
state.sst_method_clean = widget_info(id, /button_set)
types = state.validoutputs
for i=0, n_elements(types)-1 do begin
id = widget_info(state.tab_id, find_by_uname=types[i])
if widget_info(id, /button_set) then outputs = array_concat(types[i],outputs)
endfor
str_element, state, 'outputs', keyword_set(outputs) ? outputs:'', /add_replace
end
pro spd_ui_part_getspec_set_defaults, state
compile_opt idl2, hidden
state.suffix = ''
str_element, state, 'outputs', ['phi','theta','energy'], /add_replace
state.phi_min = 0.
state.phi_max = 360.
state.theta_min = -90.
state.theta_max = 90.
state.pa_min = 0.
state.pa_max = 180.
state.gyro_min = 0.
state.gyro_max = 360.
state.start_angle = 0.
state.energy_min = 0.
state.energy_max = 1e7
state.regrid_phi = 16
state.regrid_theta = 8
state.sst_method_clean = 0b
if widget_info(state.probelist, /realized) then begin
widget_control, state.probeList , set_list_select=-1
widget_control, state.dataTypeList, set_list_select=-1
endif
id=widget_info(state.tab_id, find_by_uname='energy_button')
widget_control, id, set_button=0
id=widget_info(state.tab_id, find_by_uname='fac_type')
widget_control, id, set_combobox_select=0
widget_list = [ 'phi_min', 'phi_max', 'theta_min', 'theta_max', $
'pa_min', 'pa_max', 'gyro_min', 'gyro_max', $
'start_angle', 'energy_min', 'energy_max', $
'regrid_phi', 'regrid_theta', 'suffix' $
]
spd_ui_part_getspec_reset_widget, state, widget_list
for i=0, n_elements(state.validOutputs)-1 do begin
id=widget_info(state.tab_id, find_by_uname=state.validoutputs[i])
widget_control, id, set_button = in_set(state.validoutputs[i],state.outputs)
endfor
id=widget_info(state.tab_id, find_by_uname='sst_method_clean')
widget_control, id, set_button = state.sst_method_clean
spd_ui_part_getspec_sens_fac, state.tab_id
spd_ui_part_getspec_sens_erange, state.tab_id
spd_ui_message, 'Using default spectrogram settings.', sb=state.statusbar, hw=state.historywin
end
pro spd_ui_part_getspec_apply, state, error=error
compile_opt idl2, hidden
error = 1
widget_control, /hourglass
sb = state.statusbar
hw = state.historywin
probe_idx = widget_info(state.probeList,/list_select)
if probe_idx[0] eq -1 then begin
spd_ui_message, 'Please select a probe.', sb=sb
return
endif
if in_set(probe_idx,0) then begin
probe = state.validProbes[1:n_elements(state.validProbes)-1]
endif else begin
probe = state.validProbes[probe_idx]
endelse
data_idx = widget_info(state.dataTypeList,/list_select)
if data_idx[0] eq -1 then begin
spd_ui_message, 'Please select a datatype.', sb=sb
return
endif
for i=0, n_elements(state.validOutputs)-1 do begin
id = widget_info(state.tab_id, find_by_uname=state.validOutputs[i])
if widget_info(id, /button_set) then outputs_set = 1b
endfor
if ~keyword_set(outputs_set) then begin
spd_ui_message, 'Please select one or more output types.', sb=sb
return
endif
state.tr->getproperty, starttime=start_obj
state.tr->getproperty, endtime=stop_obj
start_obj->getProperty,tstring=startText
stop_obj->getProperty,tstring=stopText
trange = time_double([startText, stopText])
if trange[0] ge trange[1] then begin
spd_ui_message, 'Error: End time less than/equal to Start time.', sb=sb
return
endif
if (trange[0] gt systime(/sec)) AND (trange[1] gt systime(/sec)) then begin
spd_ui_message, "Error: Start and end times are later than today's date. ", sb=sb
return
endif
spd_ui_part_getspec_set_values, state, error=error
if keyword_set(error) then return
tnames_before = tnames('*',create_time=ct)
sst_cal_id=widget_info(state.tab_id, find_by_uname='SST_CALIBRATE')
sst_cal=widget_info(sst_cal_id,/button_set)
if sst_cal then begin
if in_set(data_idx,0) then begin
datatype = state.validBetatypes[1:n_elements(state.validBetatypes)-1]
endif else begin
datatype = state.validBetatypes[data_idx]
endelse
endif else begin
if in_set(data_idx,0) then begin
datatype = state.validDatatypes[1:n_elements(state.validDatatypes)-1]
endif else begin
datatype = state.validDatatypes[data_idx]
endelse
endelse
id = widget_info(state.tab_id, find_by_uname='energy_button')
limit_energy = widget_info(id, /button_set)
trange = time_double([startText, stopText])
outputs = state.outputs
suffix = state.suffix
phi = [state.phi_min, state.phi_max]
theta = [state.theta_min, state.theta_max]
pitch = [state.pa_min, state.pa_max]
gyro = [state.gyro_min, state.gyro_max]
energy = limit_energy ? [state.energy_min, state.energy_max]:0
start_angle = state.start_angle
regrid = [state.regrid_phi,state.regrid_theta]
fac_type = strlowcase(state.fac_type)
sst_method_clean = state.sst_method_clean
var_success = 1b
clobber = ''
for k=0, n_elements(probe)-1 do begin
if in_set('pa',outputs) or in_set('gyro',outputs) then begin
thm_load_state, probe=probe[k], trange=trange, /get_support
thm_load_fit, probe=probe[k], trange=trange, datatype='fgs', level='l1', coord='dsl'
endif
for j=0, n_elements(datatype)-1 do begin
spd_ui_message, 'Processing Probe: '+probe[k]+', Datatype: '+datatype[j], sb=sb, hw=hw
existing_names = state.loadedData->getGroupNames()
if ~is_string(existing_names) then existing_names = ''
new_names = 'th'+probe[k]+'_'+datatype[j]+'_eflux'+'_'+outputs+suffix
output_flags = replicate(1b,n_elements(outputs))
for i=0, n_elements(new_names)-1 do begin
if in_set(new_names[i], existing_names) then begin
if clobber ne 'yestoall' AND clobber ne 'notoall' then begin
prompttext = 'The variable ' + strupcase(new_names[i]) + $
' already exists. Do you want to ' + 'overwrite it?'+ $
' Click "No" continue with the existing variable or "Cancel" to stop.'
clobber = spd_ui_prompt_widget(state.tab_id, sb, hw, promptText=promptText,$
title='Variable already exists.', defaultvalue='cancel', $
/no, /yes, /allno, /allyes, /cancel, frame_attr=8)
widget_control, /hourglass
endif
if clobber eq 'yestoall' then break
if clobber eq 'no' then output_flags[i] = 0b
if clobber eq 'notoall' then begin
output_flags[*] = 0b
break
endif
if clobber eq 'cancel' then begin
spd_ui_message, 'Load canceled by user.', sb=sb, hw=hw
return
endif
endif
endfor
output_idx = where(output_flags,nout)
if nout eq 0 then begin
continue
endif else begin
outputs = outputs[output_idx]
endelse
thm_part_load, probe=probe[k], datatype=datatype[j], trange=trange, sst_cal=sst_cal
thm_part_products, probe = probe[k], $
datatype = datatype[j], $
trange = trange, $
outputs = outputs, $
phi = phi, $
theta = theta, $
pitch = pitch, $
gyro = gyro, $
energy = energy, $
regrid = regrid, $
start_angle = start_angle, $
suffix = suffix, $
fac_type = fac_type, $
sst_method_clean = sst_method_clean, $
sst_cal=sst_cal, $
tplotnames=tplotnames
add_replay_call = 0b
for i=0, n_elements(tplotnames)-1 do begin
success = state.loadeddata->add(tplotnames[i])
if success then begin
spd_ui_message, 'Added Variable: '+tplotnames[i], sb=sb, hw=hw
add_replay_call = 1b
endif else begin
spd_ui_message, 'Failed to Add Variable: '+tplotnames[i], sb=sb, hw=hw
var_success = 0b
endelse
endfor
if add_replay_call then begin
state.callSequence->addGetSpecOp,probe[k], datatype[j], trange,$
start_angle, suffix, outputs, phi, theta, pitch, gyro, energy, $
regrid, fac_type, sst_cal, sst_method_clean
endif
endfor
endfor
spd_ui_cleanup_tplot, tnames_before, create_time_before=ct, new_vars=new_vars, del_vars=del_vars
if del_vars[0] ne '' then begin
store_data, del_vars, /delete
endif
if var_success Then Begin
spd_ui_message, 'Getspec load finished.', sb=sb, hw=hw
endif else begin
spd_ui_message, 'Getspec load finished. Some quantities were not processed. '+ $
'Check History window for details.', sb=sb, hw=hw
endelse
error = 0
return
end
Pro spd_ui_part_getspec_options_event, event
err_xxx = 0
Catch, err_xxx
IF (err_xxx NE 0) THEN BEGIN
Catch, /Cancel
Help, /Last_Message, Output = err_msg
print, err_msg
dummy = dialog_message('An unknown error occured and the window must be restarted. See console for details.', /center, _extra=_extra)
if is_struct(state) then begin
for i=0, n_elements(err_msg)-1 do begin
spd_ui_message, err_msg[i], sb=state.statusBar, hw=state.historyWin
endfor
endif
if widget_valid(base) then begin
Widget_Control, base, Set_UValue=state, /No_Copy
endif
Widget_Control, event.TOP, Set_UValue=state, /No_Copy
widget_control, event.top,/destroy
RETURN
ENDIF
widget_control, event.id, get_uvalue = uval
if undefined(uval) then return
base = event.handler
widget_control, base, Get_UValue=state, /no_copy
case uval of
'energy_button': begin
spd_ui_part_getspec_sens_erange, state.tab_id
end
'fac_set': begin
spd_ui_part_getspec_sens_fac, state.tab_id
end
'CLEARDATA': begin
widget_control, state.dataTypeList, set_list_select=-1
end
'CLEARPROBE': begin
widget_control, state.probeList , set_list_select=-1
end
'SST_CALIBRATE':begin
use_new_sst_calibrations = widget_info(event.id,/button_set)
data_type_list_id = widget_info(state.tab_id,find_by_uname='data_type_list')
if use_new_sst_calibrations then begin
widget_control,data_type_list_id,set_value=state.validBetaTypes
endif else begin
widget_control,data_type_list_id,set_value=state.validDataTypes
endelse
end
'HELP':begin
gethelppath,path
xdisplayfile, path+'spd_ui_part_getspec_options.txt', group=state.tab_id, /modal, done_button='Done', $
title='HELP: Getspec Options'
end
'RESET':begin
spd_ui_part_getspec_set_defaults, state
end
'APPLY':begin
spd_ui_part_getspec_apply, state, error=error
end
else:
endcase
widget_control, base, set_uvalue=state, /NO_COPY
return
end
Pro spd_ui_part_getspec_options, tab_id, loadedData, historyWin, statusBar, $
treecopy, trObj, callSequence, $
loadTree=loadTree, $
timeWidget=timeid
compile_opt idl2, hidden
widget_control, /hourglass
mainBase = widget_base(tab_id, /col, tab_mode=1, event_pro='spd_ui_part_getspec_options_event')
topBase = widget_base(mainBase, /row, ypad=8)
topCol1Base = widget_base(topBase, /col, space=4)
instrLabelBase = widget_base(topcol1base, /row)
instrumentBase = widget_base(topCol1Base, /col, /frame, xpad=5)
timeBase = widget_base(instrumentBase)
sstCalButtonBase = widget_base(instrumentBase, /col, /nonexclusive, xpad=5)
dataBase = widget_base(instrumentBase, /row)
topCol2Base = widget_base(topBase, /col, space=4)
col2row1 = widget_base(topcol2base, ypad=2, /col)
spec_type_label_base = widget_base(col2row1, /row, /align_left)
spec_type_base = widget_base(col2row1, /row, /frame, ypad=6, xpad=5)
col2row2 = widget_base(topcol2base, ypad=2, /col)
angle_range_label_base = widget_base(col2row2, /row, /align_left)
angle_range_base = widget_base(col2row2, /col, /frame, ypad=8, xpad=5)
col2row3 = widget_base(topcol2base, ypad=2, /col)
energy_range_label_base = widget_base(col2row3, /row, /align_left)
energy_range_base = widget_base(col2row3, /col, /frame, ypad=6, xpad=5)
topCol3Base = widget_base(topBase, /col, space=4)
col4row1 = widget_base(topcol3base, ypad=2, /col)
suffixLabelBase = widget_base(col4row1,/col)
suffixBase = widget_base(col4row1, /row, /frame, ypad=8, xpad=10)
col3row2 = widget_base(topcol3base, ypad=2, /col)
fac_label_base = widget_base(col3row2, /row, /align_left)
fac_base = widget_base(col3row2, /col, /frame, ypad=8, xpad=5, uname='fac_base')
col3row3 = widget_base(topcol3base, ypad=2, /col)
sst_label_base = widget_base(col3row3, /row, /align_left)
sst_base = widget_base(col3row3, /col, /frame, ypad=8, xpad=5)
col3row4 = widget_base(topcol3base, ypad=2, /col)
start_angle_label_base = widget_base(col3row4, /row, /align_left)
start_angle_base = widget_base(col3row4, /col, /frame, ypad=5, xpad=5)
buttonBase = widget_base(mainBase, /row, /align_center)
dataLabel = widget_label(instrLabelBase, value='Data Selection: ', /align_left)
loadtree = obj_new()
tr = trObj
timeid = spd_ui_time_widget(timeBase,$
statusBar,$
historyWin,$
timeRangeObj=tr,$
uvalue='TIME_WIDGET',$
uname='time_widget')
sstButton = widget_button(sstCalButtonBase, value = 'Use Beta SST Calibrations?', $
uname = 'SST_CALIBRATE',UVAL='SST_CALIBRATE')
validProbesVisible = [' * (All)', ' A (P5)', ' B (P1)', ' C (P2)', ' D (P3)', ' E (P4)']
validProbes = ['*', 'a', 'b', 'c', 'd', 'e']
probeBase = Widget_Base(dataBase, /col)
plBase = Widget_base(probeBase, /row)
probeListBase = Widget_Base(plBase, /col)
probeLabel = Widget_Label(probeListBase, Value='Probe: ', /align_left)
probeList = Widget_List(probeListBase, Value=validProbesVisible, /multiple, uval='PROBE', XSize=16, YSize=11)
probeButtonBase = Widget_Base(probeListBase, /row, /align_center)
probeClearButton = Widget_Button(probeButtonBase, value=' Clear Probe ', uvalue='CLEARPROBE', /align_center)
suffix = ''
validDataTypes = ['*', $
'peif', 'peir', 'peib', 'peef', 'peer', 'peeb', $
'psif', 'psir', 'psef', 'pser', 'pseb']
validBetaTypes = ['*','psif','psef','pseb']
dataTypeBase = Widget_Base(DataBase, /col)
dataL1Base = Widget_Base(dataTypeBase, /col)
dataButtonBase = Widget_Base(dataTypeBase, /col, /align_center)
dataTypeLabel = Widget_Label(dataL1Base, Value='Data Type:', /align_left)
dataTypeList = Widget_List(dataL1Base, Value=validDataTypes, uval='DATATYPE', $
uname='data_type_list',$
/Multiple, XSize=16, YSize=11)
dataClearButton = Widget_Button(dataButtonBase, value=' Clear Data Type ', uvalue='CLEARDATA', /align_center)
suffixlabel = widget_label(suffixLabelBase, value = 'Variable Name: ', /align_left)
suffixlabel = widget_label(suffixBase, value = 'Suffix: ', /align_left)
suffixid = widget_text(suffixBase, value=suffix, xsize=22, ysize=1, uname='suffix', /editable)
outputs = ['phi', 'theta', 'energy']
validOutputs = ['energy', 'phi', 'theta', 'pa', 'gyro']
spec_label = widget_label(spec_type_label_base, value='Output Selection')
spec_selection_base1 = widget_base(spec_type_base, /nonexclusive)
ener_energy = widget_button(spec_selection_base1, value='Energy', uname='energy', $
tooltip='Energy spectrogram. Averages over all look directions.')
spec_selection_base2 = widget_base(spec_type_base, /nonexclusive)
spec_phi = widget_button(spec_selection_base2, value='Phi', uname='phi', $
tooltip='Phi (longitudinal) spectrogram. Averages over energy and theta (latitude).')
spec_theta = widget_button(spec_selection_base2, value='Theta', uname='theta', $
tooltip='Theta (latitudinal) spectrogram. Averages over energy and phi (longitude).')
spec_selection_base3 = widget_base(spec_type_base, /nonexclusive)
spec_gyro = widget_button(spec_selection_base3, value='Gyrophase', uname='gyro', uval='fac_set', $
tooltip='Field aligned longitudinal spectrogram. Averages over energy and latitude in field alligned coordinates.')
spec_pa = widget_button(spec_selection_base3, value='Pitch Angle', uname='pa', uval='fac_set', $
tooltip='Field aligned colatitude spectrogram. Averages over energy and longitude in field alligned coordinates.')
phi = [0,360.]
theta = [-90,90.]
gyro = [0,360]
pa = [0,180]
angle_range_label = widget_label(angle_range_label_base, value='Angular Ranges (min/max):')
phi_range_base = widget_base(angle_range_base, /row)
phi_range_label = widget_label(phi_range_base, value='Phi: ')
phi_min = spd_ui_spinner(phi_range_base, label='', value=phi[0], uname='phi_min', $
tooltip = 'Minimum phi used to calculate all outputs.')
phi_max = spd_ui_spinner(phi_range_base, label='', value=phi[1], uname='phi_max', $
tooltip = 'Maximum phi used to calculate all outputs.')
theta_range_base = widget_base(angle_range_base, /row)
theta_range_label = widget_label(theta_range_base, value='Theta: ')
theta_min = spd_ui_spinner(theta_range_base, label='', value=theta[0], uname='theta_min', $
tooltip = 'Minimum theta used to calculate all outputs.')
theta_max = spd_ui_spinner(theta_range_base, label='', value=theta[1], uname='theta_max', $
tooltip = 'Maximum theta used to calculate all outputs.')
gyro_range_base = widget_base(angle_range_base, /row, uname='gyro_base')
gyro_range_label = widget_label(gyro_range_base, value='Gyro: ')
gyro_min = spd_ui_spinner(gyro_range_base, label='', value=gyro[0], uname='gyro_min', $
tooltip = 'Minimum gyrophase used to calculate field aligned spectrograms.')
gyro_max = spd_ui_spinner(gyro_range_base, label='', value=gyro[1], uname='gyro_max', $
tooltip = 'Maximum gyrophase used to calculate field aligned spectrograms.')
pa_range_base = widget_base(angle_range_base, /row, uname='pa_base')
pa_range_label = widget_label(pa_range_base, value='PA: ')
pa_min = spd_ui_spinner(pa_range_base, label='', value=pa[0], uname='pa_min', $
tooltip = 'Minimum pitch angle used to calculate field aligned spectrograms.')
pa_max = spd_ui_spinner(pa_range_base, label='', value=pa[1], uname='pa_max',$
tooltip = 'Maximum gyrophase used to calculate field aligned spectrograms.')
geo = widget_info(theta_range_label,/geo)
widget_control, phi_range_label, xsize = geo.scr_xsize
widget_control, gyro_range_label, xsize = geo.scr_xsize
widget_control, pa_range_label, xsize = geo.scr_xsize
energy = [0,1e7]
energy_range_label = widget_label(energy_range_label_base, value='Energy Range (min/max):')
energy_range_base2 = widget_base(energy_range_base, /row, xpad=0)
energy_range_bbase = widget_base(energy_range_base2, /nonexclusive, xpad=0, ypad=0)
energy_range_button = widget_button(energy_range_bbase, value='Energy (eV):', $
uname='energy_button', uval='energy_button', $
tooltip='Limit the energy range used to calculate all spectrograms.')
energy_min = spd_ui_spinner(energy_range_base2, label='', value=energy[0], uname='energy_min', $
tooltip = 'Minimum energy used to calculate all outputs.', inc=100)
energy_max = spd_ui_spinner(energy_range_base2, label='', value=energy[1], uname='energy_max', $
tooltip = 'Maximum energy used to calculate all outputs.', inc=100)
phi_start = 0.
start_angle_label = widget_label(start_angle_label_base, value='Phi/Gyro Start Angle: ')
start_angle_base2 = widget_base(start_angle_base, /row, xpad=0)
start_angle = spd_ui_spinner(start_angle_base2, label='Start plot at (degrees): ', $
value=phi_start, incr=5, uname='start_angle', $
tooltip='Start phi and gyrophase y axes at this value.')
regrid = [16,8.]
facs = ['MPHIGEO', 'PHIGEO', 'MPHISM', 'PHISM', 'MRGEO', 'RGEO', 'XGSE', 'YGSM']
fac_label = widget_label(fac_label_base, value='Field Aligned Coordinates:')
regrid_base = widget_base(fac_base, /row)
regrid_label = widget_label(regrid_base, value='Bin Num (long,lat): ')
regrid_phi = spd_ui_spinner(regrid_base, value=regrid[0], incr=2, label='', text_box_size=4, $
uname='regrid_phi', tooltip='Number of bins across rphi (field aligned longitude).')
regrid_theta = spd_ui_spinner(regrid_base, value=regrid[1], incr=2, label='', text_box_size=4, $
uname='regrid_theta', tooltip='Number of bins across rtheta (field aligned longitude).')
coord_base = widget_base(fac_base, /row)
coord_label = widget_label(coord_base, value='FAC Variant: ')
coord_list = widget_combobox(coord_base, value=facs, uname='fac_type')
sst_method_clean = 0b
sst_label = widget_label(sst_label_base, value='SST Contamination:')
sst_cont_button_base = widget_base(sst_base, /nonexclusive,/col)
sst_cont_button = widget_button(sst_cont_button_base, $
value='Mask Default Bins', uname='sst_method_clean', $
tooltip='Mast the default set of contaminated SST bins.')
apply_button = Widget_Button(buttonBase, Value = ' Apply ', XSize = 70, $
UValue = 'APPLY', tooltip='Create particle spectra from active data')
resetButton = Widget_Button(buttonBase, value='Reset All', uvalue='RESET', $
tooltip='Reset all settings to their default values.')
helpButton = Widget_Button(buttonBase, Value='Help', XSize=70, UValue='HELP', $
tooltip='Open Help Window.')
geo = widget_info(energy_range_base,/geo)
widget_control, spec_type_base, xsize=geo.scr_xsize
widget_control, angle_range_base, xsize=geo.scr_xsize
geo = widget_info(fac_base,/geo)
widget_control, sst_base, xsize=geo.scr_xsize
widget_control, start_angle_base, xsize=geo.scr_xsize
widget_control, suffixbase, xsize=geo.scr_xsize
state = {tab_id:tab_id, $
loadedData:loadedData, historyWin:historyWin, callSequence:callSequence, $
statusBar:statusBar, probeList:probeList, tr:tr, $
dataTypeList:dataTypeList, $
probeClearButton:probeClearButton, $
dataClearButton:dataClearButton, $
validProbes:validProbes, $
validDataTypes:validDataTypes, $
validBetaTypes:validBetaTypes, $
validOutputs:validOutputs, $
phi_min:phi[0], phi_max:phi[0], $
theta_min:theta[0], theta_max:theta[1], $
pa_min:pa[0], pa_max:pa[1], $
gyro_min:gyro[0], gyro_max:gyro[1], $
energy_min:energy[0], energy_max:energy[1], $
outputs:outputs, $
start_angle:start_angle, $
regrid_phi:regrid[0], regrid_theta:regrid[1], $
fac_type:facs[0], $
sst_method_clean:sst_method_clean, $
suffix:suffix $
}
spd_ui_part_getspec_set_defaults, state
widget_control, widget_info(tab_id, /child), set_uvalue=state, /no_copy
Return
End