Skip to content

Commit

Permalink
Added field sas_ok to aspect data object
Browse files Browse the repository at this point in the history
  • Loading branch information
FredSchuller committed Oct 6, 2023
1 parent fed1254 commit 11b65dc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion stix/idl/processing/aspect/SAS_test.pro
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ print,"Computing aspect solution..."
stx_derive_aspect_solution, data, simu_data_file, interpol_r=1, interpol_xy=1
!p.multi = [0,1,2]
; Only plot solution with no error message
good = where(data.ERROR eq '')
good = where(data.sas_ok eq 1)
utplot, data[good].TIME, data[good].y_srf, /xs, /ynoz, ytit='!6Y!dSRF !n [arcsec]',chars=1.4,/psym
utplot, data[good].TIME, data[good].z_srf, /xs, /ynoz, ytit='!6Z!dSRF !n [arcsec]',chars=1.4,/psym
;;;;;;;;;;;;;;;;
Expand Down
3 changes: 2 additions & 1 deletion stix/idl/processing/aspect/prepare_aspect_data.pro
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ function prepare_aspect_data, infile, quiet=quiet
a = {stx_aspect_dto, $
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, error : ""}
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 : ""}
if i eq 0 then result = [a] else result = [result, a]
endfor

Expand Down
2 changes: 2 additions & 0 deletions stix/idl/processing/aspect/stx_derive_aspect_solution.pro
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ pro stx_derive_aspect_solution, data, simu_data_file, interpol_r=interpol_r, int
if dist_center gt 1.1 * rsol[i] then data[i].ERROR = 'SAS_SOL_TOO_FAR'
endelse
endif
; Flag data with sas_ok=0 in case of any error
if data[i].ERROR eq '' then data[i].sas_ok = 1 else data[i].sas_ok = 0
endfor

; Store results as arcsec in SRF in the data structure
Expand Down
2 changes: 1 addition & 1 deletion stix/idl/processing/aspect/stx_remove_bad_sas_data.pro
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pro stx_remove_bad_sas_data, data
time: data[good[i]].time, duration: data[good[i]].duration, $
spice_disc_size: data[good[i]].spice_disc_size, $
y_srf: data[good[i]].y_srf, z_srf: data[good[i]].z_srf, $
calib: data[good[i]].calib, error : ""}
calib: data[good[i]].calib, sas_ok : 1, error : ""}
result = [result, one_data]
endfor
data = result
Expand Down
10 changes: 6 additions & 4 deletions stix/idl/processing/aspect/stx_smooth_sas_data.pro
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,17 @@ pro stx_smooth_sas_data, data

; 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)
for i=0,new_dim-1 do if data[2*i].ERROR then new_err[i] = data[2*i].ERROR
for i=0,new_dim-1 do if data[2*i+1].ERROR then new_err[i] = data[2*i+1].ERROR

for i=0,new_dim-1 do if (data[2*i].sas_ok eq 1 AND data[2*i+1].sas_ok eq 1) then new_sas_ok[i] = 1

; build new array of data structures
for i=0,new_dim-1 do begin
; FSc, 2022-02-15: use anonymous structure here to be independant of changes made to STX_ASPECT_DTO on STIXcore side
a = {cha_diode0: new_sigA[i], cha_diode1: new_sigB[i], chb_diode0: new_sigC[i], chb_diode1: new_sigD[i], $
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], error: new_err[i]}
calib: new_cal[i], sas_ok: new_sas_ok[i], error: new_err[i]}
if i eq 0 then data = [a] else data = [data, a]
endfor

Expand Down

0 comments on commit 11b65dc

Please sign in to comment.