Reports until 10:29, Monday 28 September 2026
H1 CDS (CAL, CDS, ISC, SEI, SPI, SQZ)
jeffrey.kissel@LIGO.ORG - posted 10:29, Monday 28 September 2026 (92078)
How to :: Replacing CDS Function Call version of atan2.c with CDS_PARTS atan2 function block -- one-to-one drop-in replacement
J. Kissel for the CDS Team
IIET:32407
ECR:E2400394

EXECUTIVE SUMMARY: 

When replacing the cdsFunctionCall to the user-code atan2.c function with the CDS_PARTS cdsAtan2 block per IIET:32407 / ECR:E2400394, reconnect the inputs exactly as you found them, treating the numerator "y" and denominator "x" as the first and second inputs, respectively, in order to achievethe desired mathematical expression theta = atan2(y/x).

Supporting Details

The above referenced ECR demands that users replace any cdsFunctionCall use of 
    ${CDS_SRC} = /opt/rtcds/userapps/release/cds/common/src
        ${CDS_SRC}/ATAN2.c     rev 24024

with the now-integrated cdsAtan2 gui interface block that lives in the simLinkParts block of 
    /opt/rtcds/rtscore/advLigoRTS-5.5.2/src/epics/sinLink/
        CDS_PARTS.mdl
library.

Because the former cdsFunctionCall block relies on the poorly-documented c-code to determine the number and order of inputs, and the code itself -- quoted below 
    void ATAN(double *argin, int nargin, double *argout, int nargout) {

    argout[0]=latan2(argin[0],argin[1]);
    }
-- points to a built-in CDS sub-function latan2 which I couldn't find a description of (maybe it's some custom CDS version of atan2l, for "atan2 long double?"), I wasn't 100% confident in which order we should stick the previous inputs when using the cdsFunctionCall into the new CDS_PARTS version.

    EDIT: I was able to retro-actively find and confirm that latan2 is after Line 123 of tagged release 5.5.2 (git commit hash 4b167593) of the git.ligo.org/CDS/software/advLigoRTS/ repository. Though it's not commented, the input variables are defined clearly as latan2( double __y, double __x )

So, here I show what builds my confidence enough to say the input order for this user function is the same as the CDS_PARTS block -- by showing successful examples of the *old* block that have already been upgraded to the *new* block.
Thankfully, it seems like there's some industry standard for atan functions, in which the first input is the numerator "y", and the second input is the denominator, "x", within the mathematical definition,

                   /  y  \          /  input[0]  \
    theta = atan2 |  ---  | = atan2 | ---------- |
                   \  x  /          \  input[1]  /
    
and both versions within CDS follow that convention.

So, here, I attach
    (1) BEFORE Screenshot 1: /opt/rtcds/userapps/release/cal/common/models/CAL_LINE_MONITOR_MASTER.mdl     rev r35945
       The MAGNITUDE_PHASE library block when it still used the cdsFunctionCall to ${CDS_SRC}/ATAN2.c

    (2) AFTER Screenshot 2: /opt/rtcds/userapps/release/cal/common/models/CAL_LINE_MONITOR_MASTER.mdl     rev r36124
       The same MAGNITUDE_PHASE library block after being updated by Joe Betzwieser on 2026-08-27 (installed at LHO on 2026-09-02; see LHO:91779)

    (3) WHERE TO FIND cdsAtan2 Screenshot 3: /opt/rtcds/rtscore/advLigoRTS-5.5.2/src/epics/sinLink/CDS_PARTS.mdl
       The simulinkParts library within the latest release of CDS_PARTS
Images attached to this report