Skip to content
Snippets Groups Projects
Commit 7d15b104 authored by Powers, Peter M.'s avatar Powers, Peter M.
Browse files

added cumulative fn

parent c97dd85b
No related branches found
No related tags found
1 merge request!210EQ rate and probability calculator
......@@ -9,6 +9,7 @@ import static java.lang.Math.pow;
import static org.opensha2.eq.Earthquakes.magToMoment;
import org.opensha2.data.Data;
import org.opensha2.data.XyPoint;
import org.opensha2.data.XySequence;
import com.google.common.base.Converter;
......@@ -402,5 +403,15 @@ public final class Mfds {
}
return Data.combine(sequences);
}
public static XySequence toCumulative(XySequence incremental) {
XySequence cumulative = XySequence.copyOf(incremental);
double sum = 0.0;
for (XyPoint p : cumulative) {
sum += p.y();
p.set(sum);
}
return XySequence.immutableCopyOf(cumulative);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment