ThorstenHellert / SC

6 stars 4 forks source link

BPMData indexes from SClocoLib need to be transposed #18

Closed oscarxblanco closed 1 year ago

oscarxblanco commented 1 year ago

Dear all,

the LOCO structure BPMData returned by the function getBPMCMstructure contains the transposed indexes with respect to the LOCO documentation.

One could workaround this by reasigning the transposed variables to themselves :

BPMData.BPMIndex  = BPMData.BPMIndex' ;
BPMData.HBPMIndex = BPMData.HBPMIndex';
BPMData.VBPMIndex = BPMData.VBPMIndex';

However, I wonder if it is possible to fix it while keeping backwards compatibility (for some few releases).

Best regards, o

ThorstenHellert commented 1 year ago

Could you point me to the LOCO documentation you are talking about?

oscarxblanco commented 1 year ago

Sure,

it is in the LOCOManual.doc file page 8, available here https://github.com/atcollab/MML/tree/master/applications/loco/Documentation

% 3. BPM AND CORRECTOR MAGNET STRUCTURES
BPMData.FamName = 'BPM';
BPMData.BPMIndex = findcells(THERING, 'FamName', BPMData.FamName);
BPMData.HBPMIndex = 1:1:length(BPMData.BPMIndex);       % Must match the response matrix
BPMData.VBPMIndex = 1:1:length(BPMData.BPMIndex);       % Must match the response matrix
BPMData.HBPMGain = ones(length(BPMData.HBPMIndex),1);
BPMData.VBPMGain = ones(length(BPMData.VBPMIndex),1);
BPMData.FitGains = 'Yes';
BPMData.FitCoupling = 'No';
ThorstenHellert commented 1 year ago

I think this is just an example and I couldn't find any case in which the dimension of the arrays (row or column vector) plays a role during the LOCO procedure. Do you see any logical reason why 'HBPMGain' should have transposed dimensions of 'HBPMIndex' as is given in the example in the manual? I have no problem changing the toolkit functions to accommodate this but it's not clear to me what the dimensions should be.

oscarxblanco commented 1 year ago

Dear Thorsten,

thank you for your answer. I haven't been able to reproduce the problem I saw while using the locogui when loading the non transposed variables in the saved .mat file. For the moment i have not much more input on this topic. I'll keep checking.

Best regards again, o