|
| std::vector< size_t > | downsampleIndices (const std::vector< Point > &data, size_t target_size) |
| | Selects representative point indices while preserving the overall curve shape.
|
| bool | parseDataRowValues (const std::string &line, std::vector< double > &values_out, size_t min_value_count=2) |
| | Parses a data row into its numeric columns after the integer row index.
|
| bool | parseDataRow (const std::string &line, Point &point_out) |
| | Parses a data row into a point using the first and last numeric columns.
|
| size_t | joinedSizeBytes (const std::vector< std::string > &lines) |
| | Computes the serialized byte size of lines joined with newline separators.
|
| std::vector< std::string > | buildOutputWithSelectedRows (const std::vector< std::string > &input_lines, const std::vector< size_t > &data_line_positions, const std::vector< size_t > &selected_row_indices) |
| | Rebuilds the output while preserving metadata lines and selected data rows.
|
| template<typename XSelector, typename YSelector> |
| std::vector< std::string > | downsampleDatasetToMaxBytes (const std::vector< std::string > &input_lines, size_t max_bytes, size_t min_value_count, XSelector x_selector, YSelector y_selector) |
| | Downsamples data rows to fit within a maximum serialized byte budget.
|
| jaiabot::protobuf::GeographicCoordinate | calculate_position_from_offset (const goby::util::UTMGeodesy &geodesy, const jaiabot::protobuf::GeographicCoordinate &start_location, double distance_meters, double heading_degrees) |
| PolarCoordinate | convert_cartesian_to_polar (double start_x, double start_y, double end_x, double end_y) |
| jaiabot::protobuf::GeographicCoordinate | find_dive_end_location (const goby::util::UTMGeodesy &geodesy, double duration_to_acquire_gps, const jaiabot::protobuf::GeographicCoordinate &drift_start_location, double drift_speed, double drift_heading) |
| float | haversine (float lat1, float lon1, float lat2, float lon2) |
| float | calculateHeading (double sx, double sy, double ex, double ey) |
| template<typename Quantity> |
| std::ostream & | operator<< (std::ostream &os, const RollingStatsAccumulator< Quantity > &acc) |
template<typename XSelector, typename YSelector>
| std::vector< std::string > jaiabot::utils::downsampleDatasetToMaxBytes |
( |
const std::vector< std::string > & | input_lines, |
|
|
size_t | max_bytes, |
|
|
size_t | min_value_count, |
|
|
XSelector | x_selector, |
|
|
YSelector | y_selector ) |
|
inline |
Downsamples data rows to fit within a maximum serialized byte budget.
Metadata lines are preserved, while parsed data rows are reduced by binary searching for the largest representative subset whose serialized size does not exceed max_bytes. The x and y coordinates are selected from each parsed row via caller-provided selectors.
Each data row is expected to begin with an integer row index followed by numeric values. The selectors receive the numeric values after that index, so they can map arbitrary columns to x/y coordinates without needing to parse the row themselves.
Since the selectors index those values directly, min_value_count must cover the widest column they read; narrower rows are left as metadata instead of being selected on.
- Template Parameters
-
| XSelector | Callable with signature compatible with double(const std::vector<double>& values). |
| YSelector | Callable with signature compatible with double(const std::vector<double>& values). |
- Parameters
-
| input_lines | Full input dataset, including metadata and data rows. |
| max_bytes | Maximum allowed serialized size for the returned dataset. |
| min_value_count | Minimum numeric columns a data row must contain. |
| x_selector | Selects the x coordinate from parsed numeric columns. |
| y_selector | Selects the y coordinate from parsed numeric columns. |
- Returns
- A dataset constrained to the requested byte budget.
Definition at line 299 of file downsample.h.