Ratio diagnostics
Ratio diagnostics are added using the
add_ratio()
method.It allows to compute a ratio between the
COUNT
statistics of two previously added
diagnostics. These diagnostics must be of the same type and include the COUNT
statistic.Add the computation of a ratio between two diagnostics. These two
diagnostic must include the computation of the COUNT statistic.
Parameters
----------
name
Name of the ratio statistic.
stat_numerator
Name of statistic to compute the ratio of, in comparison to another
statistic.
stat_denominator
Name of the reference statistic.
total
Whether the denominator statistic is the total on which to compute the
ratio or the complementary part.
This kind of diagnostic is plotted the same way its diagnostic parameters are.
Diagnostic setting
In the following example we are setting a ratio diagnostic computing to ratio
between two along time diagnostics:
Rejected data per pass
Total number of points per pass
from casys import Field
edited = Field(name="edited", source="IIF(FLAG_VAL.ALTI :!= 0,1, DV)", unit="count")
flag_val = ad.fields["FLAG_VAL.ALTI"]
ad.add_time_stat(
name="Rejected data, mean by pass", freq="pass", field=edited, stats=["count"]
)
ad.add_time_stat(
name="Number of points, mean by pass",
freq="pass",
field=flag_val,
stats=["count"],
)
ad.add_ratio(
name="Percentage of rejected data",
stat_numerator="Rejected data, mean by pass",
stat_denominator="Number of points, mean by pass",
total=True,
)
ad.compute()
Diagnostic plotting
Ratio statistics are plotted the same way the diagnostics they are related to are.
from casys import CasysPlot
plot = CasysPlot(data=ad, data_name="Percentage of rejected data")
plot.show()
