From 2db6e95a3fdd6c50928e07441b71b44a00178fde Mon Sep 17 00:00:00 2001 From: FredericSchuller Date: Fri, 6 Oct 2023 10:36:18 +0200 Subject: [PATCH] Added field sas_ok to aspect data object --- stix/idl/processing/aspect/SAS_test.pro | 2 +- stix/idl/processing/aspect/prepare_aspect_data.pro | 3 ++- .../processing/aspect/stx_derive_aspect_solution.pro | 2 ++ stix/idl/processing/aspect/stx_remove_bad_sas_data.pro | 2 +- stix/idl/processing/aspect/stx_smooth_sas_data.pro | 10 ++++++---- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/stix/idl/processing/aspect/SAS_test.pro b/stix/idl/processing/aspect/SAS_test.pro index 424a860c..64f78ea2 100644 --- a/stix/idl/processing/aspect/SAS_test.pro +++ b/stix/idl/processing/aspect/SAS_test.pro @@ -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 ;;;;;;;;;;;;;;;; diff --git a/stix/idl/processing/aspect/prepare_aspect_data.pro b/stix/idl/processing/aspect/prepare_aspect_data.pro index fc50bdff..ebeca542 100644 --- a/stix/idl/processing/aspect/prepare_aspect_data.pro +++ b/stix/idl/processing/aspect/prepare_aspect_data.pro @@ -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 diff --git a/stix/idl/processing/aspect/stx_derive_aspect_solution.pro b/stix/idl/processing/aspect/stx_derive_aspect_solution.pro index 89aa6fc2..f9818e12 100644 --- a/stix/idl/processing/aspect/stx_derive_aspect_solution.pro +++ b/stix/idl/processing/aspect/stx_derive_aspect_solution.pro @@ -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 diff --git a/stix/idl/processing/aspect/stx_remove_bad_sas_data.pro b/stix/idl/processing/aspect/stx_remove_bad_sas_data.pro index aca4ee6c..350b14cb 100644 --- a/stix/idl/processing/aspect/stx_remove_bad_sas_data.pro +++ b/stix/idl/processing/aspect/stx_remove_bad_sas_data.pro @@ -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 diff --git a/stix/idl/processing/aspect/stx_smooth_sas_data.pro b/stix/idl/processing/aspect/stx_smooth_sas_data.pro index 2ca143c0..07513bb2 100644 --- a/stix/idl/processing/aspect/stx_smooth_sas_data.pro +++ b/stix/idl/processing/aspect/stx_smooth_sas_data.pro @@ -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