roboglia.base.PVLList

class PVLList(p=[], v=[], ld=[])[source]

Bases: object

A class that holds a list of PVL commands and provides a number of extra manipulation functions.

The constructor pads the supplied lists with nan in case the lists are unequal in size.

Parameters
  • p (list of [float or nan]) –

    The position commands as a list of float or nan like this:

    p=[1, 2, nan, 30, nan, 20, 10, nan]
    

  • v (list of [float or nan]) – The velocity commands as a list of float or nan

  • ld (list of [float or nan]) – The load commands as a list of float or nan

__init__(p=[], v=[], ld=[])[source]

Initialize self. See help(type(self)) for accurate signature.

property items

Returns the raw items of the list.

__len__()[source]

Returns the length of the list.

__getitem__(item)[source]

Access an item by position.

__repr__()[source]

Provides a representation of the PVLList for convenience. It will show a list of PVLs.

property positions

Returns the full list of positions (p) commands, including nan from the list.

property velocities

Returns the full list of velocities (v) commands, including nan from the list.

property loads

Returns the full list of load (ld) commands, including nan from the list.

append(p=nan, v=nan, ld=nan, p_list=[], v_list=[], l_list=[], pvl=None, pvl_list=[])[source]

Appends items to the PVL List. Depending on the way you call it you can:

  • append one item defined by parameters p, v and l

  • append a list of items defined by paramters p_list, v_list and l_list; this works similar with the constructor by padding the lists if they have unequal length

  • append one PVL object is provided as pvl

  • append a list of PVL objects provided as pvl_list

process(p_func=<function mean>, v_func=<function mean>, ld_func=<function mean>)[source]

Performs an aggregation function on all the elements in the list by applying the provided functions to the p, v and ld components of all the items in the list.

Parameters
  • p_func (function) – An aggregation function to be used for p values in the list. Default is statistics.mean.

  • v_func (function) – An aggregation function to be used for v values in the list. Default is statistics.mean.

  • ld_func (function) – An aggregation function to be used for ld values in the list. Default is statistics.mean.

Returns

A PVL object with the aggregated result. If any of the components is missing any values in the list it will be reflected with nan value in that position.

Return type

PVL