%% function getSensingMatrix(opt,sigAC,probeNames, mPrb, cPrbNames, % driveNames, mDrv, cDrvNames, noiseAC) % % Plot a sensing matrix of specified probes and drives. % % === Inputs === % % opt: Optickle instance. % % sigAC: Output of tickle. tickle has to be called with only one frequency % point. [Nprb*Ndrv] % % probeNames: A cell array of probe names. % % mPrb: A matrix of size [length(probeNames)*length(cPrbNames)]. % This matrix is used to convert from normal probes to compound % probes. % % cPrbNames: A cell array of compound probe names. % % driveNames: A cell array of drive names. % % mDrv: A matrix of size [length(driveNames)*length(cDrvNames)]. % This matrix is used to convert from normal drives to compound % drives. % % cDrvNames: A cell array of compound drive names. % % noiseAC (optional): noise matrix ( Nprb x Naf ) function [mSens, mSensNorm, mOfs, mOfsMeter] = getSensingMatrix(opt,sigAC,sigDC,probeNames, mPrb, cPrbNames, driveNames, mDrv, cDrvNames, noiseAC) %% test=0; if test probeNames={'REFL_1I','REFL_1Q','REFL_2I','REFL_2Q'}; mPrb=[1,0,0,0;0,1,1,0]; cPrbNames={'REFL_1I','Some shit'}; driveNames={'PRM','BS','ETMX','ETMY'}; mDrv=[1,0,0,0;0,1,0,0;0,0,1,1;0,0,1,-1]; cDrvNames={'PRM','BS','CARM','DARM'}; end %% try probeNames; catch probeNames=getProbeName(opt); mPrb = eye(length(probeNames)); cPrbNames=probeNames; end try driveNames; catch driveNames=getDriveNames(opt); mDrv = eye(length(driveNames)); cDrvNames=driveNames; end %% Complex sensing matrix iPrb=cellfun(@(x)getProbeNum(opt,x),probeNames); iDrv=getDriveNumbers(opt,driveNames); sigACr=sigAC(iPrb,iDrv); %Sensing matrix mSens=mPrb*sigACr*mDrv'; %Noise normalized sensing matrix noiseInv = diag(1./noiseAC(iPrb)); sigACr = noiseInv * sigACr; mSensNorm=mPrb*sigACr*mDrv'; sigDCr=sigDC(iPrb); mOfs = abs(mPrb*sigDCr); mOfsMeter = diag(mOfs)*(1./mSens);