MCPcopy Create free account
hub / github.com/facebook/time / parseDataPoint

Function parseDataPoint

caliper/tor.go:243–257  ·  view source on GitHub ↗
(line string)

Source from the content-addressed store, hash-verified

241}
242
243func parseDataPoint(line string) (DataPoint, error) {
244 parts := strings.Split(line, "\t")
245 if len(parts) != 2 {
246 return DataPoint{}, fmt.Errorf("invalid data point: %q", line)
247 }
248 dist, err := strconv.ParseFloat(strings.TrimSpace(parts[0]), 64)
249 if err != nil {
250 return DataPoint{}, fmt.Errorf("parsing distance: %w", err)
251 }
252 amp, err := strconv.ParseFloat(strings.TrimSpace(parts[1]), 64)
253 if err != nil {
254 return DataPoint{}, fmt.Errorf("parsing amplitude: %w", err)
255 }
256 return DataPoint{DistanceM: dist, AmplitudeDB: amp}, nil
257}
258
259// parseWavelengthFromInfo extracts the wavelength in nm from the InstrumentInfo string.
260// Example: "1310 nm - 1 ns -" -> 1310

Callers 3

ParseTORReaderFunction · 0.85
TestParseDataPointValidFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestParseDataPointValidFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…