public static void Test(AUTD autd) { const double x = AUTD.DeviceWidth / 2; const double y = AUTD.DeviceHeight / 2; const double z = 150; var center = new Vector3d(x, y, z); var g1 = Gain.FocalPoint(center); var focuses = new[] { center + 30.0 * Vector3d.UnitX, center - 30.0 * Vector3d.UnitX }; var amps = new[] { 1.0, 1.0 }; var backend = Gain.Eigen3Backend(); var g2 = Gain.HoloGSPAT(focuses, amps, backend); var gainMap = new Dictionary <int, Gain> { [0] = g1, [1] = g2 }; var gain = Gain.Grouped(autd, gainMap); var mod = Modulation.Sine(150); // AM sin 150 Hz autd.Send(gain, mod); Gain.DeleteBackend(backend); }
public void Configure(Gain gain, float time, byte timeMask, bool illuminator, byte illuminatorMask) { byte[][] expected = { new byte[] { 0x17, 0x02, timeMask, (byte)gain, illuminatorMask } }; color.Configure(gain: gain, integationTime: time, illuminate: illuminator); Assert.That(platform.GetCommands(), Is.EqualTo(expected)); }
public static void Test(AUTD autd) { const double x = AUTD.DeviceWidth / 2; const double y = AUTD.DeviceHeight / 2; const double z = 150; autd.SilentMode = false; var mod = Modulation.Static(); var center = new Vector3d(x, y, z); var seq = GainSequence.Create(autd); const int pointNum = 200; var backend = Gain.Eigen3Backend(); for (var i = 0; i < pointNum; i++) { const double radius = 30.0; var theta = 2.0 * Math.PI * i / pointNum; var p = radius * new Vector3d(Math.Cos(theta), Math.Sin(theta), 0); var gain = Gain.FocalPoint(center + p); seq.AddGain(gain); } seq.Frequency = 1; Console.WriteLine($"Actual frequency is {seq.Frequency}"); autd.Send(seq, mod); Gain.DeleteBackend(backend); }
public double GetMillivolts(Channel channel, Gain gain = Gain.Volt5, SamplesPerSecond sps = SamplesPerSecond.SPS1600) { lock (deviceLock) { byte[] result = new byte[2]; // Set disable comparator and set "single shot" mode config = 0x0003 | 0x8000; // | 0x100; config |= (ushort)SamplePerSecondMap[(int)sps]; config |= (ushort)channel; config |= (ushort)programmableGainMap[(int)gain]; data[0] = REG_CFG; data[1] = (byte)((config >> 8) & 0xFF); data[2] = (byte)(config & 0xFF); I2CDevice.Write(data); // delay in milliseconds //int delay = (1000.0 / SamplesPerSecondRate[(int)sps] + .1; // int delay = 1; Task.Delay(TimeSpan.FromMilliseconds(.5)).Wait(); I2CDevice.WriteRead(new byte[] { (byte)REG_CONV, 0x00 }, result); //var r = (((result[0] << 8) | result[1]) >> 4); //Debug.WriteLine(r.ToString()); return (ushort)(((result[0] << 8) | result[1]) >> 4) * programmableGain_Scaler[(int)gain] / 2048; } }
public override int Read(float[] buffer, int offset, int count) { float[] input = new float[buffer.Length]; float[] gain = new float[buffer.Length]; float[] cutoff = new float[buffer.Length]; Source.Read(input, offset, count); Gain.Read(gain, offset, count); Cutoff.Read(cutoff, offset, count); for (int i = offset; i < count; i++) { // basic hard clipping float x = input[i] * gain[i]; float cut = Math.Abs(cutoff[i]); if (x < -cut) { buffer[i] = -cut; } else if (x > cut) { buffer[i] = cut; } else { buffer[i] = x; } } return(count); }
private ushort[] GetFullLuminosity(Gain gain, IntegrationTime time) { // We need to configure the device for the correct gain and integration time for this reading this._i2cDevice.Write(new byte[] { TSL2591_CONTROL_RW, (byte)((byte)gain << 4 | (byte)time) }); try { // Enabled the device so that we can start a reading this._i2cDevice.Write(new byte[] { TSL2591_ENABLE_RW, 0x03 }); try { // We now need to wait for the integration time to pass so that we know we have a valid reading. The specification // states that the MAX integration time per gain step is 108ms. System.Threading.Thread.Sleep(120 * ((byte)time + 1)); var readBuffer = new byte[4]; this._i2cDevice.WriteRead(new byte[] { TSL2591_C0DATAL_R }, readBuffer); var visible = (ushort)((readBuffer[1] << 8) | readBuffer[0]); var ir = (ushort)((readBuffer[3] << 8) | readBuffer[2]); return(new ushort[] { (ushort)(visible - ir), ir }); } finally { this._i2cDevice.Write(new byte[] { TSL2591_ENABLE_RW, 0x00 }); } } finally { this._i2cDevice.Write(new byte[] { TSL2591_CONTROL_RW, 0x00 }); } }
public async Task <double> GetLux(Gain gain = Gain.Low, IntegrationTime time = IntegrationTime.Shortest) { await ConnectAndInitialize(); await Configure(gain, time); Enable(); await Task.Delay((int)time); var y = ReadRegister(Registers.Command | Registers.C0DataL, x => (ushort)((x[1] << 8) | x[0]), 2) | 0; var luminosity = (ReadRegister(Registers.Command | Registers.C1DataL, x => (ushort)((x[1] << 8) | x[0]), 2) << 16) | y; Disable(); var full = luminosity & 0xFFFF; var ir = luminosity >> 16; if ((full == 0xFFFF) | (ir == 0xFFFF)) { return(0.0); } var cpl = (float)gain * (float)time / 408.0F; return((full - ir) * (1.0f - ir / full) / cpl); }
public override int GetHashCode() { int hash = 1; if (Id != 0) { hash ^= Id.GetHashCode(); } if (Player != 0) { hash ^= Player.GetHashCode(); } if (PictureId != 0) { hash ^= PictureId.GetHashCode(); } if (Coordinate.Length != 0) { hash ^= Coordinate.GetHashCode(); } if (Gain != 0D) { hash ^= Gain.GetHashCode(); } if (IsEvo != 0) { hash ^= IsEvo.GetHashCode(); } if (Sharpness != 0D) { hash ^= Sharpness.GetHashCode(); } return(hash); }
public static void Test(AUTD autd) { const double x = AUTD.DeviceWidth / 2; const double y = AUTD.DeviceHeight / 2; const double z = 150.0; autd.SilentMode = false; var mod = Modulation.Static(); autd.Send(mod); const double radius = 30.0; const int size = 100; var center = new Vector3d(x, y, z); var stm = autd.STM(); for (var i = 0; i < size; i++) { var theta = 2 * AUTD.Pi * i / size; var r = new Vector3d(Math.Cos(theta), Math.Sin(theta), 0); var f = Gain.FocalPoint(center + radius * r); stm.AddSTMGain(f); } stm.StartSTM(0.5); Console.WriteLine("press any key to stop..."); Console.ReadKey(true); stm.StopSTM(); stm.FinishSTM(); }
public void Configure(Gain gain, Tuple <float, byte> time, Tuple <bool, byte> illuminator) { byte[][] expected = { new byte[] { 0x17, 0x02, time.Item2, (byte)gain, illuminator.Item2 } }; color.Configure(gain: gain, integationTime: time.Item1, illuminate: illuminator.Item1); Assert.That(platform.GetCommands(), Is.EqualTo(expected)); }
void Update() { if (Target != null) { _autd.Send(Gain.FocalPoint(Target.transform.position)); } }
public double GetMillivolts(Channel channel, Gain gain = Gain.Volt5, SamplesPerSecond sps = SamplesPerSecond.SPS1600) { lock (deviceLock) { byte[] result = new byte[2]; // Set disable comparator and set "single shot" mode config = 0x0003 | 0x8000; // | 0x100; config |= (ushort)SamplePerSecondMap[(int)sps]; config |= (ushort)channel; config |= (ushort)programmableGainMap[(int)gain]; data[0] = REG_CFG; data[1] = (byte)((config >> 8) & 0xFF); data[2] = (byte)(config & 0xFF); I2CDevice.Write(data); // delay in milliseconds //int delay = (1000.0 / SamplesPerSecondRate[(int)sps] + .1; // int delay = 1; Task.Delay(TimeSpan.FromMilliseconds(.5)).Wait(); I2CDevice.WriteRead(new byte[] { (byte)REG_CONV, 0x00 }, result); //var r = (((result[0] << 8) | result[1]) >> 4); //Debug.WriteLine(r.ToString()); return((ushort)(((result[0] << 8) | result[1]) >> 4) * programmableGain_Scaler[(int)gain] / 2048); } }
public override void Single() { if (GeneTestSetup.Instance.IsSimulated) { } else { string dutAddr = MeasInfo.InstruInfoList[1].Address; //连接串口 HWAISGCOM aisg = new HWAISGCOM(); aisg.Open(dutAddr, 9600); //设置参数 aisg.InitDut(); aisg.SetGain(Gain.ToString()); string gain = aisg.GetGain(); if (gain != Gain.ToString()) { DataUtils.LOGINFO.WriteLog("set aisg gain wrong"); } aisg.SetTMAMode(SubNum, Mode); var mode = aisg.GetTMAMode(SubNum); if (mode != Mode) { DataUtils.LOGINFO.WriteLog("set aisg tma mode wrong"); } //关闭串口 aisg.Close(); } }
public static void Test(AUTD autd) { autd.SilentMode = false; var delays = new byte[autd.NumDevices, AUTD.NumTransInDevice]; delays[0, 0] = 4; autd.SetDelayOffset(delays, null); var uniform = new ushort[autd.NumDevices, AUTD.NumTransInDevice]; for (var i = 0; i < autd.NumDevices; i++) { for (var j = 0; j < AUTD.NumTransInDevice; j++) { uniform[i, j] = 0xFFFF; } } var burst = new byte[4000]; burst[0] = 0xFF; var g = Gain.Custom(uniform); var m = Modulation.Custom(burst); autd.Send(g, m); }
public static void Test(AUTD autd) { const double x = AUTD.TransSpacing * (AUTD.NumTransInX - 1) / 2.0; const double y = AUTD.TransSpacing * (AUTD.NumTransInY - 1) / 2.0; const double z = 150.0; var mod = Modulation.Sine(150); var center = new Vector3d(x, y, z); var focuses = new[] { center + 20.0 * Vector3d.UnitX, center - 20.0 * Vector3d.UnitX }; var amps = new[] { 1.0, 1.0 }; var backend = Gain.Eigen3Backend(); var gain = Gain.HoloSDP(focuses, amps, backend); autd.Send(gain, mod); Gain.DeleteBackend(backend); }
protected override void EnableProperties() { Octaves.IsVisibleWhen(FractalType, f => f.CurrentValue != PropertiesFractalType.None); Lacunarity.IsVisibleWhen(FractalType, f => f.CurrentValue != PropertiesFractalType.None); Gain.IsVisibleWhen(FractalType, f => f.CurrentValue != PropertiesFractalType.None); WeightedStrength.IsVisibleWhen(FractalType, f => f.CurrentValue != PropertiesFractalType.None); PingPongStrength.IsVisibleWhen(FractalType, f => f.CurrentValue == PropertiesFractalType.PingPong); }
public void SetTimingAndGain(IntegrationTimeMs timing, Gain gain) { Enable(); Write((Register)((byte)Register.Timing | (byte)Command.Command), (byte)((byte)timing | (byte)gain)); IntegrationTime = timing; SensorGain = gain; Disable(); }
public INoise GetLandFormFct() { INoise AnomaliesZonesFractal = new FractalFbm(new Perlin(_seed), _octaves, _frequency, enuBaseNoiseRange.ZeroToOne); INoise AnomaliesZonesFractal_as2DNoise = new NoiseAccess(AnomaliesZonesFractal, NoiseAccess.enuDimUsage.Noise2D, true); INoise AnomaliesZonesFractal_Bias = new Gain(AnomaliesZonesFractal_as2DNoise, _bias); return(AnomaliesZonesFractal_Bias); }
/// <summary> /// Initialize a new HMC5883L device connected through I2C /// </summary> /// <param name="sensor">I2C Device, like UnixI2cDevice or Windows10I2cDevice</param> /// <param name="gain">Gain Setting</param> /// <param name="measuringMode">The Mode of Measuring</param> /// <param name="outputRate">Typical Data Output Rate (Hz)</param> public Hmc5883l(I2cDevice sensor, Gain gain = Gain.Gain1090, MeasuringMode measuringMode = MeasuringMode.Continuous, OutputRate outputRate = OutputRate.Rate15) { _sensor = sensor; _gain = (byte)gain; _measuringMode = (byte)measuringMode; _outputRate = (byte)outputRate; Initialize(); }
void Start() { trans = GetComponent <Transform>(); Player = trans.Find("Camera (eye)"); physicsPlayer = GetComponent <VRRigidbodyPlayer>(); playArea = GetComponent <SteamVR_PlayArea>(); gains = new Gain(); lastPlayerPos = Player.localPosition; }
public override double GetValue(double x, double y, double z) { double lacunarity = Lacunarity.GetValue(x, y, z); double gain = Gain.GetValue(x, y, z); double offset = Offset.GetValue(x, y, z); double frequency = Frequency.GetValue(x, y, z); x *= frequency; y *= frequency; z *= frequency; int mOctaveCount = (int)OctaveCount.GetValue(x, y, z); double signal = 0.0; double value = 0.0; double weight = 1.0; for (int currentOctave = 0; currentOctave < mOctaveCount; currentOctave++) { long seed = (Seed + currentOctave) & 0x7fffffff; signal = GradientNoise.GradientCoherentNoise(x, y, z, (int)seed, NoiseQuality); // Make the ridges. signal = System.Math.Abs(signal); signal = offset - signal; // Square the signal to increase the sharpness of the ridges. signal *= signal; // The weighting from the previous octave is applied to the signal. // Larger values have higher weights, producing sharp points along the // ridges. signal *= weight; // Weight successive contributions by the previous signal. weight = signal * gain; if (weight > 1.0) { weight = 1.0; } else if (weight < 0.0) { weight = 0.0; } // Add the signal to the output value. value += (signal * SpectralWeights[currentOctave]); // Go to the next octave. x *= lacunarity; y *= lacunarity; z *= lacunarity; } return((value * 1.25) - 1.0); }
/// <summary> /// Constructs a new Midi Processor. /// </summary> /// <param name="plugin">Must not be null.</param> public MidiProcessor(Plugin plugin) { _plugin = plugin; Gain = new Gain(plugin); Transpose = new Transpose(plugin); // for most hosts, midi output is expected during the audio processing cycle. SyncWithAudioProcessor = true; }
public override int GetHashCode() { unchecked { int hashCode = Power.GetHashCode(); hashCode = (hashCode * 397) ^ Gain.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { int result = 7057; result = result * 8171 + (Sound != null ? (int)Sound.Index.Value : 0); result = result * 8171 + Gain.GetHashCode(); result = result * 8171 + Flags; return(result); }
public override int GetHashCode() { int result = 7057; result = result * 8171 + (int)OriginalSound.Value; result = result * 8171 + Gain.GetHashCode(); result = result * 8171 + Flags; return(result); }
public void CreateFeedEntryTest() { string xml = "<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:gf='http://schemas.google.com/finance/2007' xmlns:gd='http://schemas.google.com/g/2005'><id>http://finance.google.com/finance/feeds/[email protected]/portfolios</id><updated>2009-06-27T05:40:34.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/finance/2007#portfolio'/><title type='text'>Portfolio Feed</title><link rel='alternate' type='text/html' href='http://finance.google.com/finance/portfolio?action=view'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios'/><link rel='http://schemas.google.com/g/2005#post' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios'/><link rel='self' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios?positions=true&returns=true'/><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>1</openSearch:itemsPerPage><entry><id>http://finance.google.com/finance/feeds/[email protected]/portfolios/1</id><updated>2009-06-27T05:40:34.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/finance/2007#portfolio'/><title type='text'>My Portfolio</title><link rel='self' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/1'/><link rel='edit' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/1'/><gd:feedLink href='http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions'><feed><id>http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions</id><updated>2009-06-27T05:40:34.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/finance/2007#position'/><title type='text'>My Portfolio</title><link rel='alternate' type='text/html' href='http://finance.google.com/finance/portfolio?action=view&pid=1'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios'/><openSearch:totalResults>9</openSearch:totalResults><openSearch:itemsPerPage>9</openSearch:itemsPerPage><entry><id>http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions/NASDAQ:MSFT</id><updated>2009-06-27T05:40:34.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/finance/2007#position'/><title type='text'>Microsoft Corporation</title><link rel='self' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/NASDAQ%3AMSFT'/><link rel='edit' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/NASDAQ%3AMSFT'/><gd:feedLink href='http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions/NASDAQ:MSFT/transactions'/><gf:positionData gainPercentage='20.82242991' return1w='0.0' return1y='0.0' return3m='0.0' return3y='0.0' return4w='0.0' return5y='0.0' returnOverall='0.0' returnYTD='0.0' shares='1000.0'><gf:costBasis><gd:money amount='1070.0' currencyCode='USD'/></gf:costBasis><gf:daysGain><gd:money amount='-440.001' currencyCode='USD'/></gf:daysGain><gf:gain><gd:money amount='22280.0' currencyCode='USD'/></gf:gain><gf:marketValue><gd:money amount='23350.0' currencyCode='USD'/></gf:marketValue></gf:positionData><gf:symbol exchange='NASDAQ' fullName='Microsoft Corporation' symbol='MSFT'/></entry><entry><id>http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions/NASDAQ:AAPL</id><updated>2009-06-27T05:40:34.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/finance/2007#position'/><title type='text'>Apple Inc.</title><link rel='self' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/NASDAQ%3AAAPL'/><link rel='edit' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/NASDAQ%3AAAPL'/><gd:feedLink href='http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions/NASDAQ:AAPL/transactions'/><gf:positionData gainPercentage='355.1' return1w='0.02122168053' return1y='355.1' return3m='355.1' return3y='355.1' return4w='355.1' return5y='355.1' returnOverall='355.1' returnYTD='355.1' shares='100.0'><gf:costBasis><gd:money amount='40.0' currencyCode='USD'/></gf:costBasis><gf:daysGain><gd:money amount='258.0002' currencyCode='USD'/></gf:daysGain><gf:gain><gd:money amount='14204.0' currencyCode='USD'/></gf:gain><gf:marketValue><gd:money amount='14244.0' currencyCode='USD'/></gf:marketValue></gf:positionData><gf:symbol exchange='NASDAQ' fullName='Apple Inc.' symbol='AAPL'/></entry><entry><id>http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions/NASDAQ:ACAS</id><updated>2009-06-27T05:40:34.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/finance/2007#position'/><title type='text'>American Capital Ltd.</title><link rel='self' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/NASDAQ%3AACAS'/><link rel='edit' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/NASDAQ%3AACAS'/><gd:feedLink href='http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions/NASDAQ:ACAS/transactions'/><gf:positionData gainPercentage='0.1045296167' return1w='0.0' return1y='0.0' return3m='0.0' return3y='0.0' return4w='0.0' return5y='0.0' returnOverall='0.0' returnYTD='0.0' shares='10000.0'><gf:costBasis><gd:money amount='28700.0' currencyCode='USD'/></gf:costBasis><gf:daysGain><gd:money amount='4500.0' currencyCode='USD'/></gf:daysGain><gf:gain><gd:money amount='3000.0' currencyCode='USD'/></gf:gain><gf:marketValue><gd:money amount='31700.0' currencyCode='USD'/></gf:marketValue></gf:positionData><gf:symbol exchange='NASDAQ' fullName='American Capital Ltd.' symbol='ACAS'/></entry><entry><id>http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions/NYSE:ING</id><updated>2009-06-27T05:40:34.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/finance/2007#position'/><title type='text'>ING Groep N.V. (ADR)</title><link rel='self' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/NYSE%3AING'/><link rel='edit' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/NYSE%3AING'/><gd:feedLink href='http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions/NYSE:ING/transactions'/><gf:positionData gainPercentage='0.05503634476' return1w='0.0' return1y='0.0' return3m='0.0' return3y='0.0' return4w='0.0' return5y='0.0' returnOverall='0.0' returnYTD='0.0' shares='124.0'><gf:costBasis><gd:money amount='1194.12' currencyCode='USD'/></gf:costBasis><gf:daysGain><gd:money amount='-2.48' currencyCode='USD'/></gf:daysGain><gf:gain><gd:money amount='65.72' currencyCode='USD'/></gf:gain><gf:marketValue><gd:money amount='1259.84' currencyCode='USD'/></gf:marketValue></gf:positionData><gf:symbol exchange='NYSE' fullName='ING Groep N.V. (ADR)' symbol='ING'/></entry><entry><id>http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions/NASDAQ:FORTY</id><updated>2009-06-27T05:40:34.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/finance/2007#position'/><title type='text'>Formula Systems (1985) Ltd. (ADR)</title><link rel='self' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/NASDAQ%3AFORTY'/><link rel='edit' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/NASDAQ%3AFORTY'/><gd:feedLink href='http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions/NASDAQ:FORTY/transactions'/><gf:positionData gainPercentage='0.03818953324' return1w='0.0' return1y='0.0' return3m='0.0' return3y='0.0' return4w='0.0' return5y='0.0' returnOverall='0.0' returnYTD='0.0' shares='130.0'><gf:costBasis><gd:money amount='919.1' currencyCode='USD'/></gf:costBasis><gf:daysGain><gd:money amount='17.55' currencyCode='USD'/></gf:daysGain><gf:gain><gd:money amount='35.1' currencyCode='USD'/></gf:gain><gf:marketValue><gd:money amount='954.2' currencyCode='USD'/></gf:marketValue></gf:positionData><gf:symbol exchange='NASDAQ' fullName='Formula Systems (1985) Ltd. (ADR)' symbol='FORTY'/></entry><entry><id>http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions/NYSE:DT</id><updated>2009-06-27T05:40:34.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/finance/2007#position'/><title type='text'>Deutsche Telekom AG (ADR)</title><link rel='self' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/NYSE%3ADT'/><link rel='edit' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/NYSE%3ADT'/><gd:feedLink href='http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions/NYSE:DT/transactions'/><gf:positionData gainPercentage='0.01224846894' return1w='0.0' return1y='0.0' return3m='0.0' return3y='0.0' return4w='0.0' return5y='0.0' returnOverall='0.0' returnYTD='0.0' shares='242.0'><gf:costBasis><gd:money amount='2766.06' currencyCode='USD'/></gf:costBasis><gf:daysGain><gd:money amount='14.519758' currencyCode='USD'/></gf:daysGain><gf:gain><gd:money amount='33.88' currencyCode='USD'/></gf:gain><gf:marketValue><gd:money amount='2799.94' currencyCode='USD'/></gf:marketValue></gf:positionData><gf:symbol exchange='NYSE' fullName='Deutsche Telekom AG (ADR)' symbol='DT'/></entry><entry><id>http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions/NYSE:CHN</id><updated>2009-06-27T05:40:34.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/finance/2007#position'/><title type='text'>China Fund Inc. (The)</title><link rel='self' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/NYSE%3ACHN'/><link rel='edit' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/NYSE%3ACHN'/><gd:feedLink href='http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions/NYSE:CHN/transactions'/><gf:positionData gainPercentage='0.03348104382' return1w='0.0' return1y='0.0' return3m='0.0' return3y='0.0' return4w='0.0' return5y='0.0' returnOverall='0.0' returnYTD='0.0' shares='244.0'><gf:costBasis><gd:money amount='4955.64' currencyCode='USD'/></gf:costBasis><gf:daysGain><gd:money amount='7.320244' currencyCode='USD'/></gf:daysGain><gf:gain><gd:money amount='165.92' currencyCode='USD'/></gf:gain><gf:marketValue><gd:money amount='5121.56' currencyCode='USD'/></gf:marketValue></gf:positionData><gf:symbol exchange='NYSE' fullName='China Fund Inc. (The)' symbol='CHN'/></entry><entry><id>http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions/NYSE:FTE</id><updated>2009-06-27T05:40:34.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/finance/2007#position'/><title type='text'>France Telecom SA (ADR)</title><link rel='self' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/NYSE%3AFTE'/><link rel='edit' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/NYSE%3AFTE'/><gd:feedLink href='http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions/NYSE:FTE/transactions'/><gf:positionData gainPercentage='0.02424786709' return1w='0.0' return1y='0.0' return3m='0.0' return3y='0.0' return4w='0.0' return5y='0.0' returnOverall='0.0' returnYTD='0.0' shares='420.0'><gf:costBasis><gd:money amount='9353.4' currencyCode='USD'/></gf:costBasis><gf:daysGain><gd:money amount='-42.0' currencyCode='USD'/></gf:daysGain><gf:gain><gd:money amount='226.8' currencyCode='USD'/></gf:gain><gf:marketValue><gd:money amount='9580.2' currencyCode='USD'/></gf:marketValue></gf:positionData><gf:symbol exchange='NYSE' fullName='France Telecom SA (ADR)' symbol='FTE'/></entry><entry><id>http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions/NYSE:GNK</id><updated>2009-06-27T05:40:34.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/finance/2007#position'/><title type='text'>Genco Shipping & Trading Limited</title><link rel='self' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/NYSE%3AGNK'/><link rel='edit' type='application/atom+xml' href='http://finance.google.com/finance/feeds/default/portfolios/NYSE%3AGNK'/><gd:feedLink href='http://finance.google.com/finance/feeds/[email protected]/portfolios/1/positions/NYSE:GNK/transactions'/><gf:positionData gainPercentage='0.1024649589' return1w='0.0' return1y='0.0' return3m='0.0' return3y='0.0' return4w='0.0' return5y='0.0' returnOverall='0.0' returnYTD='0.0' shares='10.0'><gf:costBasis><gd:money amount='206.9' currencyCode='USD'/></gf:costBasis><gf:daysGain><gd:money amount='14.69999' currencyCode='USD'/></gf:daysGain><gf:gain><gd:money amount='21.2' currencyCode='USD'/></gf:gain><gf:marketValue><gd:money amount='228.1' currencyCode='USD'/></gf:marketValue></gf:positionData><gf:symbol exchange='NYSE' fullName='Genco Shipping & Trading Limited' symbol='GNK'/></entry></feed></gd:feedLink><gf:portfolioData currencyCode='USD' gainPercentage='0.8135848188' return1w='0.02122168053' return1y='355.1' return3m='355.1' return3y='355.1' return4w='355.1' return5y='355.1' returnOverall='355.1' returnYTD='355.1'><gf:costBasis><gd:money amount='49205.22' currencyCode='USD'/></gf:costBasis><gf:daysGain><gd:money amount='4327.609192' currencyCode='USD'/></gf:daysGain><gf:gain><gd:money amount='40032.62' currencyCode='USD'/></gf:gain><gf:marketValue><gd:money amount='140032.62' currencyCode='USD'/></gf:marketValue></gf:portfolioData></entry></feed>"; PortfolioFeed target = Parse(xml); for (int i = 0; i < target.Entries.Count; i++) { PortfolioEntry portfolioEntry = target.Entries[i] as PortfolioEntry; Console.WriteLine("Title: " + portfolioEntry.Title.Text); Console.WriteLine("FeedLink: " + portfolioEntry.FeedLink.ToString()); Console.WriteLine("CurrencyCode: " + portfolioEntry.CurrencyCode); Console.WriteLine("GainPercentage: " + portfolioEntry.GainPercentage.ToString("0.00000000%")); Console.WriteLine("Return1Week: " + portfolioEntry.Return1Week.ToString("0.00000000%")); Console.WriteLine("Return4Week: " + portfolioEntry.Return4Week.ToString("0.00000000%")); Console.WriteLine("Return3Month: " + portfolioEntry.Return3Month.ToString("0.00000000%")); Console.WriteLine("ReturnYTD: " + portfolioEntry.ReturnYTD.ToString("0.00000000%")); Console.WriteLine("Return1Year: " + portfolioEntry.Return1Year.ToString("0.00000000%")); Console.WriteLine("Return3Year: " + portfolioEntry.Return3Year.ToString("0.00000000%")); Console.WriteLine("Return5Year: " + portfolioEntry.Return5Year.ToString("0.00000000%")); Console.WriteLine("ReturnOverall: " + portfolioEntry.ReturnOverall.ToString("0.00000000%")); CostBasis costBasis = portfolioEntry.CostBasis; foreach (Money m in costBasis.Money) { Console.WriteLine("Money: Amount = " + m.Amount as string); Console.WriteLine("Money: CurrencyCode = " + m.CurrencyCode); } DaysGain daysGain = portfolioEntry.DaysGain; foreach (Money m in daysGain.Money) { Console.WriteLine("Money: Amount = " + m.Amount as string); Console.WriteLine("Money: CurrencyCode = " + m.CurrencyCode); } Gain gain = portfolioEntry.Gain; foreach (Money m in gain.Money) { Console.WriteLine("Money: Amount = " + m.Amount as string); Console.WriteLine("Money: CurrencyCode = " + m.CurrencyCode); } MarketValue marketValue = portfolioEntry.MarketValue; foreach (Money m in marketValue.Money) { Console.WriteLine("Money: Amount = " + m.Amount as string); Console.WriteLine("Money: CurrencyCode = " + m.CurrencyCode); } } }
/// <summary> /// Constructs a new Midi Processor. /// </summary> /// <param name="plugin">Must not be null.</param> public MidiProcessor(IVstPluginEvents pluginEvents, PluginParameters parameters) { Gain = new Gain(parameters.GainParameters); Transpose = new Transpose(parameters.TransposeParameters); // for most hosts, midi output is expected during the audio processing cycle. SyncWithAudioProcessor = true; pluginEvents.Opened += Plugin_Opened; }
public async Task Configure(Gain gain, IntegrationTime time) { await ConnectAndInitialize(); _gain = (int)gain; WriteRegister(Registers.Command | Registers.Oscillator, gain.ToByte()); _integrationTime = (int)time; WriteRegister(Registers.Command | Registers.Oscillator, time.ToByte()); }
public void GainResourceGroup(Gain gain) { foreach (var pair in gain.GainDic) { if (BattleRsourceDic.ContainsKey(pair.Key)) { BattleRsourceDic[pair.Key].GainResource(pair.Value); } } }
private async void setGain(Gain gain) { if (!initialized) { await begin(); } this.gain = gain; byte[] WriteBuffer = new byte[] { TCS34725Params.CONTROL | TCS34725Params.COMMAND_BIT, (byte)gain }; colorSensor.Write(WriteBuffer); }
public Luminosity GetLuminosity(Gain gain = Gain.Low, IntegrationTime time = IntegrationTime.MS100) { var luminosity = this.GetFullLuminosity(gain, time); var lux = CalculateLux(luminosity[0], luminosity[1], gain, time); return(new Luminosity() { Visible = luminosity[0], IR = luminosity[1], Lux = lux, Gain = gain }); }
/// <summary> /// Computes activation function and its derivative /// </summary> /// <param name="n">int</param> /// <param name="net">double - net</param> /// <param name="acct">VectorHorizontal - activation matrix</param> /// <param name="gain">VectorHorizontal - gain matrix</param> /// <returns>FunctionRD - function result</returns> /// <remarks>Remember that values are passed by ref to speed up</remarks> public static FunctionRD computeFunctionDervative(ref int n, ref double net, ref Activation acct, ref Gain gain) { FunctionChoice function = (FunctionChoice)(int)acct.Data[0][n]; FunctionRD rd = new FunctionRD(); switch (function) { case FunctionChoice.LinearNeuron://for output layer { rd.FunctionResult = gain.Data[0][n] * net; rd.FunctionDerivative = gain.Data[0][n]; }break; case FunctionChoice.UnipolarNeuron: { rd.FunctionResult = 1 / (1 + System.Math.Exp(-gain.Data[0][n] * net)); rd.FunctionDerivative = gain.Data[0][n] * (1 - rd.FunctionResult) * rd.FunctionResult; }break; case FunctionChoice.BipolarNeuron://for hidden layer { rd.FunctionResult = System.Math.Tanh(gain.Data[0][n] * net); rd.FunctionDerivative = gain.Data[0][n] * (1 - System.Math.Pow(rd.FunctionResult,2)); }break; case FunctionChoice.BipolarElliotNeuron: { rd.FunctionResult = gain.Data[0][n] * net / (1 + gain.Data[0][n] * System.Math.Abs(net)); rd.FunctionDerivative = 1 / System.Math.Pow((gain.Data[0][n] * System.Math.Abs(net) + 1), 2); }break; case FunctionChoice.UnipolarElliotNeuron: { rd.FunctionResult = 2 * gain.Data[0][n] * net / (1 + gain.Data[0][n] * System.Math.Abs(net)) - 1; rd.FunctionDerivative = 2 * gain.Data[0][n] / System.Math.Pow((gain.Data[0][n] * System.Math.Abs(net) + 1), 2); }break; default: { throw new NeuralNetworkError(Properties.Settings.Default.FE1); } } return rd; }
/// <summary> /// Compute psudo hessian matrix and its gradient /// </summary> /// <param name="info">NetworkInfo - information about neural network</param> /// <param name="inp">Input - input data patterns used for learn</param> /// <param name="dout">Output - output data patterns used for learn</param> /// <param name="topo">Topography - neural network topography</param> /// <param name="ww">Weights - weights</param> /// <param name="act">Activation - activation function selection</param> /// <param name="gain">Gain - neuron gain</param> /// <param name="iw">Index - topography indexes</param> public void Compute(ref NetworkInfo info, ref Input inp, ref Output dout, ref Topography topo, Weights ww, ref Activation act, ref Gain gain, ref Index iw) { GradientMat = MatrixMB.Zeros(info.nw, 1); HessianMat = MatrixMB.Zeros(info.nw, info.nw); np = info.np;//number of patterns ni = info.ni;//number of inputs no = info.no;//number of outputs nw = info.nw;//number of weights nn = info.nn;//number of neurons nio = nn + ni - no; zeros = ni.Zeros(); delo = MatrixMB.Zeros(1, nio + 1); J = MatrixMB.Zeros(1, nw); for (p = 0; p < np; p++) { node.Clear(); node.AddRange(inp.Data[p]); CalculateFunctionValuesAndDerivates(ref ww, ref iw, ref topo, ref act, ref gain); for (k = 0; k < no; k++) { o = nio + k; error = dout.Data[p][k] - node[o]; J.ClearWithZeros(); s = iw.Pos(o - ni); J.Data[0][s] = -derivates[o]; delo.ClearWithZeros(); CalculateJacobian(ref ww, ref iw, ref topo); CalculateForHiddenLayer(ref iw, ref topo, ref ww); if (dout[p, 0] > 0.5) J = J * ratio; var JT = J.Transposed; GradientMat = GradientMat + JT * error; HessianMat = HessianMat + JT * J; } } }
/// <summary> /// Computes activation function /// </summary> /// <param name="n">int</param> /// <param name="net">double - net</param> /// <param name="acct">VectorHorizontal - activation matrix</param> /// <param name="gain">VectorHorizontal - gain matrix</param> /// <returns>double - function result</returns> /// <remarks>Remember that values are passed by ref to speed up</remarks> public static double computeFunction(ref int n,ref double net, ref Activation acct, ref Gain gain) { try { FunctionChoice function = (FunctionChoice)(int)acct.Data[0][n]; switch (function) { case FunctionChoice.LinearNeuron: { return gain.Data[0][n] * net; } case FunctionChoice.UnipolarNeuron: { return 1 / (1 + System.Math.Exp(-gain.Data[0][n] * net)); } case FunctionChoice.BipolarNeuron: { return System.Math.Tanh(gain.Data[0][n] * net); } case FunctionChoice.BipolarElliotNeuron: { return gain.Data[0][n] * net / (1 + gain.Data[0][n] * System.Math.Abs(net)); } case FunctionChoice.UnipolarElliotNeuron: { return 2 * gain.Data[0][n] * net / (1 + gain.Data[0][n] * System.Math.Abs(net)) - 1; } default: { throw new System.Exception(Properties.Settings.Default.FE1); } } } catch (System.Exception ex) { throw new NeuralNetworkError("Błąd obliczania funkcji aktywacji.", ex); } }
/// <summary> /// Total error calculation /// </summary> /// <param name="info">NetworkInfo</param> /// <param name="inp">ref Input - input data patterns</param> /// <param name="dout">ref Output - output data</param> /// <param name="topo">ref Topography - topo is network topology in the form of one vector</param> /// <param name="ww">ref Weights weights</param> /// <param name="act">ref Activation - type of activation function</param> /// <param name="gain">ref Gain - strengthening the activation function</param> /// <param name="iw">ref WeightsPointers - index pointers used for network topology stored in top in the form of one vector</param> /// <remarks>Network error will be overriden so please save it</remarks> public double CalculateError(ref NetworkInfo info, ref Input inp, ref Output dout, ref Topography topo, Weights ww, ref Activation act, ref Gain gain, ref Index iw) { try { Error = 0; for (p = 0; p < info.np; p++) { node.Clear(); node.AddRange(inp.Data[p]); for (n = 0; n < info.nn; n++) { net = ww[iw.Pos(n)]; int from = iw.Pos(n) + 1; int to = iw.Pos(n + 1) - 1; for (i = from; i <= to; i++) { net += node[(int)topo[i]] * ww[i]; } node.Add(ActivationFunction.computeFunction(ref n, ref net, ref act, ref gain)); } for (k = 0; k < info.no; k++) { Error += System.Math.Pow((dout.Data[p][k] - node[info.nio + k]), 2); } } return Error; } catch (System.Exception ex) { throw new NeuralNetworkError("Błąd uaktualnienia błędu sieci neuronowej. " + ex.Message, ex); } }
private bool m_CameraChangingHeight; // is camera height changing? void Start() { if (!Terrain1 || !Terrain2) { Debug.LogError("Terrains not set!!"); enabled = false; } // desert dune-like ridges are created using RidgeNoise. it is scaled down a bit, and Gain applied to make ridges more pronounced var desert = new Gain( new RidgeNoise(23478568) { OctaveCount = 8 } * 0.6f, 0.4f); // hills use a simple pink noise. var hills = new PinkNoise(3465478) { OctaveCount = 5, // smooth hills (no higher frequencies) Persistence = 0.56f // but steep (changes rapidly in the frequencies we do have) }; // weight decides, whether a given point is hills or desert // cached, as we'd need it to decide texture at every point m_Weight = new Cache(new PinkNoise(346546) { Frequency = 0.5f, OctaveCount = 3 }.ScaleShift(0.5f, 0.5f)); // overall heightmap blends hills and deserts m_Generator = desert.Blend(hills, m_Weight).ScaleShift(0.5f, 0.5f); // as changes to terrains made in playmode get saved in the editor, we need to re-generate terrains // at start. The coroutine will set m_Move in the end, so that camera does not fly intil it's ready #if UNITY_EDITOR StartCoroutine(CreateMapsAtStart()); #else m_NoiseCoord=1; m_Move=true; #endif }
private void RumasterSetCarrierConfig(string cpriport, string flowdirection, string carriernumber, string enabled, string carrierid, string technology, string frequency, string axccontainer, string gain, string fsinfo,string axcContainerGroupLength,string bfPeriod,string syncmode) { try { FsInfo fsinfoData = new FsInfo(); string[] fsinfostr = fsinfo.Split(SPACER_FLAG_SEC); if (fsinfostr.Length >= 4) { fsinfoData.Addr = byte.Parse(fsinfostr[0]); fsinfoData.Hf = byte.Parse(fsinfostr[1]); fsinfoData.Bf = byte.Parse(fsinfostr[2]); fsinfoData.BfOffset = byte.Parse(fsinfostr[3]); } Gain gainData = new Gain(); string[] gainstr = gain.Split(SPACER_FLAG_SEC); if (fsinfostr.Length >= 3) { gainData.GainEnable = boolDic[gainstr[0]]; gainData.GainDb = double.Parse(gainstr[1]); gainData.GainFact = double.Parse(gainstr[2]); } CarrierData data = new CarrierData(); data.axcContainerGroupLength = byte.Parse(axcContainerGroupLength); data.bfPeriod = byte.Parse(bfPeriod); data.carrierId = byte.Parse(carrierid); data.carrierNumber = byte.Parse(carriernumber); data.enabled = boolDic[enabled]; data.sampleFrequency = freqDic[frequency]; data.technology = technologyDic[technology]; data.startAxcContainer = byte.Parse(axccontainer); data.syncMode = syncModeDic[syncmode]; data.fsInfo = fsinfoData; data.gain = gainData; rCarrierConfig.SetCarrierConfig(cpriport, flowDirectionDic[flowdirection], data); showCarrierData(data); } catch (Exception e) { WriteTraceText("Rumaster Set Carrier Config failed!--" + e.Message); } }
/// <summary> /// Sets the sensor gain value. /// </summary> /// <param name="gain">Gain value.</param> public void SetGain(Gain gain) { Write(Register.CRB, (byte)gain); }
public ADS1015(Gain refVoltage = Gain.Volt33) { this.gain = refVoltage; }
public static extern void SetGain(IntPtr config, Gain gain);
/// <summary> /// Puts the sensor into initial state. /// </summary> /// <param name="gainLevel">Gain level configuration.</param> public void Init(Gain gainLevel = Gain.Level6) { bus.Write(0x01, (byte)((byte)gainLevel << 5)); }
private void CalculateFunctionValuesAndDerivates(ref Weights ww, ref Index iw, ref Topography topo, ref Activation act, ref Gain gain) { derivates.Clear(); derivates.AddRange(node.Count.Zeros()); for (int n = 0; n < nn; n++)//for each neuron in network { net = ww[iw[n]];//calculate net sum for (i = iw[n] + 1; i <= iw[n + 1] - 1; i++) { net += (node[topo[i]] * ww[i]); } var res = ActivationFunction.computeFunctionDervative(ref n, ref net, ref act, ref gain);//and function value and its derivative node.Add(res.FunctionResult);//save function value for output signal from neuron derivates.Add(res.FunctionDerivative);//save function derivative value for output signal from neuron } }