def test_encode_decode(): num_bins = 33 num_beams = 4 ens = Ensemble() ens_ds = EnsembleData() ens_ds.EnsembleNumber = 2668 ens_ds.NumBins = 33 ens_ds.NumBeams = 4 ens_ds.DesiredPingCount = 45 ens_ds.ActualPingCount = 46 ens_ds.SerialNumber = "01H00000000000000000000000999999" ens_ds.SysFirmwareMajor = 2 ens_ds.SysFirmwareMinor = 11 ens_ds.SysFirmwareRevision = 5 ens_ds.SysFirmwareSubsystemCode = "A" ens_ds.SubsystemConfig = 3 ens_ds.Status = 9 ens_ds.Year = 2019 ens_ds.Month = 3 ens_ds.Day = 9 ens_ds.Hour = 12 ens_ds.Minute = 23 ens_ds.Second = 24 ens_ds.HSec = 33 anc = AncillaryData() anc.FirstBinRange = 1.0 # Blank. Depth to the first bin in meters. anc.BinSize = 3.0 # Size of a bin in meters. anc.FirstPingTime = 1.2 # First Ping Time in seconds. anc.LastPingTime = 2.3 # Last Ping Time in seconds. (If averaging pings, this will be the last ping) anc.Heading = 23.5 # Heading in degrees. anc.Pitch = 13.6 # Pitch in degrees. anc.Roll = 11.25 # Roll in degrees. anc.WaterTemp = 25.3 # Water Temperature in fahrenheit anc.SystemTemp = 54.6 # System Temperature in fahrenheit anc.Salinity = 35.0 # Water Salinity set by the user in PPT anc.Pressure = 23.78 # Pressure from pressure sensor in Pascals anc.TransducerDepth = 45.69 # Transducer Depth, used by Pressure sensor in meters anc.SpeedOfSound = 1400.23 # Speed of Sound in m/s. anc.RawMagFieldStrength = 3.0 # Raw magnetic field strength anc.PitchGravityVector = 4.0 # Pitch Gravity Vector anc.RollGravityVector = 5.0 # Roll Gravity Vector anc.VerticalGravityVector = 6.0 # Vertical Gravity Vector amp = Amplitude(num_bins, num_beams) corr = Correlation(num_bins, num_beams) beam_vel = BeamVelocity(num_bins, num_beams) inst_vel = InstrumentVelocity(num_bins, num_beams) earth_vel = EarthVelocity(num_bins, num_beams) gb = GoodBeam(num_bins, num_beams) ge = GoodEarth(num_bins, num_beams) val = 1.0 for beam in range(amp.element_multiplier): for bin_num in range(amp.num_elements): amp.Amplitude[bin_num][beam] = val corr.Correlation[bin_num][beam] = val beam_vel.Velocities[bin_num][beam] = val inst_vel.Velocities[bin_num][beam] = val earth_vel.Velocities[bin_num][beam] = val gb.GoodBeam[bin_num][beam] = 1 * int(beam) ge.GoodEarth[bin_num][beam] = 1 * int(beam) val += 1.1 bt = BottomTrack() bt.FirstPingTime = 12.5 bt.LastPingTime = 12.8 bt.Heading = 152.36 bt.Pitch = 12.6 bt.Roll = 223.1 bt.WaterTemp = 15.23 bt.SystemTemp = 78.58 bt.Salinity = 35.0 bt.Pressure = 23.36 bt.TransducerDepth = 156.2 bt.SpeedOfSound = 1402.36 bt.Status = 9.0 bt.NumBeams = 4.0 bt.ActualPingCount = 23 bt.Range = [1.1, 2.2, 3.3, 4.4] bt.SNR = [1.1, 2.2, 3.3, 4.4] bt.Amplitude = [1.1, 2.2, 3.3, 4.4] bt.Correlation = [1.1, 2.2, 3.3, 4.4] bt.BeamVelocity = [1.1, 2.2, 3.3, 4.4] bt.BeamGood = [1, 2, 3, 4] bt.InstrumentVelocity = [1.1, 2.2, 3.3, 4.4] bt.InstrumentGood = [1, 2, 3, 4] bt.EarthVelocity = [1.1, 2.2, 3.3, 4.4] bt.EarthGood = [1, 2, 3, 4] bt.SNR_PulseCoherent = [1, 2, 3, 4] bt.Amp_PulseCoherent = [1, 2, 3, 4] bt.Vel_PulseCoherent = [1, 2, 3, 4] bt.Noise_PulseCoherent = [1, 2, 3, 4] bt.Corr_PulseCoherent = [1, 2, 3, 4] rt = RangeTracking() rt.NumBeams = 4.0 rt.Range = [1.1, 2.2, 3.3, 4.4] rt.Pings = [1, 2, 3, 4] rt.SNR = [1.1, 2.2, 3.3, 4.4] rt.Amplitude = [1.1, 2.2, 3.3, 4.4] rt.Correlation = [1.1, 2.2, 3.3, 4.4] rt.BeamVelocity = [1.1, 2.2, 3.3, 4.4] rt.InstrumentVelocity = [1.1, 2.2, 3.3, 4.4] rt.EarthVelocity = [1.1, 2.2, 3.3, 4.4] nmea = NmeaData() nmea.add_nmea("$HEHDT,244.39,T*17\n") nmea.add_nmea( "$GPGGA,195949.00,3254.8103248,N,11655.5779629,W,2,08,1.1,222.174,M,-32.602,M,6.0,0138*75\n" ) nmea.add_nmea("$GPVTG,306.20,T,294.73,M,0.13,N,0.24,K,D*2E\n") nmea.add_nmea("$HEHDT,244.36,T*18\n") ss = SystemSetup() ss.BtSamplesPerSecond = 1.0 ss.BtSystemFreqHz = 3.0 ss.BtCPCE = 1.2 ss.BtNCE = 2.3 ss.BtRepeatN = 23.5 ss.WpSamplesPerSecond = 13.6 ss.WpSystemFreqHz = 11.25 ss.WpCPCE = 25.3 ss.WpNCE = 54.6 ss.WpRepeatN = 35.0 ss.WpLagSamples = 23.78 ss.Voltage = 45.69 ss.XmtVoltage = 1400.23 ss.BtBroadband = 3.0 ss.BtLagLength = 4.0 ss.BtNarrowband = 5.0 ss.BtBeamMux = 6.0 ss.WpBroadband = 6.0 ss.WpLagLength = 6.0 ss.WpTransmitBandwidth = 6.0 ss.WpReceiveBandwidth = 6.0 ens.AddAmplitude(amp) ens.AddCorrelation(corr) ens.AddBeamVelocity(beam_vel) ens.AddInstrumentVelocity(inst_vel) ens.AddEarthVelocity(earth_vel) ens.AddGoodBeam(gb) ens.AddGoodEarth(ge) ens.AddAncillaryData(anc) ens.AddEnsembleData(ens_ds) ens.AddBottomTrack(bt) ens.AddRangeTracking(rt) ens.AddSystemSetup(ss) ens.AddNmeaData(nmea) # Encode the ensemble to binar binary_ens = ens.encode() # Use the codec to decode the data ens1 = BinaryCodec.decode_data_sets(binary_ens[:-4]) # Remove the checksum assert ens.EnsembleData.EnsembleNumber == ens1.EnsembleData.EnsembleNumber assert ens.EnsembleData.NumBins == ens1.EnsembleData.NumBins assert ens.EnsembleData.NumBeams == ens1.EnsembleData.NumBeams assert ens.EnsembleData.DesiredPingCount == ens1.EnsembleData.DesiredPingCount assert ens.EnsembleData.ActualPingCount == ens1.EnsembleData.ActualPingCount assert ens.EnsembleData.SerialNumber == ens1.EnsembleData.SerialNumber assert ens.EnsembleData.SysFirmwareMajor == ens1.EnsembleData.SysFirmwareMajor assert ens.EnsembleData.SysFirmwareMinor == ens1.EnsembleData.SysFirmwareMinor assert ens.EnsembleData.SysFirmwareRevision == ens1.EnsembleData.SysFirmwareRevision assert ens.EnsembleData.SysFirmwareSubsystemCode == ens1.EnsembleData.SysFirmwareSubsystemCode assert ens.EnsembleData.SubsystemConfig == ens1.EnsembleData.SubsystemConfig assert ens.EnsembleData.Status == ens1.EnsembleData.Status assert ens.EnsembleData.Year == ens1.EnsembleData.Year assert ens.EnsembleData.Month == ens1.EnsembleData.Month assert ens.EnsembleData.Day == ens1.EnsembleData.Day assert ens.EnsembleData.Hour == ens1.EnsembleData.Hour assert ens.EnsembleData.Minute == ens1.EnsembleData.Minute assert ens.EnsembleData.Second == ens1.EnsembleData.Second assert ens.EnsembleData.HSec == ens1.EnsembleData.HSec assert anc.FirstBinRange == pytest.approx(ens1.AncillaryData.FirstBinRange, 0.1) assert anc.BinSize == pytest.approx(ens1.AncillaryData.BinSize, 0.1) assert anc.FirstPingTime == pytest.approx(ens1.AncillaryData.FirstPingTime, 0.1) assert anc.LastPingTime == pytest.approx(ens1.AncillaryData.LastPingTime, 0.1) assert anc.Heading == pytest.approx(ens1.AncillaryData.Heading, 0.1) assert anc.Pitch == pytest.approx(ens1.AncillaryData.Pitch, 0.1) assert anc.Roll == pytest.approx(ens1.AncillaryData.Roll, 0.1) assert anc.WaterTemp == pytest.approx(ens1.AncillaryData.WaterTemp, 0.1) assert anc.SystemTemp == pytest.approx(ens1.AncillaryData.SystemTemp, 0.1) assert anc.Salinity == pytest.approx(ens1.AncillaryData.Salinity, 0.1) assert anc.Pressure == pytest.approx(ens1.AncillaryData.Pressure, 0.1) assert anc.TransducerDepth == pytest.approx( ens1.AncillaryData.TransducerDepth, 0.1) assert anc.SpeedOfSound == pytest.approx(ens1.AncillaryData.SpeedOfSound, 0.1) assert anc.RawMagFieldStrength == pytest.approx( ens1.AncillaryData.RawMagFieldStrength, 0.1) assert anc.PitchGravityVector == pytest.approx( ens1.AncillaryData.PitchGravityVector, 0.1) assert anc.RollGravityVector == pytest.approx( ens1.AncillaryData.RollGravityVector, 0.1) assert anc.VerticalGravityVector == pytest.approx( ens1.AncillaryData.VerticalGravityVector, 0.1) for beam in range(amp.element_multiplier): for bin_num in range(amp.num_elements): assert amp.Amplitude[bin_num][beam] == pytest.approx( ens1.Amplitude.Amplitude[bin_num][beam], 0.1) for beam in range(corr.element_multiplier): for bin_num in range(corr.num_elements): assert corr.Correlation[bin_num][beam] == pytest.approx( ens1.Correlation.Correlation[bin_num][beam], 0.1) for beam in range(beam_vel.element_multiplier): for bin_num in range(beam_vel.num_elements): assert beam_vel.Velocities[bin_num][beam] == pytest.approx( ens1.Wt.Velocities[bin_num][beam], 0.1) for beam in range(beam_vel.element_multiplier): for bin_num in range(beam_vel.num_elements): assert inst_vel.Velocities[bin_num][beam] == pytest.approx( ens1.InstrumentVelocity.Velocities[bin_num][beam], 0.1) for beam in range(beam_vel.element_multiplier): for bin_num in range(beam_vel.num_elements): assert earth_vel.Velocities[bin_num][beam] == pytest.approx( ens1.EarthVelocity.Velocities[bin_num][beam], 0.1) #for beam in range(gb.element_multiplier): # for bin_num in range(gb.num_elements): # assert gb.GoodBeam[bin_num][beam] == pytest.approx(ens1.GoodBeam.GoodBeam[bin_num][beam], 0.1) for beam in range(ge.element_multiplier): for bin_num in range(ge.num_elements): assert ge.GoodEarth[bin_num][beam] == pytest.approx( ens1.GoodEarth.GoodEarth[bin_num][beam], 0.1) assert bt.FirstPingTime == pytest.approx(ens1.BottomTrack.FirstPingTime) assert bt.LastPingTime == pytest.approx(ens1.BottomTrack.LastPingTime) assert bt.Heading == pytest.approx(ens1.BottomTrack.Heading) assert bt.Pitch == pytest.approx(ens1.BottomTrack.Pitch) assert bt.Roll == pytest.approx(ens1.BottomTrack.Roll) assert bt.WaterTemp == pytest.approx(ens1.BottomTrack.WaterTemp) assert bt.SystemTemp == pytest.approx(ens1.BottomTrack.SystemTemp) assert bt.Salinity == pytest.approx(ens1.BottomTrack.Salinity) assert bt.Pressure == pytest.approx(ens1.BottomTrack.Pressure) assert bt.TransducerDepth == pytest.approx( ens1.BottomTrack.TransducerDepth) assert bt.SpeedOfSound == pytest.approx(ens1.BottomTrack.SpeedOfSound) assert bt.Status == pytest.approx(ens1.BottomTrack.Status) assert bt.NumBeams == pytest.approx(ens1.BottomTrack.NumBeams) assert bt.ActualPingCount == pytest.approx( ens1.BottomTrack.ActualPingCount) assert bt.Range == pytest.approx(ens1.BottomTrack.Range) assert bt.SNR == pytest.approx(ens1.BottomTrack.SNR) assert bt.Amplitude == pytest.approx(ens1.BottomTrack.Amplitude) assert bt.Correlation == pytest.approx(ens1.BottomTrack.Correlation) assert bt.BeamVelocity == pytest.approx(ens1.BottomTrack.Wt) assert bt.BeamGood == pytest.approx(ens1.BottomTrack.BeamGood, 0.1) assert bt.InstrumentVelocity == pytest.approx( ens1.BottomTrack.InstrumentVelocity) assert bt.InstrumentGood == pytest.approx(ens1.BottomTrack.InstrumentGood, 0.1) assert bt.EarthVelocity == pytest.approx(ens1.BottomTrack.EarthVelocity) assert bt.EarthGood == pytest.approx(ens1.BottomTrack.EarthGood, 0.1) assert bt.SNR_PulseCoherent == pytest.approx( ens1.BottomTrack.SNR_PulseCoherent, 0.1) assert bt.Amp_PulseCoherent == pytest.approx( ens1.BottomTrack.Amp_PulseCoherent, 0.1) assert bt.Vel_PulseCoherent == pytest.approx( ens1.BottomTrack.Vel_PulseCoherent, 0.1) assert bt.Noise_PulseCoherent == pytest.approx( ens1.BottomTrack.Noise_PulseCoherent, 0.1) assert bt.Corr_PulseCoherent == pytest.approx( ens1.BottomTrack.Corr_PulseCoherent, 0.1) assert rt.NumBeams == ens1.RangeTracking.NumBeams assert rt.Range == pytest.approx(ens1.RangeTracking.Range) assert rt.SNR == pytest.approx(ens1.RangeTracking.SNR) assert rt.Amplitude == pytest.approx(ens1.RangeTracking.Amplitude) assert rt.Correlation == pytest.approx(ens1.RangeTracking.Correlation) assert rt.BeamVelocity == pytest.approx(ens1.RangeTracking.Wt) assert rt.InstrumentVelocity == pytest.approx( ens1.RangeTracking.InstrumentVelocity) assert rt.EarthVelocity == pytest.approx(ens1.RangeTracking.EarthVelocity) assert nmea.nmea_sentences == ens1.NmeaData.nmea_sentences assert ss.BtSamplesPerSecond == pytest.approx( ens1.SystemSetup.BtSamplesPerSecond, 0.1) assert ss.BtSystemFreqHz == pytest.approx(ens1.SystemSetup.BtSystemFreqHz, 0.1) assert ss.BtCPCE == pytest.approx(ens1.SystemSetup.BtCPCE, 0.1) assert ss.BtNCE == pytest.approx(ens1.SystemSetup.BtNCE, 0.1) assert ss.BtRepeatN == pytest.approx(ens1.SystemSetup.BtRepeatN, 0.1) assert ss.WpSamplesPerSecond == pytest.approx( ens1.SystemSetup.WpSamplesPerSecond, 0.1) assert ss.WpSystemFreqHz == pytest.approx(ens1.SystemSetup.WpSystemFreqHz, 0.1) assert ss.WpCPCE == pytest.approx(ens1.SystemSetup.WpCPCE, 0.1) assert ss.WpNCE == pytest.approx(ens1.SystemSetup.WpNCE, 0.1) assert ss.WpRepeatN == pytest.approx(ens1.SystemSetup.WpRepeatN, 0.1) assert ss.WpLagSamples == pytest.approx(ens1.SystemSetup.WpLagSamples, 0.1) assert ss.Voltage == pytest.approx(ens1.SystemSetup.Voltage, 0.1) assert ss.XmtVoltage == pytest.approx(ens1.SystemSetup.XmtVoltage, 0.1) assert ss.BtBroadband == pytest.approx(ens1.SystemSetup.BtBroadband, 0.1) assert ss.BtLagLength == pytest.approx(ens1.SystemSetup.BtLagLength, 0.1) assert ss.BtNarrowband == pytest.approx(ens1.SystemSetup.BtNarrowband, 0.1) assert ss.BtBeamMux == pytest.approx(ens1.SystemSetup.BtBeamMux, 0.1) assert ss.WpBroadband == pytest.approx(ens1.SystemSetup.WpBroadband, 0.1) assert ss.WpLagLength == pytest.approx(ens1.SystemSetup.WpLagLength, 0.1) assert ss.WpTransmitBandwidth == pytest.approx( ens1.SystemSetup.WpTransmitBandwidth, 0.1) assert ss.WpReceiveBandwidth == pytest.approx( ens1.SystemSetup.WpReceiveBandwidth, 0.1)
def test_write_binary(): num_bins = 33 num_beams = 4 ens = Ensemble() ens_ds = EnsembleData() ens_ds.EnsembleNumber = 2668 ens_ds.NumBins = 33 ens_ds.NumBeams = 4 ens_ds.DesiredPingCount = 45 ens_ds.ActualPingCount = 46 ens_ds.SerialNumber = "01H00000000000000000000000999999" ens_ds.SysFirmwareMajor = 2 ens_ds.SysFirmwareMinor = 11 ens_ds.SysFirmwareRevision = 5 ens_ds.SysFirmwareSubsystemCode = "A" ens_ds.SubsystemConfig = 3 ens_ds.Status = 9 ens_ds.Year = 2019 ens_ds.Month = 3 ens_ds.Day = 9 ens_ds.Hour = 12 ens_ds.Minute = 23 ens_ds.Second = 24 ens_ds.HSec = 33 anc = AncillaryData() anc.FirstBinRange = 1.0 # Blank. Depth to the first bin in meters. anc.BinSize = 3.0 # Size of a bin in meters. anc.FirstPingTime = 1.2 # First Ping Time in seconds. anc.LastPingTime = 2.3 # Last Ping Time in seconds. (If averaging pings, this will be the last ping) anc.Heading = 23.5 # Heading in degrees. anc.Pitch = 13.6 # Pitch in degrees. anc.Roll = 11.25 # Roll in degrees. anc.WaterTemp = 25.3 # Water Temperature in fahrenheit anc.SystemTemp = 54.6 # System Temperature in fahrenheit anc.Salinity = 35.0 # Water Salinity set by the user in PPT anc.Pressure = 23.78 # Pressure from pressure sensor in Pascals anc.TransducerDepth = 45.69 # Transducer Depth, used by Pressure sensor in meters anc.SpeedOfSound = 1400.23 # Speed of Sound in m/s. anc.RawMagFieldStrength = 3.0 # Raw magnetic field strength anc.PitchGravityVector = 4.0 # Pitch Gravity Vector anc.RollGravityVector = 5.0 # Roll Gravity Vector anc.VerticalGravityVector = 6.0 # Vertical Gravity Vector amp = Amplitude(num_bins, num_beams) corr = Correlation(num_bins, num_beams) beam_vel = BeamVelocity(num_bins, num_beams) inst_vel = InstrumentVelocity(num_bins, num_beams) earth_vel = EarthVelocity(num_bins, num_beams) gb = GoodBeam(num_bins, num_beams) ge = GoodEarth(num_bins, num_beams) val = 1.0 for beam in range(amp.element_multiplier): for bin_num in range(amp.num_elements): amp.Amplitude[bin_num][beam] = val corr.Correlation[bin_num][beam] = val beam_vel.Velocities[bin_num][beam] = val inst_vel.Velocities[bin_num][beam] = val earth_vel.Velocities[bin_num][beam] = val gb.GoodBeam[bin_num][beam] = 1 * int(beam) ge.GoodEarth[bin_num][beam] = 1 * int(beam) val += 1.1 bt = BottomTrack() bt.FirstPingTime = 12.5 bt.LastPingTime = 12.8 bt.Heading = 152.36 bt.Pitch = 12.6 bt.Roll = 223.1 bt.WaterTemp = 15.23 bt.SystemTemp = 78.58 bt.Salinity = 35.0 bt.Pressure = 23.36 bt.TransducerDepth = 156.2 bt.SpeedOfSound = 1402.36 bt.Status = 9.0 bt.NumBeams = 4.0 bt.ActualPingCount = 23 bt.Range = [1.1, 2.2, 3.3, 4.4] bt.SNR = [1.1, 2.2, 3.3, 4.4] bt.Amplitude = [1.1, 2.2, 3.3, 4.4] bt.Correlation = [1.1, 2.2, 3.3, 4.4] bt.BeamVelocity = [1.1, 2.2, 3.3, 4.4] bt.BeamGood = [1, 2, 3, 4] bt.InstrumentVelocity = [1.1, 2.2, 3.3, 4.4] bt.InstrumentGood = [1, 2, 3, 4] bt.EarthVelocity = [1.1, 2.2, 3.3, 4.4] bt.EarthGood = [1, 2, 3, 4] bt.SNR_PulseCoherent = [1, 2, 3, 4] bt.Amp_PulseCoherent = [1, 2, 3, 4] bt.Vel_PulseCoherent = [1, 2, 3, 4] bt.Noise_PulseCoherent = [1, 2, 3, 4] bt.Corr_PulseCoherent = [1, 2, 3, 4] rt = RangeTracking() rt.NumBeams = 4.0 rt.Range = [1.1, 2.2, 3.3, 4.4] rt.Pings = [1, 2, 3, 4] rt.SNR = [1.1, 2.2, 3.3, 4.4] rt.Amplitude = [1.1, 2.2, 3.3, 4.4] rt.Correlation = [1.1, 2.2, 3.3, 4.4] rt.BeamVelocity = [1.1, 2.2, 3.3, 4.4] rt.InstrumentVelocity = [1.1, 2.2, 3.3, 4.4] rt.EarthVelocity = [1.1, 2.2, 3.3, 4.4] nmea = NmeaData() nmea.add_nmea("$HEHDT,244.39,T*17\n") nmea.add_nmea( "$GPGGA,195949.00,3254.8103248,N,11655.5779629,W,2,08,1.1,222.174,M,-32.602,M,6.0,0138*75\n" ) nmea.add_nmea("$GPVTG,306.20,T,294.73,M,0.13,N,0.24,K,D*2E\n") nmea.add_nmea("$HEHDT,244.36,T*18\n") ss = SystemSetup() ss.BtSamplesPerSecond = 1.0 ss.BtSystemFreqHz = 3.0 ss.BtCPCE = 1.2 ss.BtNCE = 2.3 ss.BtRepeatN = 23.5 ss.WpSamplesPerSecond = 13.6 ss.WpSystemFreqHz = 11.25 ss.WpCPCE = 25.3 ss.WpNCE = 54.6 ss.WpRepeatN = 35.0 ss.WpLagSamples = 23.78 ss.Voltage = 45.69 ss.XmtVoltage = 1400.23 ss.BtBroadband = 3.0 ss.BtLagLength = 4.0 ss.BtNarrowband = 5.0 ss.BtBeamMux = 6.0 ss.WpBroadband = 6.0 ss.WpLagLength = 6.0 ss.WpTransmitBandwidth = 6.0 ss.WpReceiveBandwidth = 6.0 ens.AddAmplitude(amp) ens.AddCorrelation(corr) ens.AddBeamVelocity(beam_vel) ens.AddInstrumentVelocity(inst_vel) ens.AddEarthVelocity(earth_vel) ens.AddGoodBeam(gb) ens.AddGoodEarth(ge) ens.AddAncillaryData(anc) ens.AddEnsembleData(ens_ds) ens.AddBottomTrack(bt) ens.AddRangeTracking(rt) ens.AddSystemSetup(ss) ens.AddNmeaData(nmea) rti_writer = RtiBinaryWriter("C:\RTI_capture") for ens_count in range(0, 100): bin_data = ens.encode() rti_writer.write(bin_data) ens.EnsembleData.EnsembleNumber += 1 rti_writer.close()
def test_encode_csv(): bt = BottomTrack() bt.FirstPingTime = 12.5 bt.LastPingTime = 12.8 bt.Heading = 152.36 bt.Pitch = 12.6 bt.Roll = 223.1 bt.WaterTemp = 15.23 bt.SystemTemp = 78.58 bt.Salinity = 35.0 bt.Pressure = 23.36 bt.TransducerDepth = 156.2 bt.SpeedOfSound = 1402.36 bt.Status = 9.0 bt.NumBeams = 4.0 bt.ActualPingCount = 23 bt.Range = [1.1, 2.2, 3.3, 4.4] bt.SNR = [1.1, 2.2, 3.3, 4.4] bt.Amplitude = [1.1, 2.2, 3.3, 4.4] bt.Correlation = [1.1, 2.2, 3.3, 4.4] bt.BeamVelocity = [1.1, 2.2, 3.3, 4.4] bt.BeamGood = [1, 2, 3, 4] bt.InstrumentVelocity = [1.1, 2.2, 3.3, 4.4] bt.InstrumentGood = [1, 2, 3, 4] bt.EarthVelocity = [1.1, 2.2, 3.3, 4.4] bt.EarthGood = [1, 2, 3, 4] bt.SNR_PulseCoherent = [1, 2, 3, 4] bt.Amp_PulseCoherent = [1, 2, 3, 4] bt.Vel_PulseCoherent = [1, 2, 3, 4] bt.Noise_PulseCoherent = [1, 2, 3, 4] bt.Corr_PulseCoherent = [1, 2, 3, 4] # Populate data dt = datetime.datetime.now() # Create CSV lines result = bt.encode_csv(dt, 'A', 1, 1.3, 1.0) # Check the csv data for line in result: if Ensemble.CSV_BT_STATUS in line: assert bool(re.search(str(9), line)) assert bool(re.search(str(0), line)) if Ensemble.CSV_BT_HEADING in line: assert bool(re.search(str(152.36), line)) assert bool(re.search(str(0), line)) if Ensemble.CSV_BT_PITCH in line: assert bool(re.search(str(12.6), line)) assert bool(re.search(str(0), line)) if Ensemble.CSV_BT_ROLL in line: assert bool(re.search(str(223.1), line)) assert bool(re.search(str(0), line)) if Ensemble.CSV_BT_PRESSURE in line: assert bool(re.search(str(23.36), line)) assert bool(re.search(str(0), line)) if Ensemble.CSV_BT_XDCR_DEPTH in line: assert bool(re.search(str(156.2), line)) assert bool(re.search(str(0), line)) if Ensemble.CSV_BT_RANGE in line: if "0,0" in line: assert bool(re.search(str(1.1), line)) #if "0,1" in line: # assert bool(re.search(str(2.2), line)) if "0,2" in line: assert bool(re.search(str(3.3), line)) if "0,3" in line: assert bool(re.search(str(4.4), line)) if Ensemble.CSV_BT_BEAM_VEL in line: if "0,0" in line: assert bool(re.search(str(1.1), line)) #if "0,1" in line: # assert bool(re.search(str(2.2), line)) if "0,2" in line: assert bool(re.search(str(3.3), line)) if "0,3" in line: assert bool(re.search(str(4.4), line)) if Ensemble.CSV_BT_BEAM_GOOD in line: if "0,0" in line: assert bool(re.search(str(1), line)) #if "0,1" in line: # assert bool(re.search(str(2.2), line)) if "0,2" in line: assert bool(re.search(str(3), line)) if "0,3" in line: assert bool(re.search(str(4), line)) if Ensemble.CSV_BT_INSTR_VEL in line: if "0,0" in line: assert bool(re.search(str(1.1), line)) #if "0,1" in line: # assert bool(re.search(str(2.2), line)) if "0,2" in line: assert bool(re.search(str(3.3), line)) if "0,3" in line: assert bool(re.search(str(4.4), line)) if Ensemble.CSV_BT_INSTR_GOOD in line: if "0,0" in line: assert bool(re.search(str(1), line)) #if "0,1" in line: # assert bool(re.search(str(2.2), line)) if "0,2" in line: assert bool(re.search(str(3), line)) if "0,3" in line: assert bool(re.search(str(4), line)) if Ensemble.CSV_BT_EARTH_VEL in line: if "0,0" in line: assert bool(re.search(str(1.1), line)) #if "0,1" in line: # assert bool(re.search(str(2.2), line)) if "0,2" in line: assert bool(re.search(str(3.3), line)) if "0,3" in line: assert bool(re.search(str(4.4), line)) if Ensemble.CSV_BT_EARTH_GOOD in line: if "0,0" in line: assert bool(re.search(str(1), line)) #if "0,1" in line: # assert bool(re.search(str(2.2), line)) if "0,2" in line: assert bool(re.search(str(3), line)) if "0,3" in line: assert bool(re.search(str(4), line))
def test_encode_decode(): bt = BottomTrack() bt.FirstPingTime = 12.5 bt.LastPingTime = 12.8 bt.Heading = 152.36 bt.Pitch = 12.6 bt.Roll = 223.1 bt.WaterTemp = 15.23 bt.SystemTemp = 78.58 bt.Salinity = 35.0 bt.Pressure = 23.36 bt.TransducerDepth = 156.2 bt.SpeedOfSound = 1402.36 bt.Status = 9.0 bt.NumBeams = 4.0 bt.ActualPingCount = 23 bt.Range = [1.1, 2.2, 3.3, 4.4] bt.SNR = [1.1, 2.2, 3.3, 4.4] bt.Amplitude = [1.1, 2.2, 3.3, 4.4] bt.Correlation = [1.1, 2.2, 3.3, 4.4] bt.BeamVelocity = [1.1, 2.2, 3.3, 4.4] bt.BeamGood = [1, 2, 3, 4] bt.InstrumentVelocity = [1.1, 2.2, 3.3, 4.4] bt.InstrumentGood = [1, 2, 3, 4] bt.EarthVelocity = [1.1, 2.2, 3.3, 4.4] bt.EarthGood = [1, 2, 3, 4] bt.SNR_PulseCoherent = [1, 2, 3, 4] bt.Amp_PulseCoherent = [1, 2, 3, 4] bt.Vel_PulseCoherent = [1, 2, 3, 4] bt.Noise_PulseCoherent = [1, 2, 3, 4] bt.Corr_PulseCoherent = [1, 2, 3, 4] # Populate data result = bt.encode() bt1 = BottomTrack() bt1.decode(bytearray(result)) assert bt.FirstPingTime == pytest.approx(bt1.FirstPingTime) assert bt.LastPingTime == pytest.approx(bt1.LastPingTime) assert bt.Heading == pytest.approx(bt1.Heading) assert bt.Pitch == pytest.approx(bt1.Pitch) assert bt.Roll == pytest.approx(bt1.Roll) assert bt.WaterTemp == pytest.approx(bt1.WaterTemp) assert bt.SystemTemp == pytest.approx(bt1.SystemTemp) assert bt.Salinity == pytest.approx(bt1.Salinity) assert bt.Pressure == pytest.approx(bt1.Pressure) assert bt.TransducerDepth == pytest.approx(bt1.TransducerDepth) assert bt.SpeedOfSound == pytest.approx(bt1.SpeedOfSound) assert bt.Status == pytest.approx(bt1.Status) assert bt.NumBeams == pytest.approx(bt1.NumBeams) assert bt.ActualPingCount == pytest.approx(bt1.ActualPingCount) assert bt.Range == pytest.approx(bt1.Range) assert bt.SNR == pytest.approx(bt1.SNR) assert bt.Amplitude == pytest.approx(bt1.Amplitude) assert bt.Correlation == pytest.approx(bt1.Correlation) assert bt.BeamVelocity == pytest.approx(bt1.BeamVelocity) assert bt.BeamGood == pytest.approx(bt1.BeamGood, 0.1) assert bt.InstrumentVelocity == pytest.approx(bt1.InstrumentVelocity) assert bt.InstrumentGood == pytest.approx(bt1.InstrumentGood, 0.1) assert bt.EarthVelocity == pytest.approx(bt1.EarthVelocity) assert bt.EarthGood == pytest.approx(bt1.EarthGood, 0.1) assert bt.SNR_PulseCoherent == pytest.approx(bt1.SNR_PulseCoherent, 0.1) assert bt.Amp_PulseCoherent == pytest.approx(bt1.Amp_PulseCoherent, 0.1) assert bt.Vel_PulseCoherent == pytest.approx(bt1.Vel_PulseCoherent, 0.1) assert bt.Noise_PulseCoherent == pytest.approx(bt1.Noise_PulseCoherent, 0.1) assert bt.Corr_PulseCoherent == pytest.approx(bt1.Corr_PulseCoherent, 0.1)
def test_BottomTrackdata(): bt = BottomTrack() bt.FirstPingTime = 12.5 bt.LastPingTime = 12.8 bt.Heading = 152.36 bt.Pitch = 12.6 bt.Roll = 223.1 bt.WaterTemp = 15.23 bt.SystemTemp = 78.58 bt.Salinity = 35.0 bt.Pressure = 23.36 bt.TransducerDepth = 156.2 bt.SpeedOfSound = 1402.36 bt.Status = 9.0 bt.NumBeams = 4.0 bt.ActualPingCount = 23 bt.Range = [1.1, 2.2, 3.3, 4.4] bt.SNR = [1.1, 2.2, 3.3, 4.4] bt.Amplitude = [1.1, 2.2, 3.3, 4.4] bt.Correlation = [1.1, 2.2, 3.3, 4.4] bt.BeamVelocity = [1.1, 2.2, 3.3, 4.4] bt.BeamGood = [1, 2, 3, 4] bt.InstrumentVelocity = [1.1, 2.2, 3.3, 4.4] bt.InstrumentGood = [1, 2, 3, 4] bt.EarthVelocity = [1.1, 2.2, 3.3, 4.4] bt.EarthGood = [1, 2, 3, 4] bt.SNR_PulseCoherent = [1, 2, 3, 4] bt.Amp_PulseCoherent = [1, 2, 3, 4] bt.Vel_PulseCoherent = [1, 2, 3, 4] bt.Noise_PulseCoherent = [1, 2, 3, 4] bt.Corr_PulseCoherent = [1, 2, 3, 4] # Populate data result = bt.encode() # Value type assert 0x0A == result[0] assert 0x0 == result[1] assert 0x0 == result[2] assert 0x0 == result[3] # Num Elements assert 0x4A == result[4] assert 0x0 == result[5] assert 0x0 == result[6] assert 0x0 == result[7] # Element Multiplier assert 0x1 == result[8] assert 0x0 == result[9] assert 0x0 == result[10] assert 0x0 == result[11] # Imag assert 0x0 == result[12] assert 0x0 == result[13] assert 0x0 == result[14] assert 0x0 == result[15] # Name Length assert 0x8 == result[16] assert 0x0 == result[17] assert 0x0 == result[18] assert 0x0 == result[19] # Name assert ord('E') == result[20] assert ord('0') == result[21] assert ord('0') == result[22] assert ord('0') == result[23] assert ord('0') == result[24] assert ord('1') == result[25] assert ord('0') == result[26] assert ord('\0') == result[27] # Length assert len(result) == (74 * Ensemble.BytesInFloat) + 28 # Data # First Ping Time assert Ensemble.float_to_bytes(12.5)[0] == result[28] assert Ensemble.float_to_bytes(12.5)[1] == result[29] assert Ensemble.float_to_bytes(12.5)[2] == result[30] assert Ensemble.float_to_bytes(12.5)[3] == result[31] # Last Ping Time assert Ensemble.float_to_bytes(12.8)[0] == result[32] assert Ensemble.float_to_bytes(12.8)[1] == result[33] assert Ensemble.float_to_bytes(12.8)[2] == result[34] assert Ensemble.float_to_bytes(12.8)[3] == result[35] # Heading assert Ensemble.float_to_bytes(152.36)[0] == result[36] assert Ensemble.float_to_bytes(152.36)[1] == result[37] assert Ensemble.float_to_bytes(152.36)[2] == result[38] assert Ensemble.float_to_bytes(152.36)[3] == result[39] # Pitch assert Ensemble.float_to_bytes(12.6)[0] == result[40] assert Ensemble.float_to_bytes(12.6)[1] == result[41] assert Ensemble.float_to_bytes(12.6)[2] == result[42] assert Ensemble.float_to_bytes(12.6)[3] == result[43] # Roll assert Ensemble.float_to_bytes(223.1)[0] == result[44] assert Ensemble.float_to_bytes(223.1)[1] == result[45] assert Ensemble.float_to_bytes(223.1)[2] == result[46] assert Ensemble.float_to_bytes(223.1)[3] == result[47] # Water Temp assert Ensemble.float_to_bytes(15.23)[0] == result[48] assert Ensemble.float_to_bytes(15.23)[1] == result[49] assert Ensemble.float_to_bytes(15.23)[2] == result[50] assert Ensemble.float_to_bytes(15.23)[3] == result[51] # System Temp assert Ensemble.float_to_bytes(78.58)[0] == result[52] assert Ensemble.float_to_bytes(78.58)[1] == result[53] assert Ensemble.float_to_bytes(78.58)[2] == result[54] assert Ensemble.float_to_bytes(78.58)[3] == result[55] # Salinity assert Ensemble.float_to_bytes(35)[0] == result[56] assert Ensemble.float_to_bytes(35)[1] == result[57] assert Ensemble.float_to_bytes(35)[2] == result[58] assert Ensemble.float_to_bytes(35)[3] == result[59] # Pressure assert Ensemble.float_to_bytes(23.36)[0] == result[60] assert Ensemble.float_to_bytes(23.36)[1] == result[61] assert Ensemble.float_to_bytes(23.36)[2] == result[62] assert Ensemble.float_to_bytes(23.36)[3] == result[63] # XDCR Depth assert Ensemble.float_to_bytes(156.2)[0] == result[64] assert Ensemble.float_to_bytes(156.2)[1] == result[65] assert Ensemble.float_to_bytes(156.2)[2] == result[66] assert Ensemble.float_to_bytes(156.2)[3] == result[67] # Speed of Sound assert Ensemble.float_to_bytes(1402.36)[0] == result[68] assert Ensemble.float_to_bytes(1402.36)[1] == result[69] assert Ensemble.float_to_bytes(1402.36)[2] == result[70] assert Ensemble.float_to_bytes(1402.36)[3] == result[71] # Status assert Ensemble.float_to_bytes(9.0)[0] == result[72] assert Ensemble.float_to_bytes(9.0)[1] == result[73] assert Ensemble.float_to_bytes(9.0)[2] == result[74] assert Ensemble.float_to_bytes(9.0)[3] == result[75] # Number of Beams assert Ensemble.float_to_bytes(4)[0] == result[76] assert Ensemble.float_to_bytes(4)[1] == result[77] assert Ensemble.float_to_bytes(4)[2] == result[78] assert Ensemble.float_to_bytes(4)[3] == result[79] # Ping Count assert Ensemble.float_to_bytes(23)[0] == result[80] assert Ensemble.float_to_bytes(23)[1] == result[81] assert Ensemble.float_to_bytes(23)[2] == result[82] assert Ensemble.float_to_bytes(23)[3] == result[83] # Range Beam 0 assert Ensemble.float_to_bytes(1.1)[0] == result[84] assert Ensemble.float_to_bytes(1.1)[1] == result[85] assert Ensemble.float_to_bytes(1.1)[2] == result[86] assert Ensemble.float_to_bytes(1.1)[3] == result[87] # Range Beam 1 assert Ensemble.float_to_bytes(2.2)[0] == result[88] assert Ensemble.float_to_bytes(2.2)[1] == result[89] assert Ensemble.float_to_bytes(2.2)[2] == result[90] assert Ensemble.float_to_bytes(2.2)[3] == result[91] # Range Beam 2 assert Ensemble.float_to_bytes(3.3)[0] == result[92] assert Ensemble.float_to_bytes(3.3)[1] == result[93] assert Ensemble.float_to_bytes(3.3)[2] == result[94] assert Ensemble.float_to_bytes(3.3)[3] == result[95] # Range Beam 3 assert Ensemble.float_to_bytes(4.4)[0] == result[96] assert Ensemble.float_to_bytes(4.4)[1] == result[97] assert Ensemble.float_to_bytes(4.4)[2] == result[98] assert Ensemble.float_to_bytes(4.4)[3] == result[99] # SNR Beam 0 assert Ensemble.float_to_bytes(1.1)[0] == result[100] assert Ensemble.float_to_bytes(1.1)[1] == result[101] assert Ensemble.float_to_bytes(1.1)[2] == result[102] assert Ensemble.float_to_bytes(1.1)[3] == result[103] # SNR Beam 1 assert Ensemble.float_to_bytes(2.2)[0] == result[104] assert Ensemble.float_to_bytes(2.2)[1] == result[105] assert Ensemble.float_to_bytes(2.2)[2] == result[106] assert Ensemble.float_to_bytes(2.2)[3] == result[107] # SNR Beam 2 assert Ensemble.float_to_bytes(3.3)[0] == result[108] assert Ensemble.float_to_bytes(3.3)[1] == result[109] assert Ensemble.float_to_bytes(3.3)[2] == result[110] assert Ensemble.float_to_bytes(3.3)[3] == result[111] # SNR Beam 3 assert Ensemble.float_to_bytes(4.4)[0] == result[112] assert Ensemble.float_to_bytes(4.4)[1] == result[113] assert Ensemble.float_to_bytes(4.4)[2] == result[114] assert Ensemble.float_to_bytes(4.4)[3] == result[115] # Amp Beam 0 assert Ensemble.float_to_bytes(1.1)[0] == result[116] assert Ensemble.float_to_bytes(1.1)[1] == result[117] assert Ensemble.float_to_bytes(1.1)[2] == result[118] assert Ensemble.float_to_bytes(1.1)[3] == result[119] # Amp Beam 1 assert Ensemble.float_to_bytes(2.2)[0] == result[120] assert Ensemble.float_to_bytes(2.2)[1] == result[121] assert Ensemble.float_to_bytes(2.2)[2] == result[122] assert Ensemble.float_to_bytes(2.2)[3] == result[123] # Amp Beam 2 assert Ensemble.float_to_bytes(3.3)[0] == result[124] assert Ensemble.float_to_bytes(3.3)[1] == result[125] assert Ensemble.float_to_bytes(3.3)[2] == result[126] assert Ensemble.float_to_bytes(3.3)[3] == result[127] # Amp Beam 3 assert Ensemble.float_to_bytes(4.4)[0] == result[128] assert Ensemble.float_to_bytes(4.4)[1] == result[129] assert Ensemble.float_to_bytes(4.4)[2] == result[130] assert Ensemble.float_to_bytes(4.4)[3] == result[131] # Corr Beam 0 assert Ensemble.float_to_bytes(1.1)[0] == result[132] assert Ensemble.float_to_bytes(1.1)[1] == result[133] assert Ensemble.float_to_bytes(1.1)[2] == result[134] assert Ensemble.float_to_bytes(1.1)[3] == result[135] # Corr Beam 1 assert Ensemble.float_to_bytes(2.2)[0] == result[136] assert Ensemble.float_to_bytes(2.2)[1] == result[137] assert Ensemble.float_to_bytes(2.2)[2] == result[138] assert Ensemble.float_to_bytes(2.2)[3] == result[139] # Corr Beam 2 assert Ensemble.float_to_bytes(3.3)[0] == result[140] assert Ensemble.float_to_bytes(3.3)[1] == result[141] assert Ensemble.float_to_bytes(3.3)[2] == result[142] assert Ensemble.float_to_bytes(3.3)[3] == result[143] # Corr Beam 3 assert Ensemble.float_to_bytes(4.4)[0] == result[144] assert Ensemble.float_to_bytes(4.4)[1] == result[145] assert Ensemble.float_to_bytes(4.4)[2] == result[146] assert Ensemble.float_to_bytes(4.4)[3] == result[147] # Beam Velocity Beam 0 assert Ensemble.float_to_bytes(1.1)[0] == result[148] assert Ensemble.float_to_bytes(1.1)[1] == result[149] assert Ensemble.float_to_bytes(1.1)[2] == result[150] assert Ensemble.float_to_bytes(1.1)[3] == result[151] # Beam Velocity Beam 1 assert Ensemble.float_to_bytes(2.2)[0] == result[152] assert Ensemble.float_to_bytes(2.2)[1] == result[153] assert Ensemble.float_to_bytes(2.2)[2] == result[154] assert Ensemble.float_to_bytes(2.2)[3] == result[155] # Beam Velocity Beam 2 assert Ensemble.float_to_bytes(3.3)[0] == result[156] assert Ensemble.float_to_bytes(3.3)[1] == result[157] assert Ensemble.float_to_bytes(3.3)[2] == result[158] assert Ensemble.float_to_bytes(3.3)[3] == result[159] # Beam Velocity Beam 3 assert Ensemble.float_to_bytes(4.4)[0] == result[160] assert Ensemble.float_to_bytes(4.4)[1] == result[161] assert Ensemble.float_to_bytes(4.4)[2] == result[162] assert Ensemble.float_to_bytes(4.4)[3] == result[163] # Beam Good Beam 0 assert Ensemble.float_to_bytes(1)[0] == result[164] assert Ensemble.float_to_bytes(1)[1] == result[165] assert Ensemble.float_to_bytes(1)[2] == result[166] assert Ensemble.float_to_bytes(1)[3] == result[167] # Beam Good Beam 1 assert Ensemble.float_to_bytes(2)[0] == result[168] assert Ensemble.float_to_bytes(2)[1] == result[169] assert Ensemble.float_to_bytes(2)[2] == result[170] assert Ensemble.float_to_bytes(2)[3] == result[171] # Beam Good Beam 2 assert Ensemble.float_to_bytes(3)[0] == result[172] assert Ensemble.float_to_bytes(3)[1] == result[173] assert Ensemble.float_to_bytes(3)[2] == result[174] assert Ensemble.float_to_bytes(3)[3] == result[175] # Beam Good Beam 3 assert Ensemble.float_to_bytes(4)[0] == result[176] assert Ensemble.float_to_bytes(4)[1] == result[177] assert Ensemble.float_to_bytes(4)[2] == result[178] assert Ensemble.float_to_bytes(4)[3] == result[179] index = 180 # Instrument Velocity Beam 0 assert Ensemble.float_to_bytes(1.1)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(1.1)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(1.1)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(1.1)[3] == result[index] index += 1 # Instrument Velocity Beam 1 assert Ensemble.float_to_bytes(2.2)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(2.2)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(2.2)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(2.2)[3] == result[index] index += 1 # Instrument Velocity Beam 2 assert Ensemble.float_to_bytes(3.3)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(3.3)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(3.3)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(3.3)[3] == result[index] index += 1 # Instrument Velocity Beam 3 assert Ensemble.float_to_bytes(4.4)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(4.4)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(4.4)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(4.4)[3] == result[index] index += 1 # Instrument Good Beam 0 assert Ensemble.float_to_bytes(1)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[3] == result[index] index += 1 # Instrument Good Beam 1 assert Ensemble.float_to_bytes(2)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[3] == result[index] index += 1 # Instrument Good Beam 2 assert Ensemble.float_to_bytes(3)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[3] == result[index] index += 1 # Instrument Good Beam 3 assert Ensemble.float_to_bytes(4)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[3] == result[index] index += 1 # Earth Velocity Beam 0 assert Ensemble.float_to_bytes(1.1)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(1.1)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(1.1)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(1.1)[3] == result[index] index += 1 # Earth Velocity Beam 1 assert Ensemble.float_to_bytes(2.2)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(2.2)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(2.2)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(2.2)[3] == result[index] index += 1 # Earth Velocity Beam 2 assert Ensemble.float_to_bytes(3.3)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(3.3)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(3.3)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(3.3)[3] == result[index] index += 1 # Earth Velocity Beam 3 assert Ensemble.float_to_bytes(4.4)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(4.4)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(4.4)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(4.4)[3] == result[index] index += 1 # Earth Good Beam 0 assert Ensemble.float_to_bytes(1)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[3] == result[index] index += 1 # Earth Good Beam 1 assert Ensemble.float_to_bytes(2)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[3] == result[index] index += 1 # Earth Good Beam 2 assert Ensemble.float_to_bytes(3)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[3] == result[index] index += 1 # Earth Good Beam 3 assert Ensemble.float_to_bytes(4)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[3] == result[index] index += 1 # SNR Pulse Coherent Beam 0 assert Ensemble.float_to_bytes(1)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[3] == result[index] index += 1 # SNR Pulse Coherent Beam 1 assert Ensemble.float_to_bytes(2)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[3] == result[index] index += 1 # SNR Pulse Coherent Beam 2 assert Ensemble.float_to_bytes(3)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[3] == result[index] index += 1 # SNR Pulse Coherent Beam 3 assert Ensemble.float_to_bytes(4)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[3] == result[index] index += 1 # Amp Pulse Coherent Beam 0 assert Ensemble.float_to_bytes(1)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[3] == result[index] index += 1 # Amp Pulse Coherent Beam 1 assert Ensemble.float_to_bytes(2)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[3] == result[index] index += 1 # Amp Pulse Coherent Beam 2 assert Ensemble.float_to_bytes(3)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[3] == result[index] index += 1 # Amp Pulse Coherent Beam 3 assert Ensemble.float_to_bytes(4)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[3] == result[index] index += 1 # Vel Pulse Coherent Beam 0 assert Ensemble.float_to_bytes(1)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[3] == result[index] index += 1 # Vel Pulse Coherent Beam 1 assert Ensemble.float_to_bytes(2)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[3] == result[index] index += 1 # Vel Pulse Coherent Beam 2 assert Ensemble.float_to_bytes(3)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[3] == result[index] index += 1 # Vel Pulse Coherent Beam 3 assert Ensemble.float_to_bytes(4)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[3] == result[index] index += 1 # Noise Pulse Coherent Beam 0 assert Ensemble.float_to_bytes(1)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[3] == result[index] index += 1 # Noise Pulse Coherent Beam 1 assert Ensemble.float_to_bytes(2)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[3] == result[index] index += 1 # Noise Pulse Coherent Beam 2 assert Ensemble.float_to_bytes(3)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[3] == result[index] index += 1 # Noise Pulse Coherent Beam 3 assert Ensemble.float_to_bytes(4)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[3] == result[index] index += 1 # Corr Pulse Coherent Beam 0 assert Ensemble.float_to_bytes(1)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(1)[3] == result[index] index += 1 # Corr Pulse Coherent Beam 1 assert Ensemble.float_to_bytes(2)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(2)[3] == result[index] index += 1 # Corr Pulse Coherent Beam 2 assert Ensemble.float_to_bytes(3)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(3)[3] == result[index] index += 1 # Corr Pulse Coherent Beam 3 assert Ensemble.float_to_bytes(4)[0] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[1] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[2] == result[index] index += 1 assert Ensemble.float_to_bytes(4)[3] == result[index] index += 1