本文整理汇总了C#中Signal.Select方法的典型用法代码示例。如果您正苦于以下问题:C# Signal.Select方法的具体用法?C# Signal.Select怎么用?C# Signal.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Signal
的用法示例。
在下文中一共展示了Signal.Select方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Ctor_WithCombinedSignals_SignalsAreSet
public void Ctor_WithCombinedSignals_SignalsAreSet()
{
var signals = new Signal[]
{
new BuySignal(),
new SellSignal()
};
var signalsToAdd = signals.Select( s => new DefensiveCombinedSignal( s ) );
var combinedSignal = new DefensiveCombinedSignal( signalsToAdd );
Assert.That( combinedSignal.Signals, Is.EquivalentTo( signals ) );
}
示例2: Weight_WhenCalled_AllInternalSignalsAreWeighted
public void Weight_WhenCalled_AllInternalSignalsAreWeighted()
{
var signals = new Signal[]
{
new BuySignal( 20 ),
new SellSignal( 50 )
};
var combinedSignal = new DefensiveCombinedSignal( signals );
var weightedSignal = (CombinedSignal)combinedSignal.Weight( 0.5d );
var weightedSignals = signals.Select( s => s.Weight( 0.5d ) ).ToList();
Assert.That( weightedSignal.Signals, Is.EquivalentTo( weightedSignals ) );
}
示例3: DrawSignal
private void DrawSignal(Panel p, Graphics g, Signal signal)
{
g.Clear(Color.White);
g.FillRectangle(new SolidBrush(Color.White), p.DisplayRectangle);
g.DrawLine(new Pen(Color.Red, 1), new Point(0, p.DisplayRectangle.Height / 2), new Point(p.DisplayRectangle.Width, p.DisplayRectangle.Height / 2));
var yScale = p.Height / InputSignal.Amplitude / 2;
yScale = double.IsInfinity(yScale) ? 0 : yScale;
g.DrawLines(new Pen(Color.Black), signal.Select((y, x) => new PointF((1.0F * x) / (1.0F * SignalLength / signal.Length), (float)(y * yScale) + p.Height / 2.0F)).ToArray());
}
示例4: ApplyToSignal
public Signal ApplyToSignal(Signal signal)
{
return new Signal(signal.Select(y=>y+ (Rnd.Next(0, 10) < 5 ? -1 : 1) * Rnd.NextDouble()*signal.Amplitude/Math.Sqrt(Snr)).ToArray());
}