Skip to content

Commit

Permalink
Added more fields to stx_aspect_dto structure
Browse files Browse the repository at this point in the history
  • Loading branch information
FredSchuller committed Oct 27, 2023
1 parent 0376e3a commit b87a656
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 12 deletions.
8 changes: 4 additions & 4 deletions stix/idl/processing/aspect/SAS_test.pro
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ simu_data_file = param_dir + getenv('SAS_DATA_SIMU')
;
print,"Reading L1 data file..."

one_day = '20230330' ; case where the HK file contains too many rows (duplicate entries, many with duration close to 0)
; one_day = '20230330' ; case where the HK file contains too many rows (duplicate entries, many with duration close to 0)
; one_day = '20220509' ; solar distance gets beyond 0.75 AU at the end of that day
; one_day = '20230321' ; pointing mostly at Sun centre, with a flat-field calib. from 19:00 to 20:00
; one_day = '20230329' ; includes pointing at pole, and other off-centre pointings
one_day = '20230329' ; includes pointing at pole, and other off-centre pointings, and too many rows in HK file

in_file = "solo_L1_stix-hk-maxi_"+one_day+"_V01.fits"
data = prepare_aspect_data(data_dir + in_file, quiet=0)
show_info, data
stx_show_sas_info, data

print,"Calibrating data..."
; First, substract dark currents and applies relative gains
Expand All @@ -44,7 +44,7 @@ stx_remove_bad_sas_data, data_calib
stx_auto_scale_sas_data, data_calib, simu_data_file, aperfile

print,"Plotting the signals..."
show_info, data_calib
stx_show_sas_info, data_calib
plot4sig, data_calib

; apply same calibration correction factor to all data (including data points that were removed due to errors)
Expand Down
4 changes: 3 additions & 1 deletion stix/idl/processing/aspect/prepare_aspect_data.pro
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ function prepare_aspect_data, infile, quiet=quiet
cha_diode0: tbl[i].hk_asp_photoa0_v, cha_diode1: tbl[i].hk_asp_photoa1_v, $
chb_diode0: tbl[i].hk_asp_photob0_v, chb_diode1: tbl[i].hk_asp_photob1_v, $
time: utc_str[i], duration : duration[i], spice_disc_size : r_sol[i], $
y_srf : 0.0, z_srf : 0.0, calib : 0.0, sas_ok : 1, error : ""}
scet_time_c: 0L, scet_time_f: 0L, $
y_srf : 0.0, z_srf : 0.0, calib : 0.0, sas_ok : 1, error : "", $
control_index: 0L, parentfits: 0L}
if i eq 0 then result = [a] else result = [result, a]
endfor

Expand Down
4 changes: 3 additions & 1 deletion stix/idl/processing/aspect/stx_remove_bad_sas_data.pro
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ pro stx_remove_bad_sas_data, data
chb_diode0: data[good[i]].chb_diode0, chb_diode1: data[good[i]].chb_diode1, $
time: data[good[i]].time, duration: data[good[i]].duration, $
spice_disc_size: data[good[i]].spice_disc_size, $
scet_time_c: data[good[i]].scet_time_c, scet_time_f: data[good[i]].scet_time_f, $
y_srf: data[good[i]].y_srf, z_srf: data[good[i]].z_srf, $
calib: data[good[i]].calib, sas_ok : 1, error : ""}
calib: data[good[i]].calib, sas_ok : 1, error : "", $
control_index: data[good[i]].control_index, parentfits: data[good[i]].parentfits}
result = [result, one_data]
endfor
data = result
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
;+
; Description :
; Procedure to display basic info about a data structure.
; Procedure to display basic info about an SAS data structure.
;
; Syntax : show_info, data
; Syntax : stx_show_sas_info, data
;
; Inputs :
; data = an array of STX_ASPECT_DTO structures
Expand All @@ -12,10 +12,11 @@
; History :
; 2020 - F. Schuller (AIP), initial version
; 2022-01-28 - FSc (AIP): adapted to STX_ASPECT_DTO structure
; 2023-10-27, FSc (AIP): changed name from show_info to stx_show_sas_info
;
;-

pro show_info, data
pro stx_show_sas_info, data
if not is_struct(data) then begin
print,"ERROR: input variable is not a structure."
return
Expand All @@ -27,7 +28,7 @@ pro show_info, data
if count gt 0 then print,count,format='("WARNING - data contains ",I2," jump(s) back in time")'
gaps = where(dt gt 1.5*resol, count)
if count gt 0 then begin
print,count,format='("WARNING - data contains ",I3," gaps:")'
print,count,format='("WARNING - data contains ",I4," gaps:")'
if count le 10 then for i=0,count-1 do $
print,data[gaps[i]].time,data[gaps[i]+1].time,format='(" ... between ",A," and ",A)' else begin
for i=0,9 do print,data[gaps[i]].time,data[gaps[i]+1].time,format='(" ... between ",A," and ",A)'
Expand Down
14 changes: 12 additions & 2 deletions stix/idl/processing/aspect/stx_smooth_sas_data.pro
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ pro stx_smooth_sas_data, data
new_dura = fltarr(new_dim)
for i=0,new_dim-1 do new_dura[i] = data[2*i].duration + data[2*i+1].duration

; also rebin SCET times ...
new_scet_c = rebin(data[0:2*new_dim-1].scet_time_c,new_dim)
new_scet_f = rebin(data[0:2*new_dim-1].scet_time_f,new_dim)
; ... as well as CONTROL_INDEX and PARENTFITS
new_control = rebin(data[0:2*new_dim-1].control_index,new_dim)
new_parentfits = rebin(data[0:2*new_dim-1].parentfits,new_dim)

; ERROR strings: keep an error message if present for one of the two rebinned values
new_err = strarr(new_dim)
new_sas_ok = intarr(new_dim)
Expand All @@ -61,8 +68,11 @@ pro stx_smooth_sas_data, data
for i=0,new_dim-1 do begin
a = {stx_aspect_dto, $
cha_diode0: new_sigA[i], cha_diode1: new_sigB[i], chb_diode0: new_sigC[i], chb_diode1: new_sigD[i], $
time: new_utc[i], duration: new_dura[i], spice_disc_size: new_rsol[i], y_srf: new_y[i], z_srf: new_z[i], $
calib: new_cal[i], sas_ok: new_sas_ok[i], error: new_err[i]}
time: new_utc[i], duration: new_dura[i], spice_disc_size: new_rsol[i], $
scet_time_c: new_scet_c[i], scet_time_f: new_scet_f[i], $
y_srf: new_y[i], z_srf: new_z[i], $
calib: new_cal[i], sas_ok: new_sas_ok[i], error: new_err[i], $
control_index: new_control[i], parentfits: new_parentfits[i]}
if i eq 0 then data = [a] else data = [data, a]
endfor

Expand Down

0 comments on commit b87a656

Please sign in to comment.