Node org.unizone.source.Correlation

org.unizone.0.8547
Instance of TypeScriptInfo

Node dataValue
org.edgescript.TypeScriptInfo.prerequisiteParcelsList{}
org.edgescript.TypeScriptInfo.prerequisiteMethodsList{}
org.edgescript.TypeScriptInfo.script/* instance Source src1; instance Source src2; instance Value[Int] days; constructor() { TimeBuffer:(); instance days = new Value(Int, 30); } Void setDays(Int days) { instance days.set(days); } class Boolean isResourceOf(Listable node, Symbol aspect) { if (aspect == #adaptors) return true; false; } class String resourceLabel() { "correlation"; } String resourceString() { instance days.toString + " days correlation (" + instance src1.toString + ", " + instance src2.toString + ")"; } Symbol valueType() { #correlation } Void designEditor(WidgetWorkspace ws) { ws.addLabel(new Place(0, 0).setPadding(5, 5), "Days"); ws.addField(new Place(1, 0).setPadding(20, 5), instance days, null); } Mixable mixWith(Mixable item) { instance src1 = Producer.mix(1); addNextSource(instance src1); instance src2 = Producer.mix(0); addNextSource(instance src2); this; } trace TimeData createData(Time t, Symbol resolution) { t.toString; Producer.report("Preparing " + toString() + " at " + t.toString); external cond_history_from = t.addDays(-instance days.value); external cond_history_to = t; external cond_history_resolution = #day; Set[Time] dates = new Set(Time); instance src1.collectSteps(#cond_history, dates); instance src2.collectSteps(#cond_history, dates); if (dates.size < 2) return; Array[Real] ar1 = new Array(Real, dates.size - 1); Array[Real] ar2 = new Array(Real, dates.size - 1); Real val1 = null; Real val2 = null; Time time = null; Real trailVal1 = null; Real trailVal2 = null; Time trailTime = null; 0 .to(dates.size - 2, trace Void(Int i) { trailVal1 = val1; trailVal2 = val2; trailTime = time; time = dates.at(i); external cond_history = time; val1 = instance src1.aspectReal(#value); val2 = instance src2.aspectReal(#value); if (val1 != null && val2 != null && trailVal1 != null && trailVal2 != null) { Int span = time.subtractDate(trailTime); if (span > 0) { ar1.set(i, (val1 - trailVal1) / (span / 365) ^ 0.5); ar2.set(i, (val2 - trailVal2) / (span / 365) ^ 0.5); } else { time = trailTime; val1 = trailVal1; val2 = trailVal2; } } }); TimeData data = new TimeData(this, time); data.setAspect(#value, Math.correlationMinusOne(ar1, ar2, 0)); Producer.report(""); data; } */
org.edgescript.TypeScriptInfo.defineTypeorg.unizone.source.Correlation
org.edgescript.TypeScriptInfo.prerequisiteScriptsList{}