Skip to content

Subject

labda.Subject

LABDA's data object.

from_parquet classmethod

from_parquet(path: Path | str) -> Self

Creates an instance of LABDA data class from a Parquet file. Reads a Parquet file from the specified path, loads the data into a DataFrame and extracts metadata.

Parameters:

Name Type Description Default
path Path | str

The file path to the Parquet file.

required

Returns:

Name Type Description
Self Self

An instance of the class initialized with data from the Parquet file.

to_parquet

to_parquet(
    path: str | Path, overwrite: bool = False
) -> None

Save the DataFrame and metadata to Parquet format and writes it to the specified path.

Parameters:

Name Type Description Default
path str | Path

The file path where the Parquet file will be saved.

required
overwrite bool

If True, overwrite the file if it exists. Defaults to False.

False

Returns:

Type Description
None

None

set_timezone

set_timezone(timezone: str | ZoneInfo = 'infer') -> None

resample

resample(
    sampling_frequency: str | timedelta = "uniform",
    mapper: dict[str, Any] | None = None,
    drop: bool = False,
) -> None

add_vector_magnitude

add_vector_magnitude(
    columns: list[str] | Literal["counts"],
    name: str | None = None,
    overwrite: bool = False,
) -> None

get_wear_times

get_wear_times(
    start: str | time | None = None,
    end: str | time | None = None,
    duration: str | timedelta | None = None,
    drop: Literal["acc", "gnss", "acc+gnss"] | None = None,
) -> tuple[pd.DataFrame, pd.DataFrame]

detect_wear

detect_wear(
    algorithm: dict[str, Any], overwrite: bool = False
) -> None

detect_indoor

detect_indoor(
    method: Literal[
        "sat_viewed",
        "sat_used",
        "sat_ratio",
        "snr_viewed",
        "snr_used",
        "gnss_accuracy",
    ] = "snr_viewed",
    limit: float = 215,
    overwrite: bool = False,
) -> None

set_crs

set_crs(crs: str | CRS = 'infer') -> None

detect_activity_intensity

detect_activity_intensity(
    algorithm: dict[str, Any],
    non_wear: float | None = 0.8,
    overwrite: bool = False,
) -> None

merge

merge(
    other: Self,
    how: Literal["outer", "inner"] = "outer",
    inplace: bool = False,
) -> Self | None

detect_trips

detect_trips(
    stop_radius: float = 30,
    stop_duration: str | timedelta = "5min",
    pause_radius: float | None = 15,
    pause_duration: str | timedelta | None = "2.5min",
    min_length: float | None = None,
    min_duration: str | timedelta | None = "1min",
    indoor_limit: float | None = 0.7,
    turn_angle: float | None = None,
    overwrite: bool = False,
) -> None

detect_transportation

detect_transportation(
    algorithm: dict[str, Any], overwrite: bool = False
) -> None

get_summary

get_summary(
    variables: (
        Literal[
            "activity_intensity",
            "trip_status",
            "trip_transport",
            "context",
        ]
        | list[str]
    ),
    freq: str = "D",
    context: bool = False,
) -> pd.DataFrame

plot

plot(
    how: Literal["map"],
    color: str | None = None,
    start: str | datetime | None = None,
    end: str | datetime | None = None,
    export: str | Path | None = None,
) -> Any