20190304 DX NCPA Check

18:18 Closed loop, bin 1, 200 Hz
  • TN 181635

18:27 Closed Loop, bin 1, 990 Hz
  • GOPT Off
    • Gain 0.5, 0.3, 0.3
    • 182739, 182822
  • GOPT On, disturbance Gopt_990Hz.fits
    • NCPA Off
    • Optical Gain 0.66, ratio, 1.0
    • Gains 0.34, 0.2, 0.2
    • 183049, 183112
  • Gopt On, NCPA On
    • No NCPA values showning in Gopt NEW coefficent boxes
    • WFS log
      • WfsArbitrator _37579|DEB| 207|2019-03-04 18:32:14.765941| MAIN > arbFunc updateNcpaInternal (, 'FLAOWFS', '', 209.97800000000001, 0)
      • WfsArbitrator _37579|DEB| 208|2019-03-04 18:32:14.923902| MAIN > arbFunc updateNcpaInternal done.
      • '' should be RETROREF (?)
    • 183434, 183447
    • WFSARB log
WfsArbitrator_37578|INF|       246|2019-03-04 18:35:15.254985|              WFS > Python command: WfsArbScripts.updateNcpa(self, sensor = 'FLAOWFS', instr = '', rotAngle = 209.978, zero = 0)
    • /tmp/gopt.stdout
Waiting on semaphore...
--/local/aomeas/adsec_data/20190304/Data_20190304_250000/--
Saved 233 frames at 232.00 Hz
--/local/aomeas/adsec_data/20190304/Data_20190304_250000/--
Saved 728 frames at 495.00 Hz
--/local/aomeas/adsec_data/20190304/Data_20190304_250000/--
Saved 1223 % AOMULTITON_ELAB::GETOBJ: Getting tracknum 20190304_250000
% AOPUPILS::INIT: File not found:/local/aomeas/wfs_calib_W2/ccd39/LUTs/bin1/20130919-004544/pup1.fits
% AOELAB::INIT: Mode Shapes file not found
% AODISTURB_SINMODE::INIT: Current M2C is not equal to M2C used to create disturbance!
% AOMODALDISTURB::INIT: WF object not available
% AORESIDUAL_MODES::INIT: WF object not available
% AOMODES::INIT: WF object not available
% AOCOMMANDS::INIT: /local/aomeas/adsec_data/20190304/Data_20190304_250000/Commands_20190304_250000.fits not found
% AOMODALPOSITIONS::INIT: WF object not available
% AOFRAMES::INIT: Cannot find frames  file: /local/aomeas/adsec_data/20190304/Data_20190304_250000/Frames_20190304_250000.fits
% Program caused arithmetic error: Floating underflow
% Program caused arithmetic error: Floating underflow
    • Important: Current M2C is not equal to M2C used to create disturbance!

19:00 Create new KL_v26 table_LUCIFER_ACE-AO_KL_v26.txt file
  • Create symbolic link table_LUCIFER_ACE-AO.txt -> table_LUCIFER_ACE-AO_KL_v26.txt
  • Create symbolic link table_RETROREF_ACE-AO.txt -> table_LUCIFER_ACE-AO_KL_v26.txt
  • Create symbolic links for Greg's measured Recons to Rec_flao_b?m???.fits. See https://wiki.lbto.org/AdaptiveOptics/20190208_DX_Day
  • Send PresetAO
WfsArbitrator_37579|INF|       272|2019-03-04 19:29:07.346811|             MAIN > selectDisturbance(): searching for disturbance file, please wait...
WfsArbitrator_37579|INF|       273|2019-03-04 19:29:21.823377|             MAIN > selectDisturbance(): selected disturbance CmdDisturb_20190304_194426.fits
WfsArbitrator_37579|DEB|       274|2019-03-04 19:29:21.856728|             MAIN > Loading setup file /home/aoeng/aoroot/calib/wfs/current/setups/RETROREF_ACE-AO
  • Copied setups/20180227_ARGOS to setups/RETROREF_ACE-AO
  • Resend PresetAO
  • AcquireRefAO
    • gains 0.76, 0.3, 0.1
    • change to 0.5, 0.3, 0.3
    • disturbance file for Gopt /local/aomeas/adsec_calib/M2C/KL_v26/disturb/CmdDisturb_20190304_194426.fits
    • save flat 20190304_b1_m400.sav
  • Gopt On
    • optical gain 0.56
    • In od_gopt.R.201903040002.log
...
...
OptLoopDiagnostic_37527|INF|   1121900|2019-03-04 20:14:15.843241            MAIN > Getting frame 1998 of 2000
OptLoopDiagnostic_37527|INF|   1121901|2019-03-04 20:14:15.845276            MAIN > Getting frame 1999 of 2000
OptLoopDiagnostic_37527|INF|   1121902|2019-03-04 20:14:15.847307            MAIN > Getting frame 2000 of 2000
OptLoopDiagnostic_37527|INF|   1121903|2019-03-04 20:14:15.847343            MAIN > Writing on disk....
OptLoopDiagnostic_37527|INF|   1121904|2019-03-04 20:14:16.109934            MAIN > All data saved correctly
...
...
  • NCPA On
  • wfs log
OWFS', 'RETROREF', 209.97800000000001, 0)
WfsArbitrator_37579|DEB|       662|2019-03-04 20:00:21.368807|             MAIN > arbFunc updateNcpaInternal done.
WfsArbitrator_37579|DEB|       663|2019-03-04 20:00:31.390194|             MAIN > arbFunc updateNcpaInternal (, 'FLAOWFS', 'RETROREF', 209.97800000000001, 0)
  • No NCPA coefficients in Gopt NEW boxes
  • image
  • /tmp/wfsarb.stdout output while NPCA button is pressed on WFS Control GUI
% Compiled module: MYNCPAFUNCT.
% Compiled module: LUCI2NCPAINTERP.
NCPA coefficients:      13.0000     -29.9927     -9.98533      10.0000
      10.0000  -0.00366735      4.99633     -3.00000
  • Still no coefficient on Gopt GUI
  • I don't see any corrections on the pyramid pupils

  • Python
    • /home/aoeng/aoroot/lib64/python/AdOpt/WfsArbScripts.py
def updateNcpaInternal( app, sensor, instr, rotAngle, zero=False):

    if instr=="":
       instr="LUCIFER"

    from AdOpt import asm
    a = asm.asm()
    a.setApp(app)

    if not zero:
        ncpaVector = ncpaLookup( app, sensor, instr, rotAngle)
    else:
        ncpaVector = numarray.array([0.0]*20)

    a.set_z0( ncpaVector, zernike=True, luci= (instr=='LUCIFER'))
    print 'updateNcpaInternal: done'
    • /home/aoeng/aoroot/lib64/python/AdOpt/asm.py
    def set_z0(self, z, zernike=True, luci=True):

       cmd = 'set_z0, ['+','.join(['%3.2fe-9'% z[x] for x in range(len(z))]) + '], KL="'+self.getKLname()+'"'
       if zernike:
          cmd += ', /ZERNIKE'
       if luci:
          cmd += ', /LUCI'
       return self.ex( cmd, timeout=20000)
  • /home/aoeng/aoroot/idl/adsec_lib/adsec_utilities/set_z0.pro
; Writes into the secondary mirror memory a vector of constant NCPA KL coefficents
;
; params:
; 
; v = fltarr(672) vector of KL coefficents
;     if a vector with less elements is passed, it will be padded with zeroes
;
; /ZERNIKE: if set, the coefficents are Zernikes and will be converted to KL
;           before being written into the ASM memory.
;           Zernikes are in canonical order [piston, tip, tilt, focus, astigmatism...]
;
; Modification history:
;
; Written by: A. Puglisi Jan 2015

pro set_z0, v, ZERNIKE=ZERNIKE, MAXKL=MAXKL, LUCI=LUCI, KL=KL
@adsec_common

   ; How to do a write_seq() where the contents are automatically distributed??
   ;err = write_seq( 0, 167, rtr_map.matrix_B0A+(1600*4)-4, 4, v) 
   ;err = write_seq( 0, 167, rtr_map.matrix_B0B+(1600*4)-4, 4, v) 

   if not keyword_set(KL) then KL='KL_v16'

   if keyword_set(ZERNIKE) then begin
      if not keyword_set(MAXKL) then MAXKL=50
   ; ao_status.m2c
      v = z2m4adsec( KL, indgen(n_elements(v)-1), v[1:*], MAXKL, LUCI=LUCI)
   endif

   if n_elements(v) lt 672 then begin
      v1 = v
      v = fltarr(672)
      v[0:n_elements(v1)-1] = v1
   endif

   for bcu=0,5 do begin

      err = write_seq(bcu*28, bcu*28+27, rtr_map.matrix_B0A+(1600*4)-4, float(v[bcu*28*4 : bcu*28*4 + (28*4-1)]))
      err = write_seq(bcu*28, bcu*28+27, rtr_map.matrix_B0B+(1600*4)-4, float(v[bcu*28*4 : bcu*28*4 + (28*4-1)]))
   endfor

   ;for dsp=0,167 do begin
;
;;      err = write_seq( dsp, dsp, rtr_map.matrix_B0A+(1600*4)-4, float(v[dsp*4:dsp*4+3])) 
;      err = write_seq( dsp, dsp, rtr_map.matrix_B0B+(1600*4)-4, float(v[dsp*4:dsp*4+3])) 
;
;   endfor
end
;+
; Compute the Zernike projection to KL modes for LBT ASM
; INPUTS:
;   zernNumber              vector of Zernike indices
;   zernAmplitude           vector of Zernike amplitude [nm]
;   maxKlMode               max number of KL modes to use in the projection
; KEYWORDS:
;   luci                    make a Zernike cube orthogonal on LUCI mask
;   show                    makes some plots
; OUTPUT:
;   projZernLimitedNModes   KL vector which corresponds to the Zernike projection
; OPTINAL OUTPUTS:
;   projZernCumReached      normalized RMS reached by the cumulated  KL projection
;                           limiting to maxKlMode the number of modes
;                           
; written by G. Agapito 21/01/2015
;
;-


function z2m4adsec, klName, zernNumber, zernAmplitude, maxKlMode, luci=luci, $
                    show=show, projZernCumReached=projZernCumReached

if not keyword_set(show) then show = 0B

maxZernMode_c = max([100,max(zernNumber)])

z2m_file = getenv('ADOPT_MEAS')+path_sep()+'adsec_calib/M2C/'+klName+'/z2m_nz'+strtrim(fix(maxZernMode_c),2)
z2phi_file = getenv('ADOPT_MEAS')+path_sep()+'adsec_calib/M2C/'+klName+'/z2phi_nz'+strtrim(fix(maxZernMode_c),2)
if luci then begin
    z2m_file += '_orthoLuci'
    z2phi_file += '_orthoLuci'
endif
z2m_file += '.sav'
z2phi_file += '.sav'

if file_test(z2m_file) then begin

   restore,z2m_file
   totalklmodes = (size(z2m,/dim))[1]

endif else begin

  restore, getenv('ADOPT_MEAS')+path_sep()+'adsec_calib/M2C/'+klName+'/klmatrix_phase_inv.sav'

  ; number of KL modes in the phase cube
  totalklmodes = (size(klmatrix_inv,/dim))[1]

  if file_test(z2phi_file) then begin
  
    restore, z2phi_file
  
  endif else begin

    mask = bytarr(dpix,dpix)
    mask[idx_mask] = 1
    if dpix mod 2 ne 0 then begin
       smask = (size(mask,/dim))[0]
       mask = mask[0:smask-2,0:smask-2]
       dpix -= 1
    endif
    
    ; luci mask
    if luci then maskOrtho = make_mask(dpix,obs=0.31)*mask
    
    ; zernike-to-phase matrix
    xsign = 1
    ysign = -1
    rot_angle = 222.948
    z2phiOrtho = zern2phi(dpix,maxZernMode_c,mask=maskOrtho,xsign=xsign,ysign=ysign,rot_angle=rot_angle)
    z2phi = fltarr(maxZernMode_c,n_elements(idx_mask))

    idx = where(mask)
    for izern=0,maxZernMode_c-1 do z2phi[izern,*] = (z2phiOrtho[izern,*,*])[idx]

    phi2z = pseudo_invert(z2phi)
    save, z2phi, phi2z, file=z2phi_file

  endelse
  ; zernike-to-modes matrix
  z2m = matrix_multiply(z2phi,klmatrix_inv)
  save, z2m, file=z2m_file

endelse


; --------------------------- ;
; --- all modes available --- ;
; --------------------------- ;

; kl projection
projZern = fltarr(totalklmodes)
for imode=0,n_elements(zernNumber)-1 do $
  projZern += z2m[zernNumber[imode],*]*zernAmplitude[imode]

; cumulated projection
projZernCum = sqrt(total(projZern^2.,/cum))/sqrt(total(projZern^2.))
projZernCumReached = projZernCum[maxKlmode-1]

; --------------------------------------------- ;
; --- limited number of modes (maxKlmode) --- ;
; --------------------------------------------- ;

; KL projection limited to maxKlmode
projZernLimitedNModes = projZern
if n_elements(maxKlmode) gt 0 then begin
  if maxKlmode lt totalklmodes then projZernLimitedNModes[maxKlmode:*] = 0.
endif

if show then begin

  ; zernNumber projection plot
  window, 0, xs=640, ys=480
  plot, projZern*1e9, psym=-1, xtit='!17KL mode number', ytit='!17mode amplitude !4[!17nm!4]!17', $
      tit='!17Zern. decomposition', xst=17, xra=[0,100]
  oplot, [maxKlmode-1,maxKlmode-1], [-1e9,1e9], line=2
  
  ; zernNumber cumulated projection plot
  window, 1, xs=640, ys=480
  plot, projZernCum, xtit='!17KL mode number', $
      ytit='!17mode RMS normalized', tit='!17Zern. decomposition', xst=17, xra=[0,100]
  oplot, [0,1000], [projZernCumReached,projZernCumReached], line=2
  oplot, [maxKlmode-1,maxKlmode-1], [0,1], line=2
  

endif

return, projZernLimitedNModes

end

20:49 Create klmatrix_inv.sav for KL_v26
  • cd /local/aomeas/adsec_calib/if_functions/20180912_mirmodes/KLdata_fit_.29.29_
  • idl
    • restore, "KLmatrix_KL_v26.sav", /v

* klmatrix_inv = pseudo_invert( klmatrix, /DOUBLE)
    • save, klmatrix_inv, dpix, idx_mask, file='klmatrix_phase_inv.sav'
-rw-r--r--. 1 AOeng aoeng 116156968 Mar  4 20:51 klmatrix_phase_inv.sav
  • cp klmatrix_phase_inv.sav /local/aomeas/adsec_calib/M2C/KL_v26/.

20:56 Closed loop
  • Gopt On
    • optical gain 0.53
  • NCPA On
    • Nothing again

21:27 Authorize as LUCI2. Preset and AcquireRefAO
  • Gopt On
    • optical gain = 0.59
  • NCPA ON
    • No NCPA Coefficients. Same output as before

23:13 Added output to /home/aoeng/aoroot/lib64/python/AdOpt/WfsArbScripts.py and
Server: Command: WfsArbScripts.updateNcpa(self, sensor = 'FLAOWFS', instr = 'LUCIFER', rotAngle = 209.978, zero = 0)
sending request
set_z0, [0.00e-9,0.00e-9,0.00e-9,13.00e-9,-29.99e-9,-9.99e-9,10.00e-9,10.00e-9,-0.00e-9,5.00e-9,-3.00e-9], KL="KL_v26", /ZERNIKE, /LUCI
updateNcpaInternal: done
Server: size: 100
  • files are written:
    • /local/aomeas/adsec_calib/M2C/KL_v26/z2phi_nz100_orthoLuci.sav
    • /local/aomeas/adsec_calib/M2C/KL_v26/z2m_nz100_orthoLuci.sav

-- DougMiller - 04 Mar 2019
Topic revision: r4 - 04 Mar 2019, DougMiller
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback