FUNCTION get_pf_openfrac, input
;+
; This routine returns the XRT pre-filter open ratio estimated
;   from the G-band image analysis by Aki Takeda in June 2026.
;
;   open_ratio at phase 1 (after  9-May-2012 12:00) : 0.0009
;   open_ratio at phase 2 (after 14-Jun-2015 12:30) : 0.0225
;   open_ratio at phase 3 (after 27-May-2017 11:00) : 0.0517 ; 0.0225*2.30
;   open_ratio at phase 4 (after 29-May-2018 00:00) : 0.0688 ; 0.0517*1.33
;   open_ratio at phase 5 (after  8-Jun-2022 12:40) : 0.0756 ; 0.0688*1.10
;   open_ratio at phase 6 (after  5-May-2023 04:30) : 0.0930 ; 0.0756*1.23
;   open_ratio at phase 7 (after 11-May-2024 06:16) : 0.1135 ; 0.0930*1.22
;
; IDL> factor=get_pf_openfrac(XRT_index)
; IDL> factor=get_pf_openfrac('19-feb-2013 12:00')
;
; HISTORY : 18-Oct-2020 : initial version, 
;                           get_slcorfact_raw.pro was modified.
;           24-oct-2020 : phase 3 and 4 values optimized by
;                           using G-band monitor image values.
;           12-nov-2020 : phase 2 to 4 values modified according to
;                         the change front blue filter transmission,
;                         from 0.026%(peak) to 0.020%(average).
;            6-sep-2022 : added phase 5 values.
;           13-jun-2023 : added phase 6 values.
;           26-aug-2024 : added phase 7 values.
;           28-nov-2024 : a bug fixed (ofrac_p7 typo).
;           23-jan-2025 : a bug fixed (p6 starting date corrected).
;            6-jun-2026 : reconsideration of G-band optics 
;                         effective area (1963.5 --> 1256.6 mm^2).
;-
if n_params() eq 0 then begin
  print, '- open_fraction at phase 1 (after  9-May-2012 12:00) : 0.0009'
  print, '- open_fraction at phase 2 (after 14-Jun-2015 12:30) : 0.0225'
  print, '- open_fraction at phase 3 (after 27-May-2017 11:00) : 0.0517'
  print, '- open_fraction at phase 4 (after 29-May-2018 00:00) : 0.0688'
  print, '- open_fraction at phase 5 (after  8-Jun-2022 12:40) : 0.0756'
  print, '- open_fraction at phase 6 (after  5-May-2023 04:30) : 0.0930'
  print, '- open_fraction at phase 7 (after 11-May-2024 06:15) : 0.1135'
  goto, FIN
endif
;
stim_p1='9-may-2012 12:00'    &  ofrac_p1=0.0009
stim_p2='14-jun-2015 12:30'   &  ofrac_p2=0.0225
stim_p3='27-may-2017 11:00'   &  ofrac_p3=0.0517
stim_p4='29-may-2018 00:00'   &  ofrac_p4=0.0688
stim_p5='8-jun-2022 12:40'    &  ofrac_p5=0.0756
stim_p6='5-may-2023 04:30'    &  ofrac_p6=0.0930
stim_p7='11-may-2024 06:15'   &  ofrac_p7=0.1135
;
tsec_p1=anytim(stim_p1,/sec)-1e9
tsec_p2=anytim(stim_p2,/sec)-1e9
tsec_p3=anytim(stim_p3,/sec)-1e9
tsec_p4=anytim(stim_p4,/sec)-1e9
tsec_p5=anytim(stim_p5,/sec)-1e9
tsec_p6=anytim(stim_p6,/sec)-1e9
tsec_p7=anytim(stim_p7,/sec)-1e9
;
chk=size(input)
dtype= chk[chk[0]+1]
if dtype eq 8 then tt1=anytim(input.date_obs,/sec)-1e9 $
              else tt1=anytim(input,/sec)-1e9     
;** Note: -1e9 : use smaller number to avoid losing lower digits. **
;
ofrac=0.0
if tt1 gt tsec_p1 then ofrac=ofrac_p1
if tt1 gt tsec_p2 then ofrac=ofrac_p2
if tt1 gt tsec_p3 then ofrac=ofrac_p3
if tt1 gt tsec_p4 then ofrac=ofrac_p4
if tt1 gt tsec_p5 then ofrac=ofrac_p5
if tt1 gt tsec_p6 then ofrac=ofrac_p6
if tt1 gt tsec_p7 then ofrac=ofrac_p7
;
return,ofrac
;
FIN:
end
