StoutLoader¶
StoutLoader
¶
Data loader for STOUT campaign management system.
Provides methods to load flight data paths and associated metadata from the STOUT database and file system.
Attributes:
| Name | Type | Description |
|---|---|---|
campaign_service |
Optional[CampaignService]
|
Service for accessing campaign and flight data |
base_data_path |
Optional[Path]
|
Base path where all campaign data is stored |
Initialize the StoutDataLoader.
Initializes the loader and attempts to connect to stout campaign service. Falls back to filesystem queries if stout import fails.
Source code in pils/loader/stout.py
load_all_flights
¶
Load all flights from all campaigns.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
list of flight dictionaries containing flight metadata and paths. Each flight dict includes: flight_id, flight_name, campaign_id, takeoff_datetime, landing_datetime, and folder paths. |
Source code in pils/loader/stout.py
load_all_campaign_flights
¶
load_all_campaign_flights(campaign_id: str | None = None, campaign_name: str | None = None) -> list[dict[str, Any]] | None
Load all flights from a specific campaign.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
campaign_id
|
Optional[str]
|
Campaign ID to load |
None
|
campaign_name
|
Optional[str]
|
Campaign name to load (alternative to campaign_id) |
None
|
Returns:
| Type | Description |
|---|---|
Optional[dict[str, Any]]
|
Campaign dictionary with metadata and paths, or None if not found. |
Source code in pils/loader/stout.py
load_single_flight
¶
load_single_flight(flight_id: str | None = None, flight_name: str | None = None) -> dict[str, Any] | None
Load data for a single flight.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flight_id
|
Optional[str]
|
Flight ID to load |
None
|
flight_name
|
Optional[str]
|
Flight name to load (alternative to flight_id) |
None
|
Returns:
| Type | Description |
|---|---|
Optional[dict[str, Any]]
|
Flight dictionary with metadata and paths, or None if not found. |
Source code in pils/loader/stout.py
load_flights_by_date
¶
load_flights_by_date(start_date: str, end_date: str, campaign_id: str | None = None) -> list[dict[str, Any]]
Load flights within a date range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_date
|
str
|
Start date in format 'YYYY-MM-DD' |
required |
end_date
|
str
|
End date in format 'YYYY-MM-DD' |
required |
campaign_id
|
Optional[str]
|
Filter by campaign ID (optional) |
None
|
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
list of flight dictionaries matching the date range. |
Source code in pils/loader/stout.py
load_specific_data
¶
Load specific data types from a flight.
Supported data types depend on the flight structure: - 'drone': Drone raw data (from drone folder) - 'aux': Auxiliary data (from aux folder) - 'proc': Processed data (from proc folder) - 'camera': Camera-specific data - 'gps': GPS-specific data - 'imu': IMU-specific data
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flight_id
|
str
|
Flight ID to load data from |
required |
data_types
|
Optional[list[str]]
|
list of data types to load. If None, loads all available. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, list[str]]
|
dictionary mapping data_type to list of file paths. |
Source code in pils/loader/stout.py
get_campaign_list
¶
Get list of all campaigns.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
list of campaign dictionaries with metadata. |
Source code in pils/loader/stout.py
load_flight_data
¶
load_flight_data(flight_id: str | None = None, flight_name: str | None = None, sensors: list[str] | None = None, drones: list[str] | None = None, freq_interpolation: float | None = None, dji_drone_type: str | None = None, drone_correct_timestamp: bool | None = True, polars_interpolation: bool | None = True, align_drone: bool | None = True) -> dict[str, Any]
Load flight data and return dataframes for requested sensors and drones.
This is the main method to load flight data. It returns a dictionary containing flight metadata and dataframes for the requested data types.
Supported sensors: - 'gps': GPS data from UBX/BIN file - 'imu': IMU data - 'adc': ADC sensor data - 'camera': Camera data - 'inclinometer': Inclinometer data
Supported drones: - 'dji': DJI drone telemetry from DAT file - 'litchi': Litchi flight logs - 'blacksquare': BlackSquare drone logs
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flight_id
|
Optional[str]
|
Flight ID to load |
None
|
flight_name
|
Optional[str]
|
Flight name to load (alternative to flight_id) |
None
|
sensors
|
Optional[list[str]]
|
list of sensor types to load. If None, loads ['gps']. |
None
|
drones
|
Optional[list[str]]
|
list of drone types to load. If None, loads ['dji']. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dictionary containing:
- 'flight_info': Flight metadata dictionary
- ' |
Examples:
>>> loader = StoutDataLoader()
>>> data = loader.load_flight_data(
... flight_id='some-id',
... sensors=['gps', 'imu'],
... drones=['dji']
... )
>>> gps_df = data['gps']
>>> drone_df = data['dji']
Source code in pils/loader/stout.py
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 | |