TDRPhases class

Class handling all TDR phase operations

Phase identification methods take depth as input.

Class and Methods Summary

TDRPhases.detect_wet(depth[, dry_thr, …])

Detect wet/dry activity phases

TDRPhases.detect_dives(depth, dive_thr)

Identify dive events

TDRPhases.detect_dive_phases(depth, dive_model)

Detect dive phases

TDRPhases.get_dives_details(key[, columns])

Accessor for the dives attribute

TDRPhases.get_dive_deriv(diveNo, phase)

Retrieve depth spline derivative for a given dive

TDRPhases.get_wet_activity()

Accessor for the wet_dry attribute

TDRPhases.get_params(key)

Return parameters used for identifying wet/dry or diving phases.

TDRPhases.time_budget([ignore_z, ignore_du])

Summary of wet/dry activities at the broadest time scale

TDRPhases.stamp_dives([ignore_z])

Identify the wet activity phase corresponding to each dive

class tdrphases.TDRPhases[source]

Core TDR phase identification routines

wet_dry
Type

pandas.DataFrame

dives

Dictionary of dive activity data {‘row_ids’: pandas.DataFrame, ‘model’: str, ‘splines’: dict, ‘spline_derivs’: pandas.DataFrame, ‘crit_vals’: pandas.DataFrame}.

Type

dict

params

Dictionary with parameters used for detection of wet/dry and dive phases. {‘wet_dry’: {‘dry_thr’: float, ‘wet_thr’: float}, ‘dives’: {‘dive_thr’: float, ‘dive_model’: str, ‘smooth_par’: float, ‘knot_factor’: int, ‘descent_crit_q’: float, ‘ascent_crit_q’: float}}

Type

dict

detect_dive_phases(depth, dive_model, smooth_par=0.1, knot_factor=3, descent_crit_q=0, ascent_crit_q=0)[source]

Detect dive phases

Complete filling the dives attribute.

Parameters
  • depth (xarray.DataArray) – DataArray with zero-offset corrected depth measurements.

  • dive_model ({"unimodal", "smooth.spline"}) –

  • smooth_par (float, optional) –

  • knot_factor (int, optional) –

  • descent_crit_q (float, optional) –

  • ascent_crit_q (float, optional) –

Notes

See details for arguments in diveMove’s calibrateDepth.

detect_dives(depth, dive_thr)[source]

Identify dive events

Set the dives attribute’s “row_ids” dictionary element, and update the wet_act attribute’s “phases” dictionary element.

Parameters
  • depth (xarray.DataArray) – DataArray with zero-offset corrected depth measurements.

  • dive_thr (float) –

Notes

See details for arguments in diveMove’s calibrateDepth.

detect_wet(depth, dry_thr=70, wet_cond=None, wet_thr=3610, interp_wet=False)[source]

Detect wet/dry activity phases

Set the wet_dry attribute.

Parameters
  • depth (xarray.DataArray) – DataArray with zero-offset corrected depth measurements.

  • dry_thr (float, optional) –

  • wet_cond (bool mask, optional) –

  • wet_thr (float, optional) –

  • interp_wet (bool, optional) –

Notes

See details for arguments in diveMove’s calibrateDepth. Unlike diveMove, the beginning/ending times for each phase are not stored with the class instance, as this information can be retrieved via the .time_budget method.

get_dive_deriv(diveNo, phase)[source]

Retrieve depth spline derivative for a given dive

Parameters
  • diveNo (int) – Dive number to retrieve derivative for.

  • phase ({"descent", "bottom", "ascent"}) – If provided, the dive phase to retrieve data for.

Returns

out

Return type

pandas.Series

get_dives_details(key, columns=None)[source]

Accessor for the dives attribute

Parameters
  • key ({"row_ids", "model", "splines", "spline_derivs", crit_vals}) – Name of the key to retrieve.

  • columns (array_like, optional) – Names of the columns of the dataframe in key, when applicable.

get_params(key)[source]

Return parameters used for identifying wet/dry or diving phases.

Parameters

key ({'wet_dry', 'dives'}) –

get_wet_activity()[source]

Accessor for the wet_dry attribute

stamp_dives(ignore_z=True)[source]

Identify the wet activity phase corresponding to each dive

Parameters

ignore_z (bool, optional) – Whether to ignore trivial aquatic periods.

Returns

out – DataFrame indexed by dive ID, and three columns identifying which phase thy are in, and the beginning and ending time stamps.

Return type

pandas.DataFrame

time_budget(ignore_z=True, ignore_du=True)[source]

Summary of wet/dry activities at the broadest time scale

Parameters
  • ignore_z (bool, optional) – Whether to ignore trivial aquatic periods.

  • ignore_du (bool, optional) – Whether to ignore diving and underwater periods.

Returns

out – DataFrame indexed by phase id, with categorical activity label for each phase, and beginning and ending times.

Return type

pandas.DataFrame