Reports until 22:03, Thursday 15 September 2016
H1 CAL (CAL)
darkhan.tuyenbayev@LIGO.ORG - posted 22:03, Thursday 15 September 2016 - last comment - 18:22, Wednesday 21 September 2016(29744)
Testing coherence calculation w/ different averaging parameters

Kiwamu I, Jeff K, Darkhan T,

Overview

Today we looked at the calibration line coherence values calculated in the front end. We discovered that in the front-end model with the currently used averaging parameters the coherence value is updated once every 10 seconds (first 1.5 minutes in Fig. 1).

We propose modifying the averaging code to improve coherence calculation and avoid potential aliasing (see details).

Details

A front-end model that calculates coherence uses N data points taken every Scycles computational cycles to calculate cross-spectral density of the signals. Scycles is controlled by an EPICS record $(IFO):CAL-CS_TDEP_COH_STRIDE (or simply STRIDE): Scycles = FE_RATE * STRIDE. There are drawbacks associated with this approach:

We can deal with the first problem listed above by reducing STRIDE. On Fig. 1 we show coherence values for N = 10 and STRIDE set to 10, 5, 1, 1/16 and again 1. Notice that this test was done when the IFO was not locked, thus we do not expect a coherence of ~1. When STRIDE is set to 1/16, we can see that the number of averages must be increased in order to include actual fluctuations in the signals (in the last 2.5 minutes N = 120).

Fig. 1

Several minutes later IFO locked (at t = -5 in Fig. 2) and the coherence became ~0.8. After we set the line amplitude to its nominal value we got coherence of ~1.

Fig. 2

Next, to avoid aliasing we should use all data points (equivalent to setting STRIDE = 1/FE_RATE in the current code) and increase N accordingly. Thus to integrate over 10 seconds and avoid aliasing the current code will require O(FE_RATE * 10) = O(160k) operations per cycle and a buffer for 160k values, which is unnecessary expensive.

A following minor modification of the averaging code can solve the issue described above. Instead of adding every Scycles'th data point into the averaging buffer, we could insert an average of Scycles values. E.g. buffer_and_average() can be modified as follows:

...

    static int mini_sum = 0;

...

    //Increment cycle count
    mini_sum += data;
    cycle_counter++;
    if (cycle_counter >= cycles_between_data) {
        buffer[current_pointer] = mini_sum / ((double) cycles_between_data);
        current_pointer++;
        cycle_counter = 0;
        mini_sum = 0;
    }

...

With this modification and N = 160, STRIDE = 1/16 (Scycles = 1024), the coherence will be calculated with 10 second integration and will require O(160) operations per cycle, and the coherence value will be updated every 1/16 of a second.

Images attached to this report
Comments related to this report
darkhan.tuyenbayev@LIGO.ORG - 16:54, Wednesday 21 September 2016 (29887)CAL

Jeff K, Kiwamu I, Joe B, Darkhan T,

The modifications suggested above have been implemented at LHO (the modification was implemented during a bug fix, LHO alog 29876). The modifications also include an increased max buffer size:

...

#define MAX_SIZE 256

...

    static double mini_sum = 0;

...

    //Increment cycle count
    mini_sum += data;
    cycle_counter++;
    if (cycle_counter >= cycles_between_data) {
        buffer[current_pointer] = mini_sum / ((double) cycles_between_data);
        current_pointer++;
        cycle_counter = 0;
        mini_sum = 0;
    }

...

The changes have been committed to cds_user_apps repository, r14301.

Following is how coherence was calculated for locked but with high noise floor at lower frequencies (see attached displacement ASD during this measurement), so only PCAL_LINE2 (at 331.9 Hz) has coherence of ~1, and all three of the ~35 Hz lines do not have good coherence:

Fig. 1

The coherences were calculated with H1:CAL-CS_TDEP_COH_STRIDE set to 1/16 and H1:CAL-CS_TDEP_COH_BUFFER_SIZE (N in the original alog) set to 80 (at [-4, -2] min time interval) and 160 (at [-2, 1] min time interval). With H1:CAL-CS_TDEP_COH_BUFFER_SIZE set to 160, each of the coherence calculations include data points from past 10 seconds.

Images attached to this comment
darkhan.tuyenbayev@LIGO.ORG - 18:22, Wednesday 21 September 2016 (29891)CAL

Attached is a plot of the DARM time-dependent parameters calculated in the front-end when the IFO noise floor was reasonably low (at about 23 UTC). Notice that Y-axis for coherence is zoomed to 1 for a better detail.

It seems that the ER9 Matlab DARM model parameters for H1 that was used for calculation of current TDEP EPICS values needs an update. The ESD sign is opposite to the one in the DARM model. Calculation of κPU is hugely biased due to the wrong sign of κTST and it's magnitude being incorrect by an order of magnitude.

During last night's lock stretches the sign of κTST calculated in the front-end was positive (see attachment 2), opposite to the currently calculated value. A possible explanation for this is that L3 stage sign flip commisioning activities are underway (see LHO alog 29860).

Images attached to this comment