Peak to Valley Calculation in OpenLab 2.7

Dear Community,

we want to calculate the peak to valley ratio in OpenLab 2.7 between two defined peaks (e.g. Peak X and Peak Y).

According to the OpenLab Help the internal calculation does always calculate the minimum p/v (PV = Min (PV1, PV2)), if there are valleys to both sides of the interesting peak (e.g. Peak Y, Peak X and Peak Z).

Within the custom calculation the Hv (high of valley) is not directly accessible. If we use the calculation Peak_Height/Peak_PeakValleyRatio, the result is also depending on the minimum p/v.

When using a custom calculation, how can we ensure that the peak to valley is always calculated between two defined peaks even though there are valleys to both sides of the interesting peak?

Parents Reply Children
  • Hello Marty,

    thanks for this idea. We will try this for calculation the Peak to Valley Ratio between two defined Peaks.

    ChemieCopter

  • Dear Marty,

    In my case:

    If I use this expression in the IR

    =Peak_Height/Peak_LevelStart

    Then I get wrong values in cases when level start or level end are zero.

    I have changed expressions

    =IIf(Peak_LevelStart<=0,"zero",Format(Format(Peak_Height,"0.00000")/Format(Peak_LevelStart,"0.00000"),"0.00"))

    and conditional formating

    to have this result

    Please advice what can be improved here because if I remove conditional formating then in the table I will get #Error value or infinity in cases when Peak_LevelStart or Peak_LevelEnd are zero.

    Thank you in advance,

    Kind regards,
    Rustam

  • Hello,

    Try using something like =If(Peak_LevelStart<=0,"NA",FormatNumber((Peak_Height/Peak_LevelStart),4)) as the value expression. In the example below, I used this for the PtoV start column. I would use IF instead of IIF because of the outlined issue below. The report renderer will typically catch the error and still give you the value but that may not always be the case. 

    IIf always evaluates both truepart and falsepart, even though it returns only one of them. Because of this, you should watch for undesirable side effects. For example, if evaluating falsepart results in a division by zero error, an error occurs even if expr is True.

  • Dear Marty,

    Thank you for your assistance and guidance. Maybe this is the SW related issue and in OpenLAB CDS 2.8 this will work, because in my case OpenLAB CDS 2.6  it doesn't work as I expected. But thanks to your assistance I think that I found the solution.
    You have mentioned this  " The report renderer will typically catch the error and still give you the value but that may not always be the case".

    And in my case the expression =If(Peak_LevelEnd<=0,"NA",FormatNumber((Peak_Height/Peak_LevelEnd),2))  is in the column with header text P/V end 2

    while in the column with header text P/V end 1   there is the following expression =If(FormatNumber(Peak_LevelEnd,2)<=0,"NA",FormatNumber((FormatNumber(Peak_Height,2)/FormatNumber(Peak_LevelEnd,2)),2))  
    I just  added FormatNumber for every value, and finally it works as I expect. 

    Thank you very much Marty.

    Kind regards,
    Rustam

Was this helpful?